Changeset 598f90e in mainline
- Timestamp:
- 2010-10-31T20:13:16Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 458619f7
- Parents:
- 5c088975
- Files:
-
- 8 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/abs32le/include/interrupt.h
r5c088975 r598f90e 37 37 38 38 #include <typedefs.h> 39 #include <verify.h> 40 #include <trace.h> 39 #include <arch/istate.h> 41 40 42 41 #define IVT_ITEMS 0 … … 45 44 #define VECTOR_TLB_SHOOTDOWN_IPI 0 46 45 47 /*48 * On real hardware this stores the registers which49 * need to be preserved during interupts.50 */51 typedef struct istate {52 uintptr_t ip;53 uintptr_t fp;54 uint32_t stack[];55 } istate_t;56 57 NO_TRACE static inline int istate_from_uspace(istate_t *istate)58 REQUIRES_EXTENT_MUTABLE(istate)59 {60 /* On real hardware this checks whether the interrupted61 context originated from user space. */62 63 return !(istate->ip & 0x80000000);64 }65 66 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,67 uintptr_t retaddr)68 WRITES(&istate->ip)69 {70 /* On real hardware this sets the instruction pointer. */71 72 istate->ip = retaddr;73 }74 75 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)76 REQUIRES_EXTENT_MUTABLE(istate)77 {78 /* On real hardware this returns the instruction pointer. */79 80 return istate->ip;81 }82 83 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)84 REQUIRES_EXTENT_MUTABLE(istate)85 {86 /* On real hardware this returns the frame pointer. */87 88 return istate->fp;89 }90 91 46 #endif 92 47 -
kernel/arch/amd64/include/interrupt.h
r5c088975 r598f90e 37 37 38 38 #include <typedefs.h> 39 #include <arch/istate.h> 39 40 #include <arch/pm.h> 40 #include <trace.h>41 41 42 42 #define IVT_ITEMS IDT_ITEMS … … 71 71 #define VECTOR_DEBUG_IPI (IVT_FREEBASE + 2) 72 72 73 /** This is passed to interrupt handlers */74 typedef struct istate {75 uint64_t rax;76 uint64_t rbx;77 uint64_t rcx;78 uint64_t rdx;79 uint64_t rsi;80 uint64_t rdi;81 uint64_t rbp;82 uint64_t r8;83 uint64_t r9;84 uint64_t r10;85 uint64_t r11;86 uint64_t r12;87 uint64_t r13;88 uint64_t r14;89 uint64_t r15;90 uint64_t alignment; /* align rbp_frame on multiple of 16 */91 uint64_t rbp_frame; /* imitation of frame pointer linkage */92 uint64_t rip_frame; /* imitation of return address linkage */93 uint64_t error_word; /* real or fake error word */94 uint64_t rip;95 uint64_t cs;96 uint64_t rflags;97 uint64_t rsp; /* only if istate_t is from uspace */98 uint64_t ss; /* only if istate_t is from uspace */99 } istate_t;100 101 /** Return true if exception happened while in userspace */102 NO_TRACE static inline int istate_from_uspace(istate_t *istate)103 {104 return !(istate->rip & 0x8000000000000000);105 }106 107 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,108 uintptr_t retaddr)109 {110 istate->rip = retaddr;111 }112 113 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)114 {115 return istate->rip;116 }117 118 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)119 {120 return istate->rbp;121 }122 123 73 extern void (* disable_irqs_function)(uint16_t); 124 74 extern void (* enable_irqs_function)(uint16_t); -
kernel/arch/arm32/include/exception.h
r5c088975 r598f90e 39 39 40 40 #include <typedefs.h> 41 #include <arch/regutils.h> 42 #include <trace.h> 41 #include <arch/istate.h> 43 42 44 43 /** If defined, forces using of high exception vectors. */ … … 85 84 extern uintptr_t exc_stack; 86 85 87 /** Struct representing CPU state saved when an exception occurs. */88 typedef struct istate {89 uint32_t spsr;90 uint32_t sp;91 uint32_t lr;92 93 uint32_t r0;94 uint32_t r1;95 uint32_t r2;96 uint32_t r3;97 uint32_t r4;98 uint32_t r5;99 uint32_t r6;100 uint32_t r7;101 uint32_t r8;102 uint32_t r9;103 uint32_t r10;104 uint32_t fp;105 uint32_t r12;106 107 uint32_t pc;108 } istate_t;109 110 /** Set Program Counter member of given istate structure.111 *112 * @param istate istate structure113 * @param retaddr new value of istate's PC member114 *115 */116 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,117 uintptr_t retaddr)118 {119 istate->pc = retaddr;120 }121 122 /** Return true if exception happened while in userspace. */123 NO_TRACE static inline int istate_from_uspace(istate_t *istate)124 {125 return (istate->spsr & STATUS_REG_MODE_MASK) == USER_MODE;126 }127 128 /** Return Program Counter member of given istate structure. */129 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)130 {131 return istate->pc;132 }133 134 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)135 {136 return istate->fp;137 }138 139 86 extern void install_exception_handlers(void); 140 87 extern void exception_init(void); -
kernel/arch/ia32/include/interrupt.h
r5c088975 r598f90e 37 37 38 38 #include <typedefs.h> 39 #include <arch/istate.h> 39 40 #include <arch/pm.h> 40 #include <trace.h>41 41 42 42 #define IVT_ITEMS IDT_ITEMS … … 71 71 #define VECTOR_DEBUG_IPI (IVT_FREEBASE + 2) 72 72 73 typedef struct istate {74 /*75 * The strange order of the GPRs is given by the requirement to use the76 * istate structure for both regular interrupts and exceptions as well77 * as for syscall handlers which use this order as an optimization.78 */79 uint32_t edx;80 uint32_t ecx;81 uint32_t ebx;82 uint32_t esi;83 uint32_t edi;84 uint32_t ebp;85 uint32_t eax;86 87 uint32_t ebp_frame; /* imitation of frame pointer linkage */88 uint32_t eip_frame; /* imitation of return address linkage */89 90 uint32_t gs;91 uint32_t fs;92 uint32_t es;93 uint32_t ds;94 95 uint32_t error_word; /* real or fake error word */96 uint32_t eip;97 uint32_t cs;98 uint32_t eflags;99 uint32_t esp; /* only if istate_t is from uspace */100 uint32_t ss; /* only if istate_t is from uspace */101 } istate_t;102 103 /** Return true if exception happened while in userspace */104 NO_TRACE static inline int istate_from_uspace(istate_t *istate)105 {106 return !(istate->eip & 0x80000000);107 }108 109 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,110 uintptr_t retaddr)111 {112 istate->eip = retaddr;113 }114 115 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)116 {117 return istate->eip;118 }119 120 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)121 {122 return istate->ebp;123 }124 125 73 extern void (* disable_irqs_function)(uint16_t); 126 74 extern void (* enable_irqs_function)(uint16_t); -
kernel/arch/ia64/include/interrupt.h
r5c088975 r598f90e 37 37 38 38 #include <typedefs.h> 39 #include <arch/register.h> 40 #include <trace.h> 39 #include <arch/istate.h> 41 40 42 41 /** ia64 has 256 INRs. */ … … 74 73 #define EOI 0 /**< The actual value doesn't matter. */ 75 74 76 typedef struct istate {77 uint128_t f2;78 uint128_t f3;79 uint128_t f4;80 uint128_t f5;81 uint128_t f6;82 uint128_t f7;83 uint128_t f8;84 uint128_t f9;85 uint128_t f10;86 uint128_t f11;87 uint128_t f12;88 uint128_t f13;89 uint128_t f14;90 uint128_t f15;91 uint128_t f16;92 uint128_t f17;93 uint128_t f18;94 uint128_t f19;95 uint128_t f20;96 uint128_t f21;97 uint128_t f22;98 uint128_t f23;99 uint128_t f24;100 uint128_t f25;101 uint128_t f26;102 uint128_t f27;103 uint128_t f28;104 uint128_t f29;105 uint128_t f30;106 uint128_t f31;107 108 uintptr_t ar_bsp;109 uintptr_t ar_bspstore;110 uintptr_t ar_bspstore_new;111 uint64_t ar_rnat;112 uint64_t ar_ifs;113 uint64_t ar_pfs;114 uint64_t ar_rsc;115 uintptr_t cr_ifa;116 cr_isr_t cr_isr;117 uintptr_t cr_iipa;118 psr_t cr_ipsr;119 uintptr_t cr_iip;120 uint64_t pr;121 uintptr_t sp;122 123 /*124 * The following variables are defined only for break_instruction125 * handler.126 */127 uint64_t in0;128 uint64_t in1;129 uint64_t in2;130 uint64_t in3;131 uint64_t in4;132 uint64_t in5;133 uint64_t in6;134 } istate_t;135 136 75 extern void *ivt; 137 138 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,139 uintptr_t retaddr)140 {141 istate->cr_iip = retaddr;142 istate->cr_ipsr.ri = 0; /* return to instruction slot #0 */143 }144 145 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)146 {147 return istate->cr_iip;148 }149 150 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)151 {152 /* FIXME */153 154 return 0;155 }156 157 NO_TRACE static inline int istate_from_uspace(istate_t *istate)158 {159 return (istate->cr_iip) < 0xe000000000000000ULL;160 }161 76 162 77 extern void general_exception(uint64_t, istate_t *); -
kernel/arch/ia64/include/register.h
r5c088975 r598f90e 142 142 #ifndef __ASM__ 143 143 144 #ifdef KERNEL 144 145 #include <typedefs.h> 146 #else 147 #include <sys/types.h> 148 #endif 145 149 146 150 /** Processor Status Register. */ -
kernel/arch/mips32/include/cp0.h
r5c088975 r598f90e 36 36 #define KERN_mips32_CP0_H_ 37 37 38 #ifdef KERNEL 38 39 #include <typedefs.h> 40 #else 41 #include <sys/types.h> 42 #endif 39 43 40 44 #define cp0_status_ie_enabled_bit (1 << 0) -
kernel/arch/mips32/include/exception.h
r5c088975 r598f90e 37 37 38 38 #include <typedefs.h> 39 #include <arch/cp0.h> 40 #include <trace.h> 39 #include <arch/istate.h> 41 40 42 41 #define EXC_Int 0 … … 59 58 #define EXC_VCED 31 60 59 61 typedef struct istate {62 /*63 * The first seven registers are arranged so that the istate structure64 * can be used both for exception handlers and for the syscall handler.65 */66 uint32_t a0; /* arg1 */67 uint32_t a1; /* arg2 */68 uint32_t a2; /* arg3 */69 uint32_t a3; /* arg4 */70 uint32_t t0; /* arg5 */71 uint32_t t1; /* arg6 */72 uint32_t v0; /* arg7 */73 uint32_t v1;74 uint32_t at;75 uint32_t t2;76 uint32_t t3;77 uint32_t t4;78 uint32_t t5;79 uint32_t t6;80 uint32_t t7;81 uint32_t s0;82 uint32_t s1;83 uint32_t s2;84 uint32_t s3;85 uint32_t s4;86 uint32_t s5;87 uint32_t s6;88 uint32_t s7;89 uint32_t t8;90 uint32_t t9;91 uint32_t kt0;92 uint32_t kt1; /* We use it as thread-local pointer */93 uint32_t gp;94 uint32_t sp;95 uint32_t s8;96 uint32_t ra;97 98 uint32_t lo;99 uint32_t hi;100 101 uint32_t status; /* cp0_status */102 uint32_t epc; /* cp0_epc */103 104 uint32_t alignment; /* to make sizeof(istate_t) a multiple of 8 */105 } istate_t;106 107 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,108 uintptr_t retaddr)109 {110 istate->epc = retaddr;111 }112 113 /** Return true if exception happened while in userspace */114 NO_TRACE static inline int istate_from_uspace(istate_t *istate)115 {116 return istate->status & cp0_status_um_bit;117 }118 119 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)120 {121 return istate->epc;122 }123 124 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)125 {126 return istate->sp;127 }128 129 60 extern void exception(istate_t *istate); 130 61 extern void tlb_refill_entry(void); -
kernel/arch/sparc64/include/interrupt.h
r5c088975 r598f90e 38 38 39 39 #include <typedefs.h> 40 #include <arch/regdef.h> 41 #include <trace.h> 40 #include <arch/istate.h> 42 41 43 42 #define IVT_ITEMS 15 … … 51 50 }; 52 51 53 typedef struct istate {54 uint64_t tnpc;55 uint64_t tpc;56 uint64_t tstate;57 } istate_t;58 59 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,60 uintptr_t retaddr)61 {62 istate->tpc = retaddr;63 }64 65 NO_TRACE static inline int istate_from_uspace(istate_t *istate)66 {67 return !(istate->tstate & TSTATE_PRIV_BIT);68 }69 70 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)71 {72 return istate->tpc;73 }74 75 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)76 {77 /* TODO */78 79 return 0;80 }81 82 52 #endif 83 53 -
uspace/lib/c/arch/abs32le/include/istate.h
r5c088975 r598f90e 36 36 #define LIBC_abs32le__ISTATE_H_ 37 37 38 #include <sys/types.h> 39 40 /** Interrupt context. 41 * 42 * On real hardware this stores the registers which 43 * need to be preserved during interupts. 44 */ 45 typedef struct istate { 46 uintptr_t ip; 47 uintptr_t fp; 48 uint32_t stack[]; 49 } istate_t; 50 51 static inline uintptr_t istate_get_pc(istate_t *istate) 52 { 53 return istate->ip; 54 } 55 56 static inline uintptr_t istate_get_fp(istate_t *istate) 57 { 58 return istate->fp; 59 } 38 #include <arch/istate.h> 60 39 61 40 #endif -
uspace/lib/c/arch/amd64/include/istate.h
r5c088975 r598f90e 36 36 #define LIBC_amd64_ISTATE_H_ 37 37 38 #include <sys/types.h> 39 40 /** Interrupt context. 41 * 42 * This is a copy of the kernel definition with which it must be kept in sync. 43 */ 44 typedef struct istate { 45 uint64_t rax; 46 uint64_t rcx; 47 uint64_t rdx; 48 uint64_t rsi; 49 uint64_t rdi; 50 uint64_t r8; 51 uint64_t r9; 52 uint64_t r10; 53 uint64_t r11; 54 uint64_t rbp; 55 uint64_t error_word; 56 uint64_t rip; 57 uint64_t cs; 58 uint64_t rflags; 59 uint64_t stack[]; /* Additional data on stack */ 60 } istate_t; 61 62 static inline uintptr_t istate_get_pc(istate_t *istate) 63 { 64 return istate->rip; 65 } 66 67 static inline uintptr_t istate_get_fp(istate_t *istate) 68 { 69 return istate->rbp; 70 } 38 #include <arch/istate.h> 71 39 72 40 #endif -
uspace/lib/c/arch/arm32/include/istate.h
r5c088975 r598f90e 36 36 #define LIBC_arm32__ISTATE_H_ 37 37 38 #include <sys/types.h> 39 40 /** Interrupt context. 41 * 42 * This is a copy of the kernel definition with which it must be kept in sync. 43 */ 44 typedef struct istate { 45 uint32_t spsr; 46 uint32_t sp; 47 uint32_t lr; 48 49 uint32_t r0; 50 uint32_t r1; 51 uint32_t r2; 52 uint32_t r3; 53 uint32_t r4; 54 uint32_t r5; 55 uint32_t r6; 56 uint32_t r7; 57 uint32_t r8; 58 uint32_t r9; 59 uint32_t r10; 60 uint32_t fp; 61 uint32_t r12; 62 63 uint32_t pc; 64 } istate_t; 65 66 static inline uintptr_t istate_get_pc(istate_t *istate) 67 { 68 return istate->pc; 69 } 70 71 static inline uintptr_t istate_get_fp(istate_t *istate) 72 { 73 return istate->fp; 74 } 38 #include <arch/istate.h> 75 39 76 40 #endif -
uspace/lib/c/arch/ia32/include/istate.h
r5c088975 r598f90e 36 36 #define LIBC_ia32__ISTATE_H_ 37 37 38 #include <sys/types.h> 39 40 /** Interrupt context. 41 * 42 * This is a copy of the kernel definition with which it must be kept in sync. 43 */ 44 typedef struct istate { 45 uint32_t eax; 46 uint32_t ecx; 47 uint32_t edx; 48 uint32_t ebp; 49 50 uint32_t gs; 51 uint32_t fs; 52 uint32_t es; 53 uint32_t ds; 54 55 uint32_t error_word; 56 uint32_t eip; 57 uint32_t cs; 58 uint32_t eflags; 59 uint32_t stack[]; 60 } istate_t; 61 62 static inline uintptr_t istate_get_pc(istate_t *istate) 63 { 64 return istate->eip; 65 } 66 67 static inline uintptr_t istate_get_fp(istate_t *istate) 68 { 69 return istate->ebp; 70 } 38 #include <arch/istate.h> 71 39 72 40 #endif -
uspace/lib/c/arch/ia64/include/istate.h
r5c088975 r598f90e 36 36 #define LIBC_ia64_ISTATE_H_ 37 37 38 #include <sys/types.h> 39 40 /** Interrupt context. 41 * 42 * This is a copy of the kernel definition with which it must be kept in sync. 43 */ 44 typedef struct istate { 45 /* TODO */ 46 } istate_t; 47 48 static inline uintptr_t istate_get_pc(istate_t *istate) 49 { 50 /* TODO */ 51 return 0; 52 } 53 54 static inline uintptr_t istate_get_fp(istate_t *istate) 55 { 56 /* TODO */ 57 return 0; 58 } 38 #include <arch/istate.h> 59 39 60 40 #endif -
uspace/lib/c/arch/mips32/include/istate.h
r5c088975 r598f90e 36 36 #define LIBC_mips32__ISTATE_H_ 37 37 38 #include <sys/types.h> 39 40 /** Interrupt context. 41 * 42 * This is a copy of the kernel definition with which it must be kept in sync. 43 */ 44 typedef struct istate { 45 uint32_t at; 46 uint32_t v0; 47 uint32_t v1; 48 uint32_t a0; 49 uint32_t a1; 50 uint32_t a2; 51 uint32_t a3; 52 uint32_t t0; 53 uint32_t t1; 54 uint32_t t2; 55 uint32_t t3; 56 uint32_t t4; 57 uint32_t t5; 58 uint32_t t6; 59 uint32_t t7; 60 uint32_t t8; 61 uint32_t t9; 62 uint32_t gp; 63 uint32_t sp; 64 uint32_t ra; 65 66 uint32_t lo; 67 uint32_t hi; 68 69 uint32_t status; /* cp0_status */ 70 uint32_t epc; /* cp0_epc */ 71 uint32_t k1; /* We use it as thread-local pointer */ 72 } istate_t; 73 74 static inline uintptr_t istate_get_pc(istate_t *istate) 75 { 76 return istate->epc; 77 } 78 79 static inline uintptr_t istate_get_fp(istate_t *istate) 80 { 81 /* TODO */ 82 return 0; 83 } 38 #include <arch/istate.h> 84 39 85 40 #endif -
uspace/lib/c/arch/sparc64/include/istate.h
r5c088975 r598f90e 36 36 #define LIBC_sparc64_ISTATE_H_ 37 37 38 #include <sys/types.h> 39 40 /** Interrupt context. 41 * 42 * This is a copy of the kernel definition with which it must be kept in sync. 43 */ 44 typedef struct istate { 45 /* TODO */ 46 } istate_t; 47 48 static inline uintptr_t istate_get_pc(istate_t *istate) 49 { 50 /* TODO */ 51 return 0; 52 } 53 54 static inline uintptr_t istate_get_fp(istate_t *istate) 55 { 56 /* TODO */ 57 return 0; 58 } 38 #include <arch/istate.h> 59 39 60 40 #endif
Note:
See TracChangeset
for help on using the changeset viewer.