]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
MdePkg/BasePeCoff: Add RISC-V PE/Coff related code.
[mirror_edk2.git] / MdePkg / Library / BasePeCoffLib / BasePeCoffLibInternals.h
index b74277f3e8117d1490b79e823959d5f7d0c623c7..3ee56e0e5f56ea21a1de48bdd3103dbd2e2655f8 100644 (file)
@@ -2,6 +2,7 @@
   Declaration of internal functions in PE/COFF Lib.\r
 \r
   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 #include <Library/PeCoffExtraActionLib.h>\r
 #include <IndustryStandard/PeImage.h>\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
 /**\r