[edk2] ArmVirtPkg: adapt ArmVirtXen build to system memory end global variable

Message ID 1436214301-22879-1-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel July 6, 2015, 8:25 p.m.
This fixes the ArmVirtXen build that was broken by r17835, which adds
a global variable mSystemMemoryEnd which is shared between a module
and a library it depends on.

Add the same global variable to the relocatable PrePi used by ArmVirtXen.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---

This fixes the build for ArmVirtXen, although I would have preferred a
different approach for r17835 in the first place, i.e., a clean interface
rather than a global which is declared as an extern in random places.

Comments

Ard Biesheuvel July 7, 2015, 11:02 a.m. | #1
On 7 July 2015 at 13:01, Olivier Martin <Olivier.Martin@arm.com> wrote:
> Sorry for that, I have got ArmVirtQemu.dsc in my CI but I have not got yet ArmVirtXen.dsc :-/
>

No problem, it was an easy fix.

Thanks,
Ard.


> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: 06 July 2015 21:25
> To: edk2-devel@lists.sourceforge.net; Olivier Martin; lersek@redhat.com
> Cc: Ard Biesheuvel
> Subject: [PATCH] ArmVirtPkg: adapt ArmVirtXen build to system memory end global variable
>
> This fixes the ArmVirtXen build that was broken by r17835, which adds a global variable mSystemMemoryEnd which is shared between a module and a library it depends on.
>
> Add the same global variable to the relocatable PrePi used by ArmVirtXen.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> This fixes the build for ArmVirtXen, although I would have preferred a different approach for r17835 in the first place, i.e., a clean interface rather than a global which is declared as an extern in random places.
>
> --
> Ard.
>
>
>  ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S | 4 ++++
>  ArmVirtPkg/PrePi/PrePi.h                    | 2 ++
>  2 files changed, 6 insertions(+)
>
> diff --git a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
> index 568d0086d662..0adaf44c9ed9 100644
> --- a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
> +++ b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
> @@ -25,8 +25,10 @@ GCC_ASM_IMPORT(ArmReadMpidr)
>  GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
>  GCC_ASM_IMPORT(ArmPlatformStackSet)
>  GCC_ASM_EXPORT(_ModuleEntryPoint)
> +GCC_ASM_EXPORT(mSystemMemoryEnd)
>
>  StartupAddr:        .8byte ASM_PFX(CEntryPoint)
> +mSystemMemoryEnd:   .8byte 0
>
>  ASM_PFX(_ModuleEntryPoint):
>    //
> @@ -80,6 +82,8 @@ _SetupStackPosition:
>    ldr   x2, PcdGet64 (PcdSystemMemorySize)
>    sub   x2, x2, #1
>    add   x1, x1, x2      // x1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize
> +  adr   x2, mSystemMemoryEnd
> +  str   x1, [x2]
>
>    // Calculate Top of the Firmware Device
>    ldr   x2, PcdGet64 (PcdFdBaseAddress)
> diff --git a/ArmVirtPkg/PrePi/PrePi.h b/ArmVirtPkg/PrePi/PrePi.h
> index 517429fab9a4..15b91e49c9bd 100644
> --- a/ArmVirtPkg/PrePi/PrePi.h
> +++ b/ArmVirtPkg/PrePi/PrePi.h
> @@ -29,6 +29,8 @@
>
>  #define SerialPrint(txt)  SerialPortWrite (txt, AsciiStrLen(txt)+1);
>
> +extern UINT64 mSystemMemoryEnd;
> +
>  RETURN_STATUS
>  EFIAPI
>  TimerConstructor (
> --
> 1.9.1
>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2557590
> ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2548782
>

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/

Patch hide | download patch | download mbox

diff --git a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
index 568d0086d662..0adaf44c9ed9 100644
--- a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
+++ b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
@@ -25,8 +25,10 @@  GCC_ASM_IMPORT(ArmReadMpidr)
 GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
 GCC_ASM_IMPORT(ArmPlatformStackSet)
 GCC_ASM_EXPORT(_ModuleEntryPoint)
+GCC_ASM_EXPORT(mSystemMemoryEnd)
 
 StartupAddr:        .8byte ASM_PFX(CEntryPoint)
+mSystemMemoryEnd:   .8byte 0
 
 ASM_PFX(_ModuleEntryPoint):
   //
@@ -80,6 +82,8 @@  _SetupStackPosition:
   ldr   x2, PcdGet64 (PcdSystemMemorySize)
   sub   x2, x2, #1
   add   x1, x1, x2      // x1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize
+  adr   x2, mSystemMemoryEnd
+  str   x1, [x2]
 
   // Calculate Top of the Firmware Device
   ldr   x2, PcdGet64 (PcdFdBaseAddress)
diff --git a/ArmVirtPkg/PrePi/PrePi.h b/ArmVirtPkg/PrePi/PrePi.h
index 517429fab9a4..15b91e49c9bd 100644
--- a/ArmVirtPkg/PrePi/PrePi.h
+++ b/ArmVirtPkg/PrePi/PrePi.h
@@ -29,6 +29,8 @@ 
 
 #define SerialPrint(txt)  SerialPortWrite (txt, AsciiStrLen(txt)+1);
 
+extern UINT64 mSystemMemoryEnd;
+
 RETURN_STATUS
 EFIAPI
 TimerConstructor (