linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Subject: [PATCH 1/1] sbsigntool: add support for RISC-V images
Date: Tue,  5 Oct 2021 10:37:57 +0200	[thread overview]
Message-ID: <20211005083757.9201-1-heinrich.schuchardt@canonical.com> (raw)

The UEFI 2.9 specification defines:

    EFI_IMAGE_MACHINE_RISCV32 = 0x5032
    EFI_IMAGE_MACHINE_RISCV64 = 0x5064

The same values can be found in the PE-COFF specification. Cf.
https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types

    IMAGE_FILE_MACHINE_RISCV32 = 0x5032
    IMAGE_FILE_MACHINE_RISCV64 = 0x5064

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 src/coff/pe.h | 2 ++
 src/image.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/coff/pe.h b/src/coff/pe.h
index 0d1036e..a73a2c0 100644
--- a/src/coff/pe.h
+++ b/src/coff/pe.h
@@ -143,6 +143,8 @@
 #define IMAGE_FILE_MACHINE_R10000            0x0168
 #define IMAGE_FILE_MACHINE_R3000             0x0162
 #define IMAGE_FILE_MACHINE_R4000             0x0166
+#define IMAGE_FILE_MACHINE_RISCV32           0x5032
+#define IMAGE_FILE_MACHINE_RISCV64           0x5064
 #define IMAGE_FILE_MACHINE_SH3               0x01a2
 #define IMAGE_FILE_MACHINE_SH3DSP            0x01a3
 #define IMAGE_FILE_MACHINE_SH3E              0x01a4
diff --git a/src/image.c b/src/image.c
index 3ada37b..b14a30d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -239,10 +239,12 @@ static int image_pecoff_parse(struct image *image)
 	switch (magic) {
 	case IMAGE_FILE_MACHINE_AMD64:
 	case IMAGE_FILE_MACHINE_AARCH64:
+	case IMAGE_FILE_MACHINE_RISCV64:
 		rc = image_pecoff_parse_64(image);
 		break;
 	case IMAGE_FILE_MACHINE_I386:
 	case IMAGE_FILE_MACHINE_THUMB:
+	case IMAGE_FILE_MACHINE_RISCV32:
 		rc = image_pecoff_parse_32(image);
 		break;
 	default:
-- 
2.31.1


                 reply	other threads:[~2021-10-05  8:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211005083757.9201-1-heinrich.schuchardt@canonical.com \
    --to=heinrich.schuchardt@canonical.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).