Changeset 6eabb6e6 in mainline for kernel/arch/sparc64
- Timestamp:
- 2006-09-13T13:16:30Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34d9469e
- Parents:
- 9a5b556
- Location:
- kernel/arch/sparc64
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/Makefile.inc
r9a5b556 r6eabb6e6 88 88 arch/$(ARCH)/src/console.c \ 89 89 arch/$(ARCH)/src/context.S \ 90 arch/$(ARCH)/src/fpu_context.c \ 90 91 arch/$(ARCH)/src/dummy.s \ 91 92 arch/$(ARCH)/src/mm/as.c \ -
kernel/arch/sparc64/include/asm.h
r9a5b556 r6eabb6e6 109 109 } 110 110 111 /** Read FPRS Register. 112 * 113 * @return Value of FPRS register. 114 */ 115 static inline uint64_t fprs_read(void) 116 { 117 uint64_t v; 118 119 __asm__ volatile ("rd %%fprs, %0\n" : "=r" (v)); 120 121 return v; 122 } 123 124 /** Write FPRS Register. 125 * 126 * @param v New value of FPRS register. 127 */ 128 static inline void fprs_write(uint64_t v) 129 { 130 __asm__ volatile ("wr %0, %1, %%fprs\n" : : "r" (v), "i" (0)); 131 } 132 111 133 /** Read SOFTINT Register. 112 134 * -
kernel/arch/sparc64/include/fpu_context.h
r9a5b556 r6eabb6e6 38 38 #include <arch/types.h> 39 39 40 #define ARCH_HAS_FPU 41 #define FPU_CONTEXT_ALIGN 8 42 40 43 struct fpu_context { 44 uint64_t d[32]; 45 uint64_t fsr; 41 46 }; 42 47 -
kernel/arch/sparc64/include/regdef.h
r9a5b556 r6eabb6e6 44 44 45 45 #define PSTATE_PRIV_BIT (1<<2) 46 #define PSTATE_PEF_BIT (1<<4) 46 47 47 48 #define TSTATE_PSTATE_SHIFT 8 48 49 #define TSTATE_PRIV_BIT (PSTATE_PRIV_BIT<<TSTATE_PSTATE_SHIFT) 49 50 #define TSTATE_IE_BIT (PSTATE_IE_BIT<<TSTATE_PSTATE_SHIFT) 51 #define TSTATE_PEF_BIT (PSTATE_PEF_BIT<<TSTATE_PSTATE_SHIFT) 50 52 51 53 #define TSTATE_CWP_MASK 0x1f -
kernel/arch/sparc64/include/register.h
r9a5b556 r6eabb6e6 88 88 uint64_t value; 89 89 struct { 90 unsigned int_dis : 1; /**< TICK_INT interrupt disabled flag. */90 unsigned int_dis : 1; /**< TICK_INT interrupt disabled flag. */ 91 91 uint64_t tick_cmpr : 63; /**< Compare value for TICK interrupts. */ 92 92 } __attribute__ ((packed)); … … 106 106 typedef union softint_reg softint_reg_t; 107 107 108 /** Floating-point Registers State Register. */ 109 union fprs_reg { 110 uint64_t value; 111 struct { 112 uint64_t : 61; 113 unsigned fef : 1; 114 unsigned du : 1; 115 unsigned dl : 1; 116 } __attribute__ ((packed)); 117 }; 118 typedef union fprs_reg fprs_reg_t; 119 108 120 #endif 109 121 -
kernel/arch/sparc64/include/trap/exception.h
r9a5b556 r6eabb6e6 41 41 #define TT_ILLEGAL_INSTRUCTION 0x10 42 42 #define TT_PRIVILEGED_OPCODE 0x11 43 #define TT_FP_DISABLED 0x20 43 44 #define TT_DIVISION_BY_ZERO 0x28 44 45 #define TT_DATA_ACCESS_EXCEPTION 0x30 … … 57 58 extern void illegal_instruction(int n, istate_t *istate); 58 59 extern void privileged_opcode(int n, istate_t *istate); 60 extern void fp_disabled(int n, istate_t *istate); 59 61 extern void division_by_zero(int n, istate_t *istate); 60 62 extern void data_access_exception(int n, istate_t *istate); -
kernel/arch/sparc64/src/asm.S
r9a5b556 r6eabb6e6 228 228 229 229 .macro WRITE_ALTERNATE_REGISTER reg, bit 230 rdpr %pstate, %g1 ! save PSTATE.PEF 230 231 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate 231 232 mov %o0, \reg 233 wrpr %g0, PSTATE_PRIV_BIT, %pstate 232 234 retl 233 wrpr %g 0, PSTATE_PRIV_BIT, %pstate235 wrpr %g1, 0, %pstate ! restore PSTATE.PEF 234 236 .endm 235 237 236 238 .macro READ_ALTERNATE_REGISTER reg, bit 239 rdpr %pstate, %g1 ! save PSTATE.PEF 237 240 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate 238 241 mov \reg, %o0 242 wrpr %g0, PSTATE_PRIV_BIT, %pstate 239 243 retl 240 wrpr %g 0, PSTATE_PRIV_BIT, %pstate244 wrpr %g1, 0, %pstate ! restore PSTATE.PEF 241 245 .endm 242 246 -
kernel/arch/sparc64/src/dummy.s
r9a5b556 r6eabb6e6 30 30 31 31 .global cpu_sleep 32 .global fpu_context_restore33 .global fpu_context_save34 .global fpu_enable35 .global fpu_init36 32 .global sys_tls_set 37 33 … … 39 35 40 36 cpu_sleep: 41 fpu_context_restore:42 fpu_context_save:43 fpu_enable:44 fpu_init:45 37 sys_tls_set: 46 38 -
kernel/arch/sparc64/src/trap/exception.c
r9a5b556 r6eabb6e6 38 38 #include <interrupt.h> 39 39 #include <arch/asm.h> 40 #include <arch/register.h> 40 41 #include <debug.h> 41 42 #include <typedefs.h> … … 82 83 } 83 84 85 /** Handle fp_disabled. (0x20) */ 86 void fp_disabled(int n, istate_t *istate) 87 { 88 fprs_reg_t fprs; 89 90 fprs.value = fprs_read(); 91 if (!fprs.fef) { 92 fprs.fef = true; 93 fprs_write(fprs.value); 94 return; 95 } 96 97 #ifdef CONFIG_FPU_LAZY 98 scheduler_fpu_lazy_request(); 99 #else 100 fault_if_from_uspace(istate, "%s\n", __FUNCTION__); 101 dump_istate(istate); 102 panic("%s\n", __FUNCTION__); 103 #endif 104 } 105 84 106 /** Handle division_by_zero. (0x28) */ 85 107 void division_by_zero(int n, istate_t *istate) -
kernel/arch/sparc64/src/trap/trap_table.S
r9a5b556 r6eabb6e6 83 83 PREEMPTIBLE_HANDLER privileged_opcode 84 84 85 /* TT = 0x20, TL = 0, fb_disabled handler */ 86 .org trap_table + TT_FP_DISABLED*ENTRY_SIZE 87 .global fb_disabled_tl0 88 fp_disabled_tl0: 89 PREEMPTIBLE_HANDLER fp_disabled 90 85 91 /* TT = 0x24, TL = 0, clean_window handler */ 86 92 .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE 87 .global clean_window_ handler_tl088 clean_window_ handler_tl0:93 .global clean_window_tl0 94 clean_window_tl0: 89 95 CLEAN_WINDOW_HANDLER 90 96 … … 490 496 /* TT = 0x24, TL > 0, clean_window handler */ 491 497 .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE 492 .global clean_window_ handler_tl1493 clean_window_ handler_tl1:498 .global clean_window_tl1 499 clean_window_tl1: 494 500 CLEAN_WINDOW_HANDLER 495 501 … … 689 695 690 696 wrpr %g0, 0, %tl 691 wrpr %g0, PSTATE_PRIV_BIT , %pstate697 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT, %pstate 692 698 SAVE_GLOBALS 693 699 … … 706 712 707 713 RESTORE_GLOBALS 714 rdpr %pstate, %l1 ! we must preserve the PEF bit 708 715 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 709 716 wrpr %g0, 1, %tl … … 717 724 718 725 /* 726 * Copy PSTATE.PEF to the in-register copy of TSTATE. 727 */ 728 and %l1, PSTATE_PEF_BIT, %l1 729 sllx %l1, TSTATE_PSTATE_SHIFT, %l1 730 sethi %hi(TSTATE_PEF_BIT), %g4 731 andn %g1, %g4, %g1 732 or %g1, %l1, %g1 733 734 /* 719 735 * Restore TSTATE, TPC and TNPC from saved copies. 720 736 */ … … 722 738 wrpr %g2, 0, %tpc 723 739 wrpr %g3, 0, %tnpc 740 724 741 725 742 /*
Note:
See TracChangeset
for help on using the changeset viewer.