Browse Source

UNDI ISR: save and restore 32-bit registers

As written, if the if the UNDI ISR call clobbers the upper halves of
any of the GPRs (which by convention it is permitted to do, and by
paranoia should be expected to do) then nothing in the interrupt
handler will recover the state.

Additionally, save/restore %fs and %gs out of sheer paranoia - it's a
cheap enough operation, and may prevent problems due to poorly written
UNDI stacks.
tags/v0.9.3
H. Peter Anvin 16 years ago
parent
commit
fc9f016be0
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      src/arch/i386/drivers/net/undiisr.S

+ 7
- 4
src/arch/i386/drivers/net/undiisr.S View File

21
 	/* Preserve registers */
21
 	/* Preserve registers */
22
 	pushw	%ds
22
 	pushw	%ds
23
 	pushw	%es
23
 	pushw	%es
24
-	pusha
24
+	pushw	%fs
25
+	pushw	%gs
26
+	pushal
25
 
27
 
26
 	/* Set up our segment registers */
28
 	/* Set up our segment registers */
27
 	movw	%cs:rm_ds, %ax
29
 	movw	%cs:rm_ds, %ax
32
 	je	chain
34
 	je	chain
33
 	
35
 	
34
 	/* Issue UNDI API call */
36
 	/* Issue UNDI API call */
35
-	pushw	%ds
36
-	popw	%es
37
+	movw	%ax, %es
37
 	movw	$undinet_params, %di
38
 	movw	$undinet_params, %di
38
 	movw	$PXENV_UNDI_ISR, %bx
39
 	movw	$PXENV_UNDI_ISR, %bx
39
 	movw	$PXENV_UNDI_ISR_IN_START, funcflag
40
 	movw	$PXENV_UNDI_ISR_IN_START, funcflag
62
 	lcall	*undiisr_next_handler
63
 	lcall	*undiisr_next_handler
63
 	
64
 	
64
 exit:	/* Restore registers and return */
65
 exit:	/* Restore registers and return */
65
-	popa
66
+	popal
67
+	popw	%gs
68
+	popw	%fs
66
 	popw	%es
69
 	popw	%es
67
 	popw	%ds
70
 	popw	%ds
68
 	iret
71
 	iret

Loading…
Cancel
Save