diff mbox series

[2/9] PE: Add RISC-V definitions

Message ID 20181106175837.9083-3-agraf@suse.de
State Superseded
Headers show
Series Add RISC-V support | expand

Commit Message

Alexander Graf Nov. 6, 2018, 5:58 p.m. UTC
The PE format defines magic numbers as well as relocation identifiers for
RISC-V. Add them to our include file, so we can make use of them.

Signed-off-by: Alexander Graf <agraf@suse.de>

---
 include/grub/efi/pe32.h | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.12.3


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Leif Lindholm Nov. 7, 2018, 3:48 p.m. UTC | #1
On Tue, Nov 06, 2018 at 06:58:30PM +0100, Alexander Graf wrote:
> The PE format defines magic numbers as well as relocation identifiers for

> RISC-V. Add them to our include file, so we can make use of them.

> 

> Signed-off-by: Alexander Graf <agraf@suse.de>


This patch matches my interpretation of
https://docs.microsoft.com/en-gb/windows/desktop/Debug/pe-format

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> ---

>  include/grub/efi/pe32.h | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h

> index 7d44732d2..d1359eb66 100644

> --- a/include/grub/efi/pe32.h

> +++ b/include/grub/efi/pe32.h

> @@ -70,6 +70,8 @@ struct grub_pe32_coff_header

>  #define GRUB_PE32_MACHINE_X86_64		0x8664

>  #define GRUB_PE32_MACHINE_ARMTHUMB_MIXED	0x01c2

>  #define GRUB_PE32_MACHINE_ARM64			0xAA64

> +#define GRUB_PE32_MACHINE_RISCV32		0x5032

> +#define GRUB_PE32_MACHINE_RISCV64		0x5064

>  

>  #define GRUB_PE32_RELOCS_STRIPPED		0x0001

>  #define GRUB_PE32_EXECUTABLE_IMAGE		0x0002

> @@ -281,9 +283,12 @@ struct grub_pe32_fixup_block

>  #define GRUB_PE32_REL_BASED_HIGHADJ	4

>  #define GRUB_PE32_REL_BASED_MIPS_JMPADDR 5

>  #define GRUB_PE32_REL_BASED_ARM_MOV32A  5

> +#define GRUB_PE32_REL_BASED_RISCV_HI20	5

>  #define GRUB_PE32_REL_BASED_SECTION	6

>  #define GRUB_PE32_REL_BASED_REL		7

>  #define GRUB_PE32_REL_BASED_ARM_MOV32T  7

> +#define GRUB_PE32_REL_BASED_RISCV_LOW12I 7

> +#define GRUB_PE32_REL_BASED_RISCV_LOW12S 8

>  #define GRUB_PE32_REL_BASED_IA64_IMM64	9

>  #define GRUB_PE32_REL_BASED_DIR64	10

>  #define GRUB_PE32_REL_BASED_HIGH3ADJ	11

> -- 

> 2.12.3

> 


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Alistair Francis Nov. 8, 2018, 10:48 p.m. UTC | #2
On Tue, 2018-11-06 at 18:58 +0100, Alexander Graf wrote:
> The PE format defines magic numbers as well as relocation identifiers

> for

> RISC-V. Add them to our include file, so we can make use of them.

> 

> Signed-off-by: Alexander Graf <agraf@suse.de>


Reviewed-by: Alistair Francis <alistair.francis@wdc.com>


Alistair

> ---

>  include/grub/efi/pe32.h | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h

> index 7d44732d2..d1359eb66 100644

> --- a/include/grub/efi/pe32.h

> +++ b/include/grub/efi/pe32.h

> @@ -70,6 +70,8 @@ struct grub_pe32_coff_header

>  #define GRUB_PE32_MACHINE_X86_64		0x8664

>  #define GRUB_PE32_MACHINE_ARMTHUMB_MIXED	0x01c2

>  #define GRUB_PE32_MACHINE_ARM64			0xAA64

> +#define GRUB_PE32_MACHINE_RISCV32		0x5032

> +#define GRUB_PE32_MACHINE_RISCV64		0x5064

>  

>  #define GRUB_PE32_RELOCS_STRIPPED		0x0001

>  #define GRUB_PE32_EXECUTABLE_IMAGE		0x0002

> @@ -281,9 +283,12 @@ struct grub_pe32_fixup_block

>  #define GRUB_PE32_REL_BASED_HIGHADJ	4

>  #define GRUB_PE32_REL_BASED_MIPS_JMPADDR 5

>  #define GRUB_PE32_REL_BASED_ARM_MOV32A  5

> +#define GRUB_PE32_REL_BASED_RISCV_HI20	5

>  #define GRUB_PE32_REL_BASED_SECTION	6

>  #define GRUB_PE32_REL_BASED_REL		7

>  #define GRUB_PE32_REL_BASED_ARM_MOV32T  7

> +#define GRUB_PE32_REL_BASED_RISCV_LOW12I 7

> +#define GRUB_PE32_REL_BASED_RISCV_LOW12S 8

>  #define GRUB_PE32_REL_BASED_IA64_IMM64	9

>  #define GRUB_PE32_REL_BASED_DIR64	10

>  #define GRUB_PE32_REL_BASED_HIGH3ADJ	11

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
diff mbox series

Patch

diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
index 7d44732d2..d1359eb66 100644
--- a/include/grub/efi/pe32.h
+++ b/include/grub/efi/pe32.h
@@ -70,6 +70,8 @@  struct grub_pe32_coff_header
 #define GRUB_PE32_MACHINE_X86_64		0x8664
 #define GRUB_PE32_MACHINE_ARMTHUMB_MIXED	0x01c2
 #define GRUB_PE32_MACHINE_ARM64			0xAA64
+#define GRUB_PE32_MACHINE_RISCV32		0x5032
+#define GRUB_PE32_MACHINE_RISCV64		0x5064
 
 #define GRUB_PE32_RELOCS_STRIPPED		0x0001
 #define GRUB_PE32_EXECUTABLE_IMAGE		0x0002
@@ -281,9 +283,12 @@  struct grub_pe32_fixup_block
 #define GRUB_PE32_REL_BASED_HIGHADJ	4
 #define GRUB_PE32_REL_BASED_MIPS_JMPADDR 5
 #define GRUB_PE32_REL_BASED_ARM_MOV32A  5
+#define GRUB_PE32_REL_BASED_RISCV_HI20	5
 #define GRUB_PE32_REL_BASED_SECTION	6
 #define GRUB_PE32_REL_BASED_REL		7
 #define GRUB_PE32_REL_BASED_ARM_MOV32T  7
+#define GRUB_PE32_REL_BASED_RISCV_LOW12I 7
+#define GRUB_PE32_REL_BASED_RISCV_LOW12S 8
 #define GRUB_PE32_REL_BASED_IA64_IMM64	9
 #define GRUB_PE32_REL_BASED_DIR64	10
 #define GRUB_PE32_REL_BASED_HIGH3ADJ	11