Changeset 22f7769 in mainline for arch/amd64
- Timestamp:
- 2005-10-17T23:31:41Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4b2c872d
- Parents:
- 75eacab
- Location:
- arch/amd64
- Files:
-
- 5 edited
-
include/asm.h (modified) (3 diffs)
-
include/context.h (modified) (1 diff)
-
include/types.h (modified) (1 diff)
-
src/interrupt.c (modified) (1 diff)
-
src/userspace.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/include/asm.h
r75eacab r22f7769 83 83 } 84 84 85 /** Set priority level low85 /** Enable interrupts. 86 86 * 87 87 * Enable interrupts and return previous 88 88 * value of EFLAGS. 89 */ 90 static inline pri_t cpu_priority_low(void) { 91 pri_t v; 89 * 90 * @return Old interrupt priority level. 91 */ 92 static inline ipl_t interrupts_enable(void) { 93 ipl_t v; 92 94 __asm__ volatile ( 93 95 "pushfq\n" … … 99 101 } 100 102 101 /** Set priority level high103 /** Disable interrupts. 102 104 * 103 105 * Disable interrupts and return previous 104 106 * value of EFLAGS. 105 */ 106 static inline pri_t cpu_priority_high(void) { 107 pri_t v; 107 * 108 * @return Old interrupt priority level. 109 */ 110 static inline ipl_t interrupts_disable(void) { 111 ipl_t v; 108 112 __asm__ volatile ( 109 113 "pushfq\n" … … 115 119 } 116 120 117 /** Restore priority level121 /** Restore interrupt priority level. 118 122 * 119 123 * Restore EFLAGS. 120 */ 121 static inline void cpu_priority_restore(pri_t pri) { 124 * 125 * @param ipl Saved interrupt priority level. 126 */ 127 static inline void interrupts_restore(ipl_t ipl) { 122 128 __asm__ volatile ( 123 129 "pushq %0\n" 124 130 "popfq\n" 125 : : "r" ( pri)126 ); 127 } 128 129 /** Return raw priority level131 : : "r" (ipl) 132 ); 133 } 134 135 /** Return interrupt priority level. 130 136 * 131 137 * Return EFLAFS. 132 */ 133 static inline pri_t cpu_priority_read(void) { 134 pri_t v; 138 * 139 * @return Current interrupt priority level. 140 */ 141 static inline ipl_t interrupts_read(void) { 142 ipl_t v; 135 143 __asm__ volatile ( 136 144 "pushfq\n" -
arch/amd64/include/context.h
r75eacab r22f7769 56 56 __u64 r15; 57 57 58 pri_t pri;58 ipl_t ipl; 59 59 } __attribute__ ((packed)); 60 60 -
arch/amd64/include/types.h
r75eacab r22f7769 41 41 typedef __u64 __address; 42 42 43 /* Flags of processor (return value of cpu_priority_high()) */44 typedef __u64 pri_t;43 /* Flags of processor (return value of interrupts_disable()) */ 44 typedef __u64 ipl_t; 45 45 46 46 typedef __u64 __native; -
arch/amd64/src/interrupt.c
r75eacab r22f7769 109 109 /* 110 110 * Called directly from the assembler code. 111 * CPU is cpu_priority_high().111 * CPU is interrupts_disable()'d. 112 112 */ 113 113 void trap_dispatcher(__u8 n, __native stack[]) -
arch/amd64/src/userspace.c
r75eacab r22f7769 42 42 void userspace(void) 43 43 { 44 pri_t pri;44 ipl_t ipl; 45 45 46 pri = cpu_priority_high();46 ipl = interrupts_disable(); 47 47 48 48 __asm__ volatile ("" … … 58 58 "pushq %%rsi;" 59 59 "iretq;" 60 : : "i" (gdtselector(UDATA_DES) | PL_USER), "i" (USTACK_ADDRESS+THREAD_STACK_SIZE), "r" ( pri), "i" (gdtselector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS));60 : : "i" (gdtselector(UDATA_DES) | PL_USER), "i" (USTACK_ADDRESS+THREAD_STACK_SIZE), "r" (ipl), "i" (gdtselector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS)); 61 61 62 62 /* Unreachable */
Note:
See TracChangeset
for help on using the changeset viewer.
