Changeset f2ef7fd in mainline for kernel/arch/ia32/src
- Timestamp:
- 2008-10-05T21:20:13Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6198611
- Parents:
- 1d132ae
- Location:
- kernel/arch/ia32/src
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/asm.S
r1d132ae rf2ef7fd 147 147 popfl 148 148 .endm 149 150 /* 151 * The SYSENTER syscall mechanism can be used for syscalls with 152 * four or fewer arguments. To pass these four arguments, we 153 * use four registers: EDX, ECX, EBX, ESI. The syscall number 154 * is passed in EAX. We use EDI to remember the return address 155 * and EBP to remember the stack. The INT-based syscall mechanism 156 * can actually handle six arguments plus the syscall number 157 * entirely in registers. 158 */ 159 .global sysenter_handler 160 sysenter_handler: 161 pushl %ebp # remember user stack 162 pushl %edi # remember return user address 163 164 pushl %gs # remember TLS 165 166 pushl %eax # syscall number 167 subl $8, %esp # unused sixth and fifth argument 168 pushl %esi # fourth argument 169 pushl %ebx # third argument 170 pushl %ecx # second argument 171 pushl %edx # first argument 172 173 movw $16, %ax 174 movw %ax, %ds 175 movw %ax, %es 176 177 cld 178 call syscall_handler 179 addl $28, %esp # remove arguments from stack 180 181 pop %gs # restore TLS 182 183 pop %edx # prepare return EIP for SYSEXIT 184 pop %ecx # prepare userspace ESP for SYSEXIT 185 186 sysexit # return to userspace 187 149 188 150 189 ## Declare interrupt handlers -
kernel/arch/ia32/src/cpu/cpu.c
r1d132ae rf2ef7fd 43 43 44 44 #include <arch/smp/apic.h> 45 #include <arch/syscall.h> 45 46 46 47 /* … … 124 125 ); 125 126 } 127 128 /* Setup fast SYSENTER/SYSEXIT syscalls */ 129 syscall_setup_cpu(); 126 130 } 127 131 -
kernel/arch/ia32/src/proc/scheduler.c
r1d132ae rf2ef7fd 59 59 void before_thread_runs_arch(void) 60 60 { 61 CPU->arch.tss->esp0= (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE -61 uintptr_t kstk = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE - 62 62 SP_DELTA]; 63 64 /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */ 65 write_msr(IA32_MSR_SYSENTER_ESP, kstk); 66 67 /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */ 68 CPU->arch.tss->esp0 = kstk; 63 69 CPU->arch.tss->ss0 = selector(KDATA_DES); 64 70
Note:
See TracChangeset
for help on using the changeset viewer.