]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.S
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Thunk16 / Ia32 / Thunk16.S
index d1feb9972e9a8ece1037c60ef2ec537a6e1b01c2..55415d87035c9140ea98988fb92f2bc216c32eff 100644 (file)
@@ -1,6 +1,6 @@
 #*****************************************************************************\r
 #*\r
-#*   Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+#*   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
 #*   This program and the accompanying materials                          \r
 #*   are licensed and made available under the terms and conditions of the BSD License         \r
 #*   which accompanies this distribution.  The full text of the license may be found at        \r
@@ -72,6 +72,9 @@ ASM_PFX(Thunk16):
     push   $0xd\r
     pop    %ecx\r
     rep movsl %ds:(%esi),%es:(%edi)   #; copy context to 16-bit stack\r
+    #; copy eflags to stack frame\r
+    mov    -12(%esi), %eax\r
+    mov    %eax, -72(%edi) \r
     pop    %ebx                       #; ebx <- 16-bit stack offset\r
     mov    $L_Lable1,%eax\r
     stos   %eax,%es:(%edi)\r
@@ -140,20 +143,23 @@ ASM_PFX(RealMode):
     popw    %es\r
     popw    %fs\r
     popw    %gs\r
-    addw    $4, %sp                     # skip EFlags\r
-    testw   $1, 14(%esp)                  #(_STK16 ptr [esp + 8]).ThunkFlags, 1\r
+    sub     60, %esp\r
+    popfw\r
+    testw   $1, 74(%esp)                #(_STK16 ptr [esp + STACK_PARAM_SIZE + sizeof(IA32_REGS)]).ThunkFlags, 1\r
+\r
     jz      1f\r
-    pushf\r
+    pushf                               # push Flags when it's INT#\r
 1: \r
     pushw   %cs\r
 #    push    @FarCallRet - _Code16Addr\r
     .byte   0x68                        # push /iw\r
     .word   FarCallRet - _Code16Addr\r
     jz      2f\r
-    ljmp    *6(%esp)                  #bugbug\r
+    ljmp    *66(%esp)                   #[esp + 6 + STACK_PARAM_SIZE + sizeof(IA32_REGS) - 8]\r
 2: \r
-    ljmp    *4(%esp)                  #bugbug\r
+    ljmp    *64(%esp)                   #[esp + 4 + STACK_PARAM_SIZE + sizeof(IA32_REGS) - 8]\r
 FarCallRet: \r
+    add     60, %esp\r
     pushfl\r
     pushw   %gs\r
     pushw   %fs\r