kern

diff src/intr-asm.S @ 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 4eaecb14fe31
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   */