From: mdkinney Date: Fri, 17 Jul 2009 22:56:34 +0000 (+0000) Subject: Fix bug in EBC thunk for X64 that appears when higher levels of compiler optimization... X-Git-Tag: edk2-stable201903~17343 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=045e90accdf96b9633cbea6f98b63382481e4f9e Fix bug in EBC thunk for X64 that appears when higher levels of compiler optimization is used. This is a temporary fix that should for for most tool chains. A more complete fix will be required to guarantee compatibility with all tool chains. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8970 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm b/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm index 6741405cbc..2f968cac2f 100644 --- a/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm +++ b/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm @@ -92,6 +92,7 @@ EbcLLCALLEXNative ENDP ; The contents of the register in which the entry point is passed. ; EbcLLGetEbcEntryPoint PROC PUBLIC + mov rax, r10 ret EbcLLGetEbcEntryPoint ENDP diff --git a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c index 3f84bcc496..6c0428d9cc 100644 --- a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c +++ b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c @@ -412,14 +412,14 @@ EbcCreateThunks ( // // Add code bytes to load up a processor register with the EBC entry point. - // mov rax, 123456789abcdef0h => 48 B8 F0 DE BC 9A 78 56 34 12 + // mov r10, 123456789abcdef0h => 48 B8 F0 DE BC 9A 78 56 34 12 // The first 8 bytes of the thunk entry is the address of the EBC // entry point. // - *Ptr = 0x48; + *Ptr = 0x49; Ptr++; Size--; - *Ptr = 0xB8; + *Ptr = 0xBA; Ptr++; Size--; Addr = (UINT64) EbcEntryPoint;