Преглед на файлове

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 години
родител
ревизия
fc9f016be0
променени са 1 файла, в които са добавени 7 реда и са изтрити 4 реда
  1. 7
    4
      src/arch/i386/drivers/net/undiisr.S

+ 7
- 4
src/arch/i386/drivers/net/undiisr.S Целия файл

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

Loading…
Отказ
Запис