]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue with GCC 5.4
authorJeff Fan <jeff.fan@intel.com>
Tue, 21 Feb 2017 03:29:45 +0000 (11:29 +0800)
committerJeff Fan <jeff.fan@intel.com>
Wed, 22 Feb 2017 01:50:04 +0000 (09:50 +0800)
X64\ExceptionHandlerAsm.S define MARCO to set up 32 IDT entries header.
It assume GCC compiler will generate the same code length on the following
instrction for each IDT entry.
  jmp    ASM_PFX(CommonInterruptEntry)

It works with GCC 4.x. However, GCC 5.4 will generate different code size of IDT
entry code per the offset value from CommonInterruptEntry address. We should use
DB to make sure each IDT entry header has the same size whatever compiler
version.

.ASM and .nasm used the different solution and do not have this issue.

https://bugzilla.tianocore.org/show_bug.cgi?id=389

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S

index 6b62f095bdc0559526ab2c688e53dfda81e43cf8..975adaa103ef0e02fb8299a2590ff9a3d151c722 100644 (file)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------ ;\r
-# Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2012 - 2017, 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
@@ -36,7 +36,8 @@ ASM_GLOBAL ASM_PFX(CommonExceptionHandler)
 .macro IDT_MACRO arg\r
   push    \arg\r
 #endif\r
-  jmp    ASM_PFX(CommonInterruptEntry)\r
+  .byte   0xe9      # jmp     ASM_PFX(CommonInterruptEntry)\r
+  .long   ASM_PFX(CommonInterruptEntry) - . - 4\r
 .endm\r
 \r
 AsmIdtVectorBegin:\r