^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __ASM_H8300_ELF_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __ASM_H8300_ELF_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * ELF register definitions..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/user.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) typedef unsigned long elf_greg_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) typedef elf_greg_t elf_gregset_t[ELF_NGREG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) typedef unsigned long elf_fpregset_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * This is used to ensure we don't load something for the wrong architecture.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define elf_check_arch(x) ((x)->e_machine == EM_H8_300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * These are used to set parameters in the core dumps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define ELF_CLASS ELFCLASS32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define ELF_DATA ELFDATA2MSB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define ELF_ARCH EM_H8_300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #if defined(CONFIG_CPU_H8300H)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define ELF_CORE_EFLAGS 0x810000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #if defined(CONFIG_CPU_H8S)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define ELF_CORE_EFLAGS 0x820000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define ELF_PLAT_INIT(_r) do { (_r)->er1 = 0; } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define ELF_EXEC_PAGESIZE 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) use of this is to invoke "./ld.so someprog" to test out a new version of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) the loader. We need to make sure that it is out of the way of the program
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) that it will "exec", and that there is sufficient room for the brk. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define ELF_ET_DYN_BASE 0xD0000000UL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* This yields a mask that user programs can use to figure out what
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) instruction set this cpu supports. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define ELF_HWCAP (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* This yields a string that ld.so will use to load implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) specific libraries for optimization. This is more specific in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) intent than poking at uname or /proc/cpuinfo. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define ELF_PLATFORM (NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define R_H8_NONE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define R_H8_DIR32 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define R_H8_DIR32_28 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define R_H8_DIR32_24 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define R_H8_DIR32_16 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define R_H8_DIR32U 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define R_H8_DIR32U_28 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define R_H8_DIR32U_24 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define R_H8_DIR32U_20 9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define R_H8_DIR32U_16 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define R_H8_DIR24 11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define R_H8_DIR24_20 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define R_H8_DIR24_16 13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define R_H8_DIR24U 14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define R_H8_DIR24U_20 15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define R_H8_DIR24U_16 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define R_H8_DIR16 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define R_H8_DIR16U 18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define R_H8_DIR16S_32 19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define R_H8_DIR16S_28 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define R_H8_DIR16S_24 21
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define R_H8_DIR16S_20 22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define R_H8_DIR16S 23
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define R_H8_DIR8 24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define R_H8_DIR8U 25
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define R_H8_DIR8Z_32 26
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define R_H8_DIR8Z_28 27
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define R_H8_DIR8Z_24 28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define R_H8_DIR8Z_20 29
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define R_H8_DIR8Z_16 30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define R_H8_PCREL16 31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define R_H8_PCREL8 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define R_H8_BPOS 33
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define R_H8_PCREL32 34
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define R_H8_GOT32O 35
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define R_H8_GOT16O 36
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #define R_H8_DIR16A8 59
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define R_H8_DIR16R8 60
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define R_H8_DIR24A8 61
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define R_H8_DIR24R8 62
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define R_H8_DIR32A16 63
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define R_H8_ABS32 65
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define R_H8_ABS32A16 127
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #endif