david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

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.
This commit is contained in:
H. Peter Anvin 2008-02-08 16:19:02 -08:00 committed by Michael Brown
parent f8a0b5f682
commit fc9f016be0
1 changed files with 7 additions and 4 deletions

View File

@ -21,7 +21,9 @@ undiisr:
/* Preserve registers */ /* Preserve registers */
pushw %ds pushw %ds
pushw %es pushw %es
pusha pushw %fs
pushw %gs
pushal
/* Set up our segment registers */ /* Set up our segment registers */
movw %cs:rm_ds, %ax movw %cs:rm_ds, %ax
@ -32,8 +34,7 @@ undiisr:
je chain je chain
/* Issue UNDI API call */ /* Issue UNDI API call */
pushw %ds movw %ax, %es
popw %es
movw $undinet_params, %di movw $undinet_params, %di
movw $PXENV_UNDI_ISR, %bx movw $PXENV_UNDI_ISR, %bx
movw $PXENV_UNDI_ISR_IN_START, funcflag movw $PXENV_UNDI_ISR_IN_START, funcflag
@ -62,7 +63,9 @@ chain: /* Chain to next handler */
lcall *undiisr_next_handler lcall *undiisr_next_handler
exit: /* Restore registers and return */ exit: /* Restore registers and return */
popa popal
popw %gs
popw %fs
popw %es popw %es
popw %ds popw %ds
iret iret