* [PATCH] UefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue with GCC 5.4
@ 2017-02-21 3:32 Jeff Fan
2017-02-21 4:37 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Fan @ 2017-02-21 3:32 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Feng Tian, Michael D Kinney
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>
---
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
index 6b62f09..975adaa 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------ ;
-# Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
# 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
@@ -36,7 +36,8 @@ ASM_GLOBAL ASM_PFX(CommonExceptionHandler)
.macro IDT_MACRO arg
push \arg
#endif
- jmp ASM_PFX(CommonInterruptEntry)
+ .byte 0xe9 # jmp ASM_PFX(CommonInterruptEntry)
+ .long ASM_PFX(CommonInterruptEntry) - . - 4
.endm
AsmIdtVectorBegin:
--
2.9.3.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] UefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue with GCC 5.4
2017-02-21 3:32 [PATCH] UefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue with GCC 5.4 Jeff Fan
@ 2017-02-21 4:37 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-02-21 4:37 UTC (permalink / raw)
To: Fan, Jeff, edk2-devel@ml01.01.org; +Cc: Tian, Feng, Kinney, Michael D
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: Fan, Jeff
>Sent: Tuesday, February 21, 2017 11:32 AM
>To: edk2-devel@ml01.01.org
>Cc: Gao, Liming <liming.gao@intel.com>; Tian, Feng <feng.tian@intel.com>;
>Kinney, Michael D <michael.d.kinney@intel.com>
>Subject: [PATCH] UefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue
>with GCC 5.4
>
>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>
>---
> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S |
>5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git
>a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
>b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
>index 6b62f09..975adaa 100644
>---
>a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
>+++
>b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
>@@ -1,5 +1,5 @@
> #------------------------------------------------------------------------------ ;
>-# Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
>+# Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
> # 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
>@@ -36,7 +36,8 @@ ASM_GLOBAL ASM_PFX(CommonExceptionHandler)
> .macro IDT_MACRO arg
> push \arg
> #endif
>- jmp ASM_PFX(CommonInterruptEntry)
>+ .byte 0xe9 # jmp ASM_PFX(CommonInterruptEntry)
>+ .long ASM_PFX(CommonInterruptEntry) - . - 4
> .endm
>
> AsmIdtVectorBegin:
>--
>2.9.3.windows.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-21 4:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-21 3:32 [PATCH] UefiCpuPkg/ExceptionHandlerAsm.S: Fix code length issue with GCC 5.4 Jeff Fan
2017-02-21 4:37 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox