arch/mips/include/asm/elf.h

Source file repositories/reference/linux-study-clean/arch/mips/include/asm/elf.h

File Facts

System
Linux kernel
Corpus path
arch/mips/include/asm/elf.h
Extension
.h
Size
15585 bytes
Lines
523
Domain
Architecture Layer
Bucket
arch/mips
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mips_elf_abiflags_v0 {
	uint16_t version;	/* Version of flags structure */
	uint8_t isa_level;	/* The level of the ISA: 1-5, 32, 64 */
	uint8_t isa_rev;	/* The revision of ISA: 0 for MIPS V and below,
				   1-n otherwise */
	uint8_t gpr_size;	/* The size of general purpose registers */
	uint8_t cpr1_size;	/* The size of co-processor 1 registers */
	uint8_t cpr2_size;	/* The size of co-processor 2 registers */
	uint8_t fp_abi;		/* The floating-point ABI */
	uint32_t isa_ext;	/* Mask of processor-specific extensions */
	uint32_t ases;		/* Mask of ASEs used */
	uint32_t flags1;	/* Mask of general flags */
	uint32_t flags2;
};

/* ELF register definitions */
#define ELF_NGREG	45
#define ELF_NFPREG	33

typedef unsigned long elf_greg_t;
typedef elf_greg_t elf_gregset_t[ELF_NGREG];

typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];

void mips_dump_regs32(u32 *uregs, const struct pt_regs *regs);
void mips_dump_regs64(u64 *uregs, const struct pt_regs *regs);

#ifdef CONFIG_32BIT
/*
 * This is used to ensure we don't load something for the wrong architecture.
 */
#define elf_check_arch elf32_check_arch

/*
 * These are used to set parameters in the core dumps.
 */
#define ELF_CLASS	ELFCLASS32

#define ELF_CORE_COPY_REGS(dest, regs) \
	mips_dump_regs32((u32 *)&(dest), (regs));

#endif /* CONFIG_32BIT */

#ifdef CONFIG_64BIT
/*
 * This is used to ensure we don't load something for the wrong architecture.
 */
#define elf_check_arch elf64_check_arch
#define compat_elf_check_arch elf32_check_arch

/*
 * These are used to set parameters in the core dumps.
 */
#define ELF_CLASS	ELFCLASS64

#define ELF_CORE_COPY_REGS(dest, regs) \
	mips_dump_regs64((u64 *)&(dest), (regs));

#endif /* CONFIG_64BIT */

/*
 * These are used to set parameters in the core dumps.
 */
#ifdef __MIPSEB__
#define ELF_DATA	ELFDATA2MSB
#elif defined(__MIPSEL__)
#define ELF_DATA	ELFDATA2LSB
#endif
#define ELF_ARCH	EM_MIPS

/*
 * In order to be sure that we don't attempt to execute an O32 binary which
 * requires 64 bit FP (FR=1) on a system which does not support it we refuse
 * to execute any binary which has bits specified by the following macro set
 * in its ELF header flags.
 */
#ifdef CONFIG_MIPS_O32_FP64_SUPPORT
# define __MIPS_O32_FP64_MUST_BE_ZERO	0
#else
# define __MIPS_O32_FP64_MUST_BE_ZERO	EF_MIPS_FP64
#endif

#define mips_elf_check_machine(x) ((x)->e_machine == EM_MIPS)

#define vmcore_elf32_check_arch mips_elf_check_machine
#define vmcore_elf64_check_arch mips_elf_check_machine

/*
 * Return non-zero if HDR identifies an o32 or n32 ELF binary.

Annotation

Implementation Notes