]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Include/AsmMacroIoLibV8.h
ArmPkg: remove LoadConstantXxx() asm macros
[mirror_edk2.git] / ArmPkg / Include / AsmMacroIoLibV8.h
index 37fa255f842eea05f1c946dd7ac0df84d1affc98..db43d3b52e5a0ab80e509d48bef22110110f0685 100644 (file)
@@ -3,6 +3,7 @@
 \r
   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
   Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
         cbnz   SAFE_XREG, 1f        ;\\r
         b      .                    ;// We should never get here\r
 \r
-#if defined(__clang__)\r
+#define _ASM_FUNC(Name, Section)    \\r
+  .global   Name                  ; \\r
+  .section  #Section, "ax"        ; \\r
+  .type     Name, %function       ; \\r
+  Name:\r
 \r
-// load x0 with _Data\r
-#define LoadConstant(_Data)              \\r
-  ldr  x0, 1f                          ; \\r
-  b    2f                              ; \\r
-.align(8)                              ; \\r
-1:                                       \\r
-  .8byte (_Data)                       ; \\r
-2:\r
+#define ASM_FUNC(Name)            _ASM_FUNC(ASM_PFX(Name), .text. ## Name)\r
 \r
-// load _Reg with _Data\r
-#define LoadConstantToReg(_Data, _Reg)    \\r
-  ldr  _Reg, 1f                         ; \\r
-  b    2f                               ; \\r
-.align(8)                               ; \\r
-1:                                        \\r
-  .8byte (_Data)                        ; \\r
-2:\r
+#define MOV32(Reg, Val)                   \\r
+  movz      Reg, (Val) >> 16, lsl #16   ; \\r
+  movk      Reg, (Val) & 0xffff\r
 \r
-#elif defined (__GNUC__)\r
-\r
-#define LoadConstant(Data) \\r
-  ldr  x0, =Data\r
-\r
-#define LoadConstantToReg(Data, Reg) \\r
-  ldr  Reg, =Data\r
-\r
-#endif // __GNUC__\r
+#define MOV64(Reg, Val)                             \\r
+  movz      Reg, (Val) >> 48, lsl #48             ; \\r
+  movk      Reg, ((Val) >> 32) & 0xffff, lsl #32  ; \\r
+  movk      Reg, ((Val) >> 16) & 0xffff, lsl #16  ; \\r
+  movk      Reg, (Val) & 0xffff\r
 \r
 #endif // __MACRO_IO_LIBV8_H__\r
-\r