From 0249feb8b5656a67330ab76db00429a2edecf6b0 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Thu, 15 Dec 2011 08:27:53 +0000 Subject: Fix the issue to clear the high 16-bit of EAX before use it Thunk code. This patch updates MdePkg BaseLib, EcpPkg EdkIIGlueLib BaseLib and ThunkLib. Signed-off-by: lgao4 Reviewed-by: rsun3 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12877 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.S | 5 +++-- .../Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.asm | 5 +++-- .../Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S | 5 +++-- .../Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.asm | 5 +++-- EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.S | 5 +++-- EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.asm | 5 +++-- EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S | 2 +- EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.asm | 2 +- 8 files changed, 20 insertions(+), 14 deletions(-) (limited to 'EdkCompatibilityPkg/Foundation/Library') diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.S index 6055ca663c..b33d67c9ed 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2011, 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 @@ -55,7 +55,8 @@ ASM_PFX(ThunkAttr): .space 4 orb $2, %al outb %al, $0x92 # deactivate A20M# 2: - movw %ss, %ax + xorw %ax, %ax # xor eax, eax + movl %ss, %eax # mov ax, ss .byte 0x67, 0x66, 0x8d, 0x6c, 0x24, 0x34, 0x66 mov %ebp, 0xffffffd8(%esi) mov 0xfffffff8(%esi), %ebx diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.asm index 61508d73bc..8b22e0f336 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Thunk16.asm @@ -1,4 +1,4 @@ -; Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+; Copyright (c) 2004 - 2011, 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 @@ -108,7 +108,8 @@ _ThunkAttr DD ? or al, 2 out 92h, al ; deactivate A20M# @2: - mov ax, ss + xor ax, ax ; xor eax, eax + mov eax, ss ; mov ax, ss DB 67h lea bp, [esp + sizeof (IA32_REGS)] ; diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S index 1de788a184..038cc75a67 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # -# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2011, 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 @@ -109,7 +109,8 @@ L_1: orb $2,%al outb %al, $0x92 # deactivate A20M# L_2: - movw %ss,%ax + xorw %ax,%ax # xor eax, eax + movl %ss,%eax # mov ax, ss lea IA32_REGS_SIZE(%esp), %bp # # rsi in the following 2 instructions is indeed bp in 16-bit code diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.asm index c7d9caefe7..b181a4ccfd 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.asm @@ -1,4 +1,4 @@ -; Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+; Copyright (c) 2004 - 2011, 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 @@ -103,7 +103,8 @@ _ThunkAttr DD ? or al, 2 out 92h, al ; deactivate A20M# @2: - mov ax, ss + xor ax, ax ; xor eax, eax + mov eax, ss ; mov ax, ss lea bp, [esp + sizeof (IA32_REGS)] ; ; rsi in the following 2 instructions is indeed bp in 16-bit code diff --git a/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.S b/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.S index 55415d8703..cf7776a6a3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.S +++ b/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.S @@ -1,6 +1,6 @@ #***************************************************************************** #* -#* Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+#* Copyright (c) 2006 - 2011, 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 @@ -116,7 +116,8 @@ L_16Bit: .byte 0xfc L_Lable1: - movl %ss,%eax + xor %eax,%eax + movw %ss,%ax shl $0x4,%eax add %esp,%eax lss 0x3c(%esp),%esp diff --git a/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.asm b/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.asm index 76c1317469..0a796ed236 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.asm +++ b/EdkCompatibilityPkg/Foundation/Library/Thunk16/Ia32/Thunk16.asm @@ -1,6 +1,6 @@ ;***************************************************************************** ;* -;* Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+;* Copyright (c) 2006 - 2011, 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 @@ -141,7 +141,8 @@ __Thunk16 PROC USES ebp ebx esi edi ds es fs gs mov cr4, eax ; disable PAE & PSE db 67h, 0FFh, 06Ch, 024h, 0FCh ; jmp dword ptr [esp-4] @@: - mov eax, ss + xor eax, eax + mov ax, ss shl eax, 4 add eax, esp ; eax <- address of 16-bit stack lss esp, fword ptr (_STK16 ptr [esp + sizeof (IA32_REGS)]).SavedEsp diff --git a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S index 7328ab764d..f77388d811 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S +++ b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S @@ -148,7 +148,7 @@ Label_16Bit: Label: xor %rax,%rax - movl %ss,%eax + movw %ss,%ax shl $0x4,%eax add %esp,%eax mov %r15,%rsp diff --git a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.asm b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.asm index 0638d5faa8..6b74bbe7cb 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.asm +++ b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.asm @@ -144,7 +144,7 @@ _Thunk16 PROC USES rbp rbx rsi rdi r12 r13 r14 r15 retf @@: xor rax, rax - mov eax, ss + mov ax, ss shl eax, 4 add eax, esp ; rax <- address of 16-bit stack mov rsp, r15 -- cgit v1.2.3