# HG changeset patch # User John Tsiombikas # Date 1312000553 -10800 # Node ID 1d8877d12de09ef9f3b433ffc9248262811df05a # Parent 50730d42d2d3d8eb80b3eb37e6f94ca8c33d0644 tidyed up the intr_ret bit, made it a bit more reasonably structured, and cleaned up some debugging things diff -r 50730d42d2d3 -r 1d8877d12de0 src/intr-asm.S --- a/src/intr-asm.S Sat Jul 30 07:21:54 2011 +0300 +++ b/src/intr-asm.S Sat Jul 30 07:35:53 2011 +0300 @@ -70,20 +70,26 @@ intr_entry_common: pusha call dispatch_intr - jmp 0f - - .globl intr_ret -intr_ret: - /* if called as a function from context_switch, we must - * remove the pushed return address before continuing - */ - add $4, %esp -0: /* ... we skip to here otherwise */ +intr_ret_local: popa /* remove error code and intr num from stack */ add $8, %esp iret +/* intr_ret is called by context_switch to return from the kernel + * to userspace. The argument is a properly formed intr_frame + * structure with the saved context of the new task. + * + * First thing to do is remove the return address pointing back + * to context_switch, which then leaves us with a proper interrupt + * stack frame, so we can jump right in the middle of the regular + * interrupt return code above. + */ + .globl intr_ret +intr_ret: + add $4, %esp + jmp intr_ret_local + /* by including interrupts.h with ASM defined, the macros above * are expanded to generate all required interrupt entry points */ diff -r 50730d42d2d3 -r 1d8877d12de0 src/proc.c --- a/src/proc.c Sat Jul 30 07:21:54 2011 +0300 +++ b/src/proc.c Sat Jul 30 07:35:53 2011 +0300 @@ -78,14 +78,6 @@ ifrm.regs = ctx->regs; ifrm.eflags = ctx->flags; - ifrm.err = 0xbadf00d; - - asm volatile ( - "pushf\n\t" - "popl %0\n\t" - : "=a" (ifrm.eflags) - ); - ifrm.eip = ctx->instr_ptr; ifrm.cs = selector(SEGM_KCODE, 0); /* XXX change this when we setup the TSS */ ifrm.esp = 0;/*ctx->stack_ptr; /* this will only be used when we switch to userspace */