]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/PeCoffLib.h
BaseTools: BaseTools changes for RISC-V platform.
[mirror_edk2.git] / BaseTools / Source / C / Common / PeCoffLib.h
index 2fb2265e80f0d5cfdb674309ce6ec4ebce2f24c1..dd38f442f952ed2ca7a05752d08eaacf89558708 100644 (file)
@@ -2,6 +2,7 @@
   Function prototypes and defines on Memory Only PE COFF loader\r
 \r
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Portion Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 #define IMAGE_ERROR_FAILED_RELOCATION            9\r
 #define IMAGE_ERROR_FAILED_ICACHE_FLUSH          10\r
 \r
+//\r
+// Macro definitions for RISC-V architecture.\r
+//\r
+#define RV_X(x, s, n) (((x) >> (s)) & ((1<<(n))-1))\r
+#define RISCV_IMM_BITS 12\r
+#define RISCV_IMM_REACH (1LL<<RISCV_IMM_BITS)\r
+#define RISCV_CONST_HIGH_PART(VALUE) \\r
+  (((VALUE) + (RISCV_IMM_REACH/2)) & ~(RISCV_IMM_REACH-1))\r
 \r
 //\r
 // PE/COFF Loader Read Function passed in by caller\r