提交 b6d579b3 编写于 作者: H Huacai Chen 提交者: Hongchen Zhang

LoongArch: Add ELF-related definitions

mainline inclusion
from mainline-v5.19-rc1
commit 08145b08
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5OHOB
CVE: NA

--------------------------------

Add ELF-related definitions for LoongArch, including: EM_LOONGARCH,
KEXEC_ARCH_LOONGARCH, AUDIT_ARCH_LOONGARCH32, AUDIT_ARCH_LOONGARCH64
and NT_LOONGARCH_*.
Reviewed-by: NWANG Xuerui <git@xen0n.name>
Reviewed-by: NJiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: NHuacai Chen <chenhuacai@loongson.cn>
上级 8bd5550c
...@@ -434,6 +434,8 @@ enum { ...@@ -434,6 +434,8 @@ enum {
#define AUDIT_ARCH_UNICORE (EM_UNICORE|__AUDIT_ARCH_LE) #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_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
#define AUDIT_ARCH_XTENSA (EM_XTENSA) #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_ARCH_SW64 (EM_SW64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_SW64 (EM_SW64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
#define AUDIT_PERM_EXEC 1 #define AUDIT_PERM_EXEC 1
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#define EM_RISCV 243 /* RISC-V */ #define EM_RISCV 243 /* RISC-V */
#define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ #define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */
#define EM_CSKY 252 /* C-SKY */ #define EM_CSKY 252 /* C-SKY */
#define EM_LOONGARCH 258 /* LoongArch */
#define EM_FRV 0x5441 /* Fujitsu FR-V */ #define EM_FRV 0x5441 /* Fujitsu FR-V */
/* /*
......
...@@ -431,6 +431,11 @@ typedef struct elf64_shdr { ...@@ -431,6 +431,11 @@ typedef struct elf64_shdr {
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */ #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */ #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" */ /* Note types with note name "GNU" */
#define NT_GNU_PROPERTY_TYPE_0 5 #define NT_GNU_PROPERTY_TYPE_0 5
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#define KEXEC_ARCH_MIPS_LE (10 << 16) #define KEXEC_ARCH_MIPS_LE (10 << 16)
#define KEXEC_ARCH_MIPS ( 8 << 16) #define KEXEC_ARCH_MIPS ( 8 << 16)
#define KEXEC_ARCH_AARCH64 (183 << 16) #define KEXEC_ARCH_AARCH64 (183 << 16)
#define KEXEC_ARCH_LOONGARCH (258 << 16)
#define KEXEC_ARCH_SW64 (0x9916UL << 16) #define KEXEC_ARCH_SW64 (0x9916UL << 16)
/* The artificial cap on the number of segments passed to kexec_load. */ /* The artificial cap on the number of segments passed to kexec_load. */
......
...@@ -54,6 +54,10 @@ ...@@ -54,6 +54,10 @@
#define EM_ARCV2 195 #define EM_ARCV2 195
#endif #endif
#ifndef EM_LOONGARCH
#define EM_LOONGARCH 258
#endif
static uint32_t (*r)(const uint32_t *); static uint32_t (*r)(const uint32_t *);
static uint16_t (*r2)(const uint16_t *); static uint16_t (*r2)(const uint16_t *);
static uint64_t (*r8)(const uint64_t *); static uint64_t (*r8)(const uint64_t *);
...@@ -347,6 +351,7 @@ static int do_file(char const *const fname, void *addr) ...@@ -347,6 +351,7 @@ static int do_file(char const *const fname, void *addr)
break; break;
case EM_ARCOMPACT: case EM_ARCOMPACT:
case EM_ARCV2: case EM_ARCV2:
case EM_LOONGARCH:
case EM_MICROBLAZE: case EM_MICROBLAZE:
case EM_MIPS: case EM_MIPS:
case EM_XTENSA: case EM_XTENSA:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册