[syslinux:master] core: Make cfarcall IF-preserving
syslinux-bot for H. Peter Anvin
hpa at linux.intel.com
Mon Jun 21 16:03:09 PDT 2010
Commit-ID: 8659757a388ad9071156f2e3d6b04813960dcfed
Gitweb: http://syslinux.zytor.com/commit/8659757a388ad9071156f2e3d6b04813960dcfed
Author: H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Mon, 21 Jun 2010 15:59:40 -0700
Committer: H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Mon, 21 Jun 2010 15:59:40 -0700
core: Make cfarcall IF-preserving
cfarcall does not take a register image on input, so we need to
explicitly preserve IF in the code flow.
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
---
core/callback.inc | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/core/callback.inc b/core/callback.inc
index 6a35132..d98d800 100644
--- a/core/callback.inc
+++ b/core/callback.inc
@@ -84,13 +84,15 @@ core_syscall:
bits 16
section .text16
.rm:
+ mov ax,sp
+ add ax,9*4+4*2
+ mov [CallbackSP],ax
pop gs
pop fs
pop es
pop ds
popad
popfd
- mov [cs:CallbackSP],sp
retf ; Invoke routine
.rm_return:
@@ -138,6 +140,7 @@ core_syscall:
;
; Cfarcall invocation. We copy the stack frame to the real-mode stack,
; followed by the return CS:IP and the CS:IP of the target function.
+; The value of IF is copied from the calling routine.
;
global core_cfarcall
core_cfarcall:
@@ -156,11 +159,14 @@ core_cfarcall:
mov [word CallbackSP],di
sub edi,ecx ; Allocate space for stack frame
and edi,~3 ; Round
- sub edi,4*2 ; Return pointer, return value
+ sub edi,4*3 ; Return pointer, return value, EFLAGS
mov [word RealModeSSSP],di
shl ebx,4
add edi,ebx ; Create linear address
+ mov eax,[esp+5*4] ; EFLAGS from entry
+ and eax,0x202 ; IF only
+ stosd
mov eax,[esp+7*4] ; CS:IP
stosd ; Save to stack frame
mov eax,.rm_return ; Return seg:off
@@ -179,6 +185,7 @@ core_cfarcall:
bits 16
section .text16
.rm:
+ popfd
retf
.rm_return:
mov sp,[cs:CallbackSP]
More information about the Syslinux-commits
mailing list