aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-09-11 16:03:30 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-09-11 16:03:30 -0700
commitf66f2fe95713568c0ea22d9c391a364272d71c0e (patch)
tree02b1791e418b3d83feac31e0f36ff53d8495449c
parent4ce11d517a9e10277f8247975875bd5b92331bf2 (diff)
downloadlwip-f66f2fe95713568c0ea22d9c391a364272d71c0e.tar.gz
lwip-f66f2fe95713568c0ea22d9c391a364272d71c0e.tar.xz
lwip-f66f2fe95713568c0ea22d9c391a364272d71c0e.zip
core: pxe: don't switch to the PXE stack if we're on it...
Don't switch to the PXE stack if we are already on it. This can happen if we take an interrupt inside the stack switch code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/pxelinux.asm22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index 88d03298..c172c062 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -374,9 +374,15 @@ pxenv:
pushfd
pushad
%if USE_PXE_PROVIDED_STACK == 0
+ pushf
+ cli
+ inc word [cs:PXEStackLock]
+ jnz .skip1
mov [cs:PXEStack],sp
mov [cs:PXEStack+2],ss
lss sp,[cs:InitStack]
+.skip1:
+ popf
%endif
; Pre-clear the Status field
mov word [es:di],cs
@@ -391,7 +397,13 @@ pxenv:
add sp,6
mov [cs:PXEStatus],ax
%if USE_PXE_PROVIDED_STACK == 0
+ pushf
+ cli
+ dec word [cs:PXEStackLock]
+ jns .skip2
lss sp,[cs:PXEStack]
+.skip2:
+ popf
%endif
mov bp,sp
and ax,ax
@@ -407,6 +419,16 @@ pxenv:
global PXEEntry
PXEEntry equ pxenv.jump+1
+;
+; The PXEStackLock keeps us from switching stacks if we take an interrupt
+; (which ends up calling pxenv) while we are already on the PXE stack.
+; It will be -1 normally, 0 inside a PXE call, and a positive value
+; inside a *nested* PXE call.
+;
+ section .data16
+ alignb 2
+PXEStackLock dw -1
+
section .bss16
alignb 2
PXEStatus resb 2