X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseLib%2FIa32%2FThunk16.S;h=df205e9a1929c7b970c888550616119e72bbb986;hb=dccf78f0a29c44485f2bd5eef4398b6be93ee81b;hp=07d544b0c5a7de99437058d24e362cf3d98665f0;hpb=bff2467affa16c1903dc7f63b01629b0f19fcfde;p=mirror_edk2.git
diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.S b/MdePkg/Library/BaseLib/Ia32/Thunk16.S
index 07d544b0c5..df205e9a19 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.S
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.S
@@ -1,10 +1,10 @@
#------------------------------------------------------------------------------
#
-# Copyright (c) 2006, Intel Corporation
-# All rights reserved. This program and the accompanying materials
+# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
+# http://opensource.org/licenses/bsd-license.php.
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -21,8 +21,8 @@
#include
-.globl ASM_PFX(m16Start), ASM_PFX(m16Size), ASM_PFX(mThunk16Attr), ASM_PFX(m16Gdt), ASM_PFX(m16GdtrBase), ASM_PFX(mTransition)
-.globl ASM_PFX(InternalAsmThunk16)
+ASM_GLOBAL ASM_PFX(m16Start), ASM_PFX(m16Size), ASM_PFX(mThunk16Attr), ASM_PFX(m16Gdt), ASM_PFX(m16GdtrBase), ASM_PFX(mTransition)
+ASM_GLOBAL ASM_PFX(InternalAsmThunk16)
ASM_PFX(m16Start):
@@ -55,7 +55,7 @@ ASM_PFX(ThunkAttr): .space 4
orb $2, %al
outb %al, $0x92 # deactivate A20M#
2:
- movl %ss, %eax
+ movw %ss, %ax
.byte 0x67, 0x66, 0x8d, 0x6c, 0x24, 0x34, 0x66
mov %ebp, 0xffffffd8(%esi)
mov 0xfffffff8(%esi), %ebx
@@ -98,8 +98,8 @@ ASM_PFX(ToUserCode):
call L_Base # push eip
L_Base:
popw %bp # ebp <- offset L_Base
- addr16 pushl 36(%si)
- .byte 0x36
+ .byte 0x67; # address size override
+ push 54(%esp)
lea 0xc(%esi), %eax
push %eax
lret
@@ -134,8 +134,8 @@ _16DsDesc:
GdtEnd:
#
-# @param RegSet Pointer to a IA32_DWORD_REGS structure
-# @param Transition Pointer to the transition code
+# @param RegSet The pointer to a IA32_DWORD_REGS structure
+# @param Transition The pointer to the transition code
# @return The address of the 16-bit stack after returning from user code
#
ASM_PFX(InternalAsmThunk16):
@@ -160,14 +160,14 @@ ASM_PFX(InternalAsmThunk16):
movsl # copy RegSet
movl 40(%esp), %eax # eax <- address of transition code
movl %edx, %esi # esi <- 16-bit stack segment
- lea 0x5e(%eax), %edx
+ lea 0x5f(%eax), %edx
movl %eax, %ecx
andl $0xf, %ecx
shll $12, %eax
lea 0x6(%ecx), %ecx
movw %cx, %ax
stosl # [edi] <- return address of user code
- sgdtl 0xffffffa2(%edx)
+ sgdtl 0xffffffa1(%edx)
sidtl 0x24(%esp)
movl %cr0, %eax
movl %eax, (%edx) # save CR0 in SavedCr0
@@ -183,20 +183,20 @@ ASM_PFX(InternalAsmThunk16):
popfl
lidtl 0x24(%esp)
lea 0xffffffcc(%ebp), %eax
- pop %gs
- pop %fs
- pop %es
- pop %ds
- pop %edi
- pop %esi
- pop %ebx
- pop %ebp
+ pop %gs
+ pop %fs
+ pop %es
+ pop %ds
+ pop %edi
+ pop %esi
+ pop %ebx
+ pop %ebp
ret
.const:
-ASM_PFX(m16Size): .word _InternalAsmThunk16 - ASM_PFX(m16Start)
-ASM_PFX(mThunk16Attr): .word _ThunkAttr - ASM_PFX(m16Start)
+ASM_PFX(m16Size): .word ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start)
+ASM_PFX(mThunk16Attr): .word ASM_PFX(ThunkAttr) - ASM_PFX(m16Start)
ASM_PFX(m16Gdt): .word _NullSegDesc - ASM_PFX(m16Start)
ASM_PFX(m16GdtrBase): .word _16GdtrBase - ASM_PFX(m16Start)
ASM_PFX(mTransition): .word _EntryPoint - ASM_PFX(m16Start)