]> git.ipfire.org Git - people/ms/linux.git/commitdiff
LoongArch: Add ELF-related definitions
authorHuacai Chen <chenhuacai@loongson.cn>
Tue, 31 May 2022 10:04:10 +0000 (18:04 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Fri, 3 Jun 2022 12:09:27 +0000 (20:09 +0800)
Add ELF-related definitions for LoongArch, including: EM_LOONGARCH,
KEXEC_ARCH_LOONGARCH, AUDIT_ARCH_LOONGARCH32, AUDIT_ARCH_LOONGARCH64
and NT_LOONGARCH_*.

Reviewed-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
include/uapi/linux/audit.h
include/uapi/linux/elf-em.h
include/uapi/linux/elf.h
include/uapi/linux/kexec.h
scripts/sorttable.c

index 8eda133ca4c1428d39dfc5f41a192805886a0273..7c1dc818b1d569adae807ffffd04971e7fd2f167 100644 (file)
@@ -439,6 +439,8 @@ enum {
 #define AUDIT_ARCH_UNICORE     (EM_UNICORE|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_X86_64      (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_XTENSA      (EM_XTENSA)
+#define AUDIT_ARCH_LOONGARCH32 (EM_LOONGARCH|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 
 #define AUDIT_PERM_EXEC                1
 #define AUDIT_PERM_WRITE       2
index f47e853546faa94bf520b7ce6d76c1edaec800c6..ef38c2bc5ab7a58ba03d309654051b25a2ac2933 100644 (file)
@@ -51,6 +51,7 @@
 #define EM_RISCV       243     /* RISC-V */
 #define EM_BPF         247     /* Linux BPF - in-kernel virtual machine */
 #define EM_CSKY                252     /* C-SKY */
+#define EM_LOONGARCH   258     /* LoongArch */
 #define EM_FRV         0x5441  /* Fujitsu FR-V */
 
 /*
index c4abd09c3da9b48a8cb7d5019b58fa4cdbbae720..2b9f5e9985e59363232f25a42ecca0df432d0734 100644 (file)
@@ -438,6 +438,11 @@ typedef struct elf64_shdr {
 #define NT_MIPS_DSP    0x800           /* MIPS DSP ASE registers */
 #define NT_MIPS_FP_MODE        0x801           /* MIPS floating-point mode */
 #define NT_MIPS_MSA    0x802           /* MIPS SIMD registers */
+#define NT_LOONGARCH_CPUCFG    0xa00   /* LoongArch CPU config registers */
+#define NT_LOONGARCH_CSR       0xa01   /* LoongArch control and status registers */
+#define NT_LOONGARCH_LSX       0xa02   /* LoongArch Loongson SIMD Extension registers */
+#define NT_LOONGARCH_LASX      0xa03   /* LoongArch Loongson Advanced SIMD Extension registers */
+#define NT_LOONGARCH_LBT       0xa04   /* LoongArch Loongson Binary Translation registers */
 
 /* Note types with note name "GNU" */
 #define NT_GNU_PROPERTY_TYPE_0 5
index fb7e2ef60825557e179e7287986d5fb5f6e3d291..981016e05cfa34a2f5229e26dc5bdf23b2f6da31 100644 (file)
@@ -43,6 +43,7 @@
 #define KEXEC_ARCH_MIPS    ( 8 << 16)
 #define KEXEC_ARCH_AARCH64 (183 << 16)
 #define KEXEC_ARCH_RISCV   (243 << 16)
+#define KEXEC_ARCH_LOONGARCH   (258 << 16)
 
 /* The artificial cap on the number of segments passed to kexec_load. */
 #define KEXEC_SEGMENT_MAX 16
index d00504c5f530da7fdfad9bcaca8836ecd8f8af76..fba40e99f3541aaf4be6acff96809ad91093bf9b 100644 (file)
 #define EM_RISCV       243
 #endif
 
+#ifndef EM_LOONGARCH
+#define EM_LOONGARCH   258
+#endif
+
 static uint32_t (*r)(const uint32_t *);
 static uint16_t (*r2)(const uint16_t *);
 static uint64_t (*r8)(const uint64_t *);
@@ -313,6 +317,7 @@ static int do_file(char const *const fname, void *addr)
        case EM_ARCOMPACT:
        case EM_ARCV2:
        case EM_ARM:
+       case EM_LOONGARCH:
        case EM_MICROBLAZE:
        case EM_MIPS:
        case EM_XTENSA: