kern
changeset 50:1d8877d12de0
tidyed up the intr_ret bit, made it a bit more reasonably structured, and cleaned up some debugging things
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 30 Jul 2011 07:35:53 +0300 |
parents | 50730d42d2d3 |
children | b1e8c8251884 |
files | src/intr-asm.S src/proc.c |
diffstat | 2 files changed, 15 insertions(+), 17 deletions(-) [+] |
line diff
1.1 --- a/src/intr-asm.S Sat Jul 30 07:21:54 2011 +0300 1.2 +++ b/src/intr-asm.S Sat Jul 30 07:35:53 2011 +0300 1.3 @@ -70,20 +70,26 @@ 1.4 intr_entry_common: 1.5 pusha 1.6 call dispatch_intr 1.7 - jmp 0f 1.8 - 1.9 - .globl intr_ret 1.10 -intr_ret: 1.11 - /* if called as a function from context_switch, we must 1.12 - * remove the pushed return address before continuing 1.13 - */ 1.14 - add $4, %esp 1.15 -0: /* ... we skip to here otherwise */ 1.16 +intr_ret_local: 1.17 popa 1.18 /* remove error code and intr num from stack */ 1.19 add $8, %esp 1.20 iret 1.21 1.22 +/* intr_ret is called by context_switch to return from the kernel 1.23 + * to userspace. The argument is a properly formed intr_frame 1.24 + * structure with the saved context of the new task. 1.25 + * 1.26 + * First thing to do is remove the return address pointing back 1.27 + * to context_switch, which then leaves us with a proper interrupt 1.28 + * stack frame, so we can jump right in the middle of the regular 1.29 + * interrupt return code above. 1.30 + */ 1.31 + .globl intr_ret 1.32 +intr_ret: 1.33 + add $4, %esp 1.34 + jmp intr_ret_local 1.35 + 1.36 /* by including interrupts.h with ASM defined, the macros above 1.37 * are expanded to generate all required interrupt entry points 1.38 */
2.1 --- a/src/proc.c Sat Jul 30 07:21:54 2011 +0300 2.2 +++ b/src/proc.c Sat Jul 30 07:35:53 2011 +0300 2.3 @@ -78,14 +78,6 @@ 2.4 ifrm.regs = ctx->regs; 2.5 ifrm.eflags = ctx->flags; 2.6 2.7 - ifrm.err = 0xbadf00d; 2.8 - 2.9 - asm volatile ( 2.10 - "pushf\n\t" 2.11 - "popl %0\n\t" 2.12 - : "=a" (ifrm.eflags) 2.13 - ); 2.14 - 2.15 ifrm.eip = ctx->instr_ptr; 2.16 ifrm.cs = selector(SEGM_KCODE, 0); /* XXX change this when we setup the TSS */ 2.17 ifrm.esp = 0;/*ctx->stack_ptr; /* this will only be used when we switch to userspace */