* [PATCH 0/3] ArmPkg/ArmPlatformPkg: some cleanups
@ 2016-10-28 11:42 Ard Biesheuvel
2016-10-28 11:42 ` [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents Ard Biesheuvel
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Ard Biesheuvel @ 2016-10-28 11:42 UTC (permalink / raw)
To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel
A couple of remaining cleanups I had in my queue.
Ard Biesheuvel (3):
ArmPkg RVCT: add ADRL/LDRL macro equivalents
ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd
ArmPkg: remove LoadConstantXxx() asm macros
ArmPkg/Include/AsmMacroIoLib.h | 33 --------------------
ArmPkg/Include/AsmMacroIoLib.inc | 18 ++++++++---
ArmPkg/Include/AsmMacroIoLibV8.h | 30 ------------------
ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm | 2 +-
4 files changed, 15 insertions(+), 68 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents
2016-10-28 11:42 [PATCH 0/3] ArmPkg/ArmPlatformPkg: some cleanups Ard Biesheuvel
@ 2016-10-28 11:42 ` Ard Biesheuvel
2016-10-28 15:21 ` Leif Lindholm
2016-10-28 11:42 ` [PATCH 2/3] ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd Ard Biesheuvel
2016-10-28 11:42 ` [PATCH 3/3] ArmPkg: remove LoadConstantXxx() asm macros Ard Biesheuvel
2 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2016-10-28 11:42 UTC (permalink / raw)
To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel
The GCC ARM builds have access to ADRL/LDRL macros that emit relative
symbol references, i.e., references that do not require fixing up at
load time (or FV generation time for XIP modules)
Implement equivalent functionality for RVCT: note that this does not
use movw/movt pairs, but the more compatible add/add/add or add/add/ldr
sequences (which Clang does not support, unfortunately, hence the use
of movw/movt for the GCC toolchain family)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
ArmPkg/Include/AsmMacroIoLib.inc | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
index c9cad5230c94..4bc3146fb399 100644
--- a/ArmPkg/Include/AsmMacroIoLib.inc
+++ b/ArmPkg/Include/AsmMacroIoLib.inc
@@ -26,4 +26,24 @@
ldr $Reg, =($Data)
MEND
+ MACRO
+ adrll $Reg, $Symbol
+ add $Reg, pc, #-8
+ RELOC R_ARM_ALU_PC_G0_NC, $Symbol
+ add $Reg, $Reg, #-4
+ RELOC R_ARM_ALU_PC_G1_NC, $Symbol
+ add $Reg, $Reg, #0
+ RELOC R_ARM_ALU_PC_G2, $Symbol
+ MEND
+
+ MACRO
+ ldrl $Reg, $Symbol
+ add $Reg, pc, #-8
+ RELOC R_ARM_ALU_PC_G0_NC, $Symbol
+ add $Reg, $Reg, #-4
+ RELOC R_ARM_ALU_PC_G1_NC, $Symbol
+ ldr $Reg, [$Reg, #0]
+ RELOC R_ARM_LDR_PC_G2, $Symbol
+ MEND
+
END
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd
2016-10-28 11:42 [PATCH 0/3] ArmPkg/ArmPlatformPkg: some cleanups Ard Biesheuvel
2016-10-28 11:42 ` [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents Ard Biesheuvel
@ 2016-10-28 11:42 ` Ard Biesheuvel
2016-10-28 15:21 ` Leif Lindholm
2016-10-28 11:42 ` [PATCH 3/3] ArmPkg: remove LoadConstantXxx() asm macros Ard Biesheuvel
2 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2016-10-28 11:42 UTC (permalink / raw)
To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel
Bring the RVCT version of the PrePi entry point code in line with the
GCC version, by using a relative rather than an absolute reference to
the mSystemMemoryEnd variable.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
index 1e9daf563bb6..80c2877cbdbf 100644
--- a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
+++ b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
@@ -48,7 +48,7 @@ _SetSVCMode
// to install the stacks at the bottom of the Firmware Device (case the FD is located
// at the top of the DRAM)
_SystemMemoryEndInit
- mov32 r1, mSystemMemoryEnd
+ adrll r1, mSystemMemoryEnd
ldrd r2, r3, [r1]
teq r3, #0
moveq r1, r2
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] ArmPkg: remove LoadConstantXxx() asm macros
2016-10-28 11:42 [PATCH 0/3] ArmPkg/ArmPlatformPkg: some cleanups Ard Biesheuvel
2016-10-28 11:42 ` [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents Ard Biesheuvel
2016-10-28 11:42 ` [PATCH 2/3] ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd Ard Biesheuvel
@ 2016-10-28 11:42 ` Ard Biesheuvel
2016-10-28 15:21 ` Leif Lindholm
2 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2016-10-28 11:42 UTC (permalink / raw)
To: edk2-devel, leif.lindholm; +Cc: Ard Biesheuvel
This is ancient cruft that is no longer used, so remove it.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
ArmPkg/Include/AsmMacroIoLib.h | 33 --------------------
ArmPkg/Include/AsmMacroIoLib.inc | 10 ------
ArmPkg/Include/AsmMacroIoLibV8.h | 30 ------------------
3 files changed, 73 deletions(-)
diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h
index 936e01e3388f..16d2a307291c 100644
--- a/ArmPkg/Include/AsmMacroIoLib.h
+++ b/ArmPkg/Include/AsmMacroIoLib.h
@@ -19,39 +19,6 @@
#ifndef __MACRO_IO_LIB_H__
#define __MACRO_IO_LIB_H__
-#if defined(__APPLE__)
-
-//
-// ldr reg, =expr does not work with current Apple tool chain. So do the work our selves
-//
-
-// load _Reg with _Data
-#define LoadConstantToReg(_Data, _Reg) \
- ldr _Reg, [pc, #0] ; \
- b 1f ; \
- .long (_Data) ; \
-1:
-
-#elif defined (__GNUC__)
-
-#define LoadConstantToReg(Data, Reg) \
- ldr Reg, =Data
-
-#else
-
-//
-// Use ARM assembly macros, form armasam
-//
-// Less magic in the macros if ldr reg, =expr works
-//
-
-// load _Reg with _Data
-
-
-#define LoadConstantToReg(Data, Reg) LoadConstantToRegMacro Data, Reg
-
-#endif
-
#define _ASM_FUNC(Name, Section) \
.global Name ; \
.section #Section, "ax" ; \
diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
index 4bc3146fb399..ce7a1488daea 100644
--- a/ArmPkg/Include/AsmMacroIoLib.inc
+++ b/ArmPkg/Include/AsmMacroIoLib.inc
@@ -17,16 +17,6 @@
MACRO
- LoadConstantMacro $Data
- ldr r0, =($Data)
- MEND
-
- MACRO
- LoadConstantToRegMacro $Data, $Reg
- ldr $Reg, =($Data)
- MEND
-
- MACRO
adrll $Reg, $Symbol
add $Reg, pc, #-8
RELOC R_ARM_ALU_PC_G0_NC, $Symbol
diff --git a/ArmPkg/Include/AsmMacroIoLibV8.h b/ArmPkg/Include/AsmMacroIoLibV8.h
index e9285f78e7d6..db43d3b52e5a 100644
--- a/ArmPkg/Include/AsmMacroIoLibV8.h
+++ b/ArmPkg/Include/AsmMacroIoLibV8.h
@@ -42,36 +42,6 @@
cbnz SAFE_XREG, 1f ;\
b . ;// We should never get here
-#if defined(__clang__)
-
-// load x0 with _Data
-#define LoadConstant(_Data) \
- ldr x0, 1f ; \
- b 2f ; \
-.align(8) ; \
-1: \
- .8byte (_Data) ; \
-2:
-
-// load _Reg with _Data
-#define LoadConstantToReg(_Data, _Reg) \
- ldr _Reg, 1f ; \
- b 2f ; \
-.align(8) ; \
-1: \
- .8byte (_Data) ; \
-2:
-
-#elif defined (__GNUC__)
-
-#define LoadConstant(Data) \
- ldr x0, =Data
-
-#define LoadConstantToReg(Data, Reg) \
- ldr Reg, =Data
-
-#endif // __GNUC__
-
#define _ASM_FUNC(Name, Section) \
.global Name ; \
.section #Section, "ax" ; \
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents
2016-10-28 11:42 ` [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents Ard Biesheuvel
@ 2016-10-28 15:21 ` Leif Lindholm
0 siblings, 0 replies; 7+ messages in thread
From: Leif Lindholm @ 2016-10-28 15:21 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: edk2-devel
On Fri, Oct 28, 2016 at 12:42:52PM +0100, Ard Biesheuvel wrote:
> The GCC ARM builds have access to ADRL/LDRL macros that emit relative
> symbol references, i.e., references that do not require fixing up at
> load time (or FV generation time for XIP modules)
>
> Implement equivalent functionality for RVCT: note that this does not
> use movw/movt pairs, but the more compatible add/add/add or add/add/ldr
> sequences (which Clang does not support, unfortunately, hence the use
> of movw/movt for the GCC toolchain family)
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Not tested, but looks sensible.
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> ArmPkg/Include/AsmMacroIoLib.inc | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
> index c9cad5230c94..4bc3146fb399 100644
> --- a/ArmPkg/Include/AsmMacroIoLib.inc
> +++ b/ArmPkg/Include/AsmMacroIoLib.inc
> @@ -26,4 +26,24 @@
> ldr $Reg, =($Data)
> MEND
>
> + MACRO
> + adrll $Reg, $Symbol
> + add $Reg, pc, #-8
> + RELOC R_ARM_ALU_PC_G0_NC, $Symbol
> + add $Reg, $Reg, #-4
> + RELOC R_ARM_ALU_PC_G1_NC, $Symbol
> + add $Reg, $Reg, #0
> + RELOC R_ARM_ALU_PC_G2, $Symbol
> + MEND
> +
> + MACRO
> + ldrl $Reg, $Symbol
> + add $Reg, pc, #-8
> + RELOC R_ARM_ALU_PC_G0_NC, $Symbol
> + add $Reg, $Reg, #-4
> + RELOC R_ARM_ALU_PC_G1_NC, $Symbol
> + ldr $Reg, [$Reg, #0]
> + RELOC R_ARM_LDR_PC_G2, $Symbol
> + MEND
> +
> END
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd
2016-10-28 11:42 ` [PATCH 2/3] ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd Ard Biesheuvel
@ 2016-10-28 15:21 ` Leif Lindholm
0 siblings, 0 replies; 7+ messages in thread
From: Leif Lindholm @ 2016-10-28 15:21 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: edk2-devel
On Fri, Oct 28, 2016 at 12:42:53PM +0100, Ard Biesheuvel wrote:
> Bring the RVCT version of the PrePi entry point code in line with the
> GCC version, by using a relative rather than an absolute reference to
> the mSystemMemoryEnd variable.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
> index 1e9daf563bb6..80c2877cbdbf 100644
> --- a/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
> +++ b/ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
> @@ -48,7 +48,7 @@ _SetSVCMode
> // to install the stacks at the bottom of the Firmware Device (case the FD is located
> // at the top of the DRAM)
> _SystemMemoryEndInit
> - mov32 r1, mSystemMemoryEnd
> + adrll r1, mSystemMemoryEnd
> ldrd r2, r3, [r1]
> teq r3, #0
> moveq r1, r2
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] ArmPkg: remove LoadConstantXxx() asm macros
2016-10-28 11:42 ` [PATCH 3/3] ArmPkg: remove LoadConstantXxx() asm macros Ard Biesheuvel
@ 2016-10-28 15:21 ` Leif Lindholm
0 siblings, 0 replies; 7+ messages in thread
From: Leif Lindholm @ 2016-10-28 15:21 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: edk2-devel
On Fri, Oct 28, 2016 at 12:42:54PM +0100, Ard Biesheuvel wrote:
> This is ancient cruft that is no longer used, so remove it.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> ArmPkg/Include/AsmMacroIoLib.h | 33 --------------------
> ArmPkg/Include/AsmMacroIoLib.inc | 10 ------
> ArmPkg/Include/AsmMacroIoLibV8.h | 30 ------------------
> 3 files changed, 73 deletions(-)
>
> diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h
> index 936e01e3388f..16d2a307291c 100644
> --- a/ArmPkg/Include/AsmMacroIoLib.h
> +++ b/ArmPkg/Include/AsmMacroIoLib.h
> @@ -19,39 +19,6 @@
> #ifndef __MACRO_IO_LIB_H__
> #define __MACRO_IO_LIB_H__
>
> -#if defined(__APPLE__)
> -
> -//
> -// ldr reg, =expr does not work with current Apple tool chain. So do the work our selves
> -//
> -
> -// load _Reg with _Data
> -#define LoadConstantToReg(_Data, _Reg) \
> - ldr _Reg, [pc, #0] ; \
> - b 1f ; \
> - .long (_Data) ; \
> -1:
> -
> -#elif defined (__GNUC__)
> -
> -#define LoadConstantToReg(Data, Reg) \
> - ldr Reg, =Data
> -
> -#else
> -
> -//
> -// Use ARM assembly macros, form armasam
> -//
> -// Less magic in the macros if ldr reg, =expr works
> -//
> -
> -// load _Reg with _Data
> -
> -
> -#define LoadConstantToReg(Data, Reg) LoadConstantToRegMacro Data, Reg
> -
> -#endif
> -
> #define _ASM_FUNC(Name, Section) \
> .global Name ; \
> .section #Section, "ax" ; \
> diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
> index 4bc3146fb399..ce7a1488daea 100644
> --- a/ArmPkg/Include/AsmMacroIoLib.inc
> +++ b/ArmPkg/Include/AsmMacroIoLib.inc
> @@ -17,16 +17,6 @@
>
>
> MACRO
> - LoadConstantMacro $Data
> - ldr r0, =($Data)
> - MEND
> -
> - MACRO
> - LoadConstantToRegMacro $Data, $Reg
> - ldr $Reg, =($Data)
> - MEND
> -
> - MACRO
> adrll $Reg, $Symbol
> add $Reg, pc, #-8
> RELOC R_ARM_ALU_PC_G0_NC, $Symbol
> diff --git a/ArmPkg/Include/AsmMacroIoLibV8.h b/ArmPkg/Include/AsmMacroIoLibV8.h
> index e9285f78e7d6..db43d3b52e5a 100644
> --- a/ArmPkg/Include/AsmMacroIoLibV8.h
> +++ b/ArmPkg/Include/AsmMacroIoLibV8.h
> @@ -42,36 +42,6 @@
> cbnz SAFE_XREG, 1f ;\
> b . ;// We should never get here
>
> -#if defined(__clang__)
> -
> -// load x0 with _Data
> -#define LoadConstant(_Data) \
> - ldr x0, 1f ; \
> - b 2f ; \
> -.align(8) ; \
> -1: \
> - .8byte (_Data) ; \
> -2:
> -
> -// load _Reg with _Data
> -#define LoadConstantToReg(_Data, _Reg) \
> - ldr _Reg, 1f ; \
> - b 2f ; \
> -.align(8) ; \
> -1: \
> - .8byte (_Data) ; \
> -2:
> -
> -#elif defined (__GNUC__)
> -
> -#define LoadConstant(Data) \
> - ldr x0, =Data
> -
> -#define LoadConstantToReg(Data, Reg) \
> - ldr Reg, =Data
> -
> -#endif // __GNUC__
> -
> #define _ASM_FUNC(Name, Section) \
> .global Name ; \
> .section #Section, "ax" ; \
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-10-28 15:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-28 11:42 [PATCH 0/3] ArmPkg/ArmPlatformPkg: some cleanups Ard Biesheuvel
2016-10-28 11:42 ` [PATCH 1/3] ArmPkg RVCT: add ADRL/LDRL macro equivalents Ard Biesheuvel
2016-10-28 15:21 ` Leif Lindholm
2016-10-28 11:42 ` [PATCH 2/3] ArmPlatformPkg/PrePi RVCT: use relative reference to mSystemMemoryEnd Ard Biesheuvel
2016-10-28 15:21 ` Leif Lindholm
2016-10-28 11:42 ` [PATCH 3/3] ArmPkg: remove LoadConstantXxx() asm macros Ard Biesheuvel
2016-10-28 15:21 ` Leif Lindholm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox