[syslinux:master] core, pxe: Don' t push on one stack and pop from the other in pxenv

syslinux-bot for H. Peter Anvin hpa at zytor.com
Tue Jul 29 08:54:05 PDT 2014

Commit-ID:  a7f5892c4d85f3685708b8efb237c9c73a8b1ddf
Gitweb:     http://www.syslinux.org/commit/a7f5892c4d85f3685708b8efb237c9c73a8b1ddf
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Tue, 29 Jul 2014 08:47:32 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 29 Jul 2014 08:52:21 -0700

core, pxe: Don't push on one stack and pop from the other in pxenv

When saving/restoring the flags around the stack switch test, we
cannot leave live data on the stack *across* the stack switch that we
are going to use on the other side (unlike the "big" stack frame which
we only use once we are back on the original stack.)

Use register BP, which is not live at either point, as a temporary
holding place for the flags from the stack.

Reported-by: Frank Mehnert <frank.mehnert at googlemail.com>
Link: http://bugzilla.syslinux.org/show_bug.cgi?id=54
Signed-off-by: H. Peter Anvin <hpa at zytor.com>

 core/pxelinux.asm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index d4b1a07..a2543df 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -370,9 +370,11 @@ pxenv:
 		inc word [cs:PXEStackLock]
 		jnz .skip1
+		pop bp
 		mov [cs:PXEStack],sp
 		mov [cs:PXEStack+2],ss
 		lss sp,[cs:InitStack]
+		push bp
@@ -393,7 +395,9 @@ pxenv:
 		dec word [cs:PXEStackLock]
 		jns .skip2
+		pop bp
 		lss sp,[cs:PXEStack]
+		push bp

More information about the Syslinux-commits mailing list