From 3c47fe65ed83e3f9f61f33ea2d77a53f8e0da07e Mon Sep 17 00:00:00 2001 From: geekboy15a Date: Tue, 2 Aug 2011 22:29:50 +0000 Subject: [PATCH] MdePkg: Fixed hang/reset in thunk code when building with GCC X64 Reverted changes of data areas from .long back to .space 4. This was done because the size of .long is based off of .int and may vary. Using a fixed size is required because these values are for patching code. Also note that .space will automatically initialize the data to zero. Not initializing all values to zero was causing the hang/reset. Signed-off-by: geekboy15a Reviewed-by: darylm503 Reviewed-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12079 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseLib/X64/Thunk16.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.S b/MdePkg/Library/BaseLib/X64/Thunk16.S index dabf2d09e1..54753168c8 100644 --- a/MdePkg/Library/BaseLib/X64/Thunk16.S +++ b/MdePkg/Library/BaseLib/X64/Thunk16.S @@ -125,7 +125,7 @@ L_2: .byte 0x66,0x2e,0x89,0x87 # mov cs:[bx + (L_64Eip - L_Base)], eax .word L_64Eip - L_Base .byte 0x66,0xb8 # mov eax, imm32 -L_SavedCr4: .long 0 +L_SavedCr4: .space 4 movq %rax, %cr4 # # rdi in the instruction below is indeed bx in 16-bit code @@ -138,15 +138,15 @@ L_SavedCr4: .long 0 orb $1,%ah wrmsr .byte 0x66,0xb8 # mov eax, imm32 -L_SavedCr0: .long +L_SavedCr0: .space 4 movq %rax, %cr0 .byte 0x66,0xea # jmp far cs:L_64Bit -L_64Eip: .long 0 -L_SavedCs: .space 2 -L_64BitCode: +L_64Eip: .space 4 +L_SavedCs: .space 2 +L_64BitCode: .byte 0x90 .byte 0x67,0xbc # mov esp, imm32 -L_SavedSp: .long # restore stack +L_SavedSp: .space 4 # restore stack nop ret