]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Thunk16 / X64 / Thunk16.S
index 888801b1ab3ced0f2f909dfbf8e3a557e6be907e..10f3a34c1920d2a1e96853cb72025480ecceea5c 100644 (file)
@@ -1,6 +1,6 @@
 #*****************************************************************************\r
 #*\r
-#*   Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>\r
+#*   Copyright (c) 2008 - 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
@@ -106,6 +106,9 @@ ASM_PFX(Thunk16):
       pushq  $0xe                       #push    sizeof (IA32_REGS) / 4\r
       pop    %rcx\r
       rep movsl %ds:(%rsi),%es:(%rdi)\r
+      #; copy eflags to stack frame\r
+      mov    -16(%rsi), %rax\r
+      mov    %rax, -80(%rsi)\r
       pop    %rbx                       #rbx <- 16-bit stack offset\r
       lea    Label,%eax                 #42 <_Thunk16+0x42>\r
       stos   %eax,%es:(%rdi)\r
@@ -183,27 +186,30 @@ ASM_PFX(RealMode):
    .byte   0x07                        #pop es\r
     popq   %fs\r
     popq   %gs\r
-    add    $0x8,%esp                   #skip RFLAGS\r
-   .byte   0x67                        #test [esp + 0eh], 1\r
+    sub    64, %esp\r
+    .byte  0x66, 0x9d                  #popfd\r
+    add    $0x4,%esp                   #skip high part of RFLAGS\r
+   .byte   0x67                        #; test    (_STK16 ptr [esp + STACK_PARAM_SIZE + sizeof(IA32_REGS)]).ThunkFlags, 1\r
    .byte   0xf7    \r
    .byte   0x44\r
    .byte   0x24\r
-   .byte   0x0e\r
+   .byte   0x4e\r
    .byte   0x01\r
    .byte   0x00\r
     jz      1f\r
-    pushfq                             #pushf, actually\r
+    pushfq                             #pushf, actually, when it's INT#\r
 1:\r
    .byte   0x0e                        #push cs\r
    .byte   0x68                        #push /iw\r
    .word   FarCallRet - _Code16Addr\r
     jz     2f\r
    .byte   0x66\r
-    ljmp   *6(%esp)\r
+    ljmp   *70(%esp)\r
 2:    \r
    .byte   0x66\r
-    ljmp   *4(%esp)\r
+    ljmp   *68(%esp)\r
 FarCallRet: \r
+    add    64, %esp\r
    .byte   0x66\r
     push   $0x00                       #push a dword of zero\r
    .byte   0x66\r