18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_H8300_ELF_H
38c2ecf20Sopenharmony_ci#define __ASM_H8300_ELF_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * ELF register definitions..
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
108c2ecf20Sopenharmony_ci#include <asm/user.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_citypedef unsigned long elf_greg_t;
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
158c2ecf20Sopenharmony_citypedef elf_greg_t elf_gregset_t[ELF_NGREG];
168c2ecf20Sopenharmony_citypedef unsigned long elf_fpregset_t;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/*
198c2ecf20Sopenharmony_ci * This is used to ensure we don't load something for the wrong architecture.
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci#define elf_check_arch(x) ((x)->e_machine == EM_H8_300)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/*
248c2ecf20Sopenharmony_ci * These are used to set parameters in the core dumps.
258c2ecf20Sopenharmony_ci */
268c2ecf20Sopenharmony_ci#define ELF_CLASS	ELFCLASS32
278c2ecf20Sopenharmony_ci#define ELF_DATA	ELFDATA2MSB
288c2ecf20Sopenharmony_ci#define ELF_ARCH	EM_H8_300
298c2ecf20Sopenharmony_ci#if defined(CONFIG_CPU_H8300H)
308c2ecf20Sopenharmony_ci#define ELF_CORE_EFLAGS 0x810000
318c2ecf20Sopenharmony_ci#endif
328c2ecf20Sopenharmony_ci#if defined(CONFIG_CPU_H8S)
338c2ecf20Sopenharmony_ci#define ELF_CORE_EFLAGS 0x820000
348c2ecf20Sopenharmony_ci#endif
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define ELF_PLAT_INIT(_r) do { (_r)->er1 = 0; } while (0)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define ELF_EXEC_PAGESIZE	4096
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
418c2ecf20Sopenharmony_ci   use of this is to invoke "./ld.so someprog" to test out a new version of
428c2ecf20Sopenharmony_ci   the loader.  We need to make sure that it is out of the way of the program
438c2ecf20Sopenharmony_ci   that it will "exec", and that there is sufficient room for the brk.  */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define ELF_ET_DYN_BASE         0xD0000000UL
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* This yields a mask that user programs can use to figure out what
488c2ecf20Sopenharmony_ci   instruction set this cpu supports.  */
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define ELF_HWCAP	(0)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* This yields a string that ld.so will use to load implementation
538c2ecf20Sopenharmony_ci   specific libraries for optimization.  This is more specific in
548c2ecf20Sopenharmony_ci   intent than poking at uname or /proc/cpuinfo.  */
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define ELF_PLATFORM  (NULL)
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define R_H8_NONE       0
598c2ecf20Sopenharmony_ci#define R_H8_DIR32      1
608c2ecf20Sopenharmony_ci#define R_H8_DIR32_28   2
618c2ecf20Sopenharmony_ci#define R_H8_DIR32_24   3
628c2ecf20Sopenharmony_ci#define R_H8_DIR32_16   4
638c2ecf20Sopenharmony_ci#define R_H8_DIR32U     6
648c2ecf20Sopenharmony_ci#define R_H8_DIR32U_28  7
658c2ecf20Sopenharmony_ci#define R_H8_DIR32U_24  8
668c2ecf20Sopenharmony_ci#define R_H8_DIR32U_20  9
678c2ecf20Sopenharmony_ci#define R_H8_DIR32U_16 10
688c2ecf20Sopenharmony_ci#define R_H8_DIR24     11
698c2ecf20Sopenharmony_ci#define R_H8_DIR24_20  12
708c2ecf20Sopenharmony_ci#define R_H8_DIR24_16  13
718c2ecf20Sopenharmony_ci#define R_H8_DIR24U    14
728c2ecf20Sopenharmony_ci#define R_H8_DIR24U_20 15
738c2ecf20Sopenharmony_ci#define R_H8_DIR24U_16 16
748c2ecf20Sopenharmony_ci#define R_H8_DIR16     17
758c2ecf20Sopenharmony_ci#define R_H8_DIR16U    18
768c2ecf20Sopenharmony_ci#define R_H8_DIR16S_32 19
778c2ecf20Sopenharmony_ci#define R_H8_DIR16S_28 20
788c2ecf20Sopenharmony_ci#define R_H8_DIR16S_24 21
798c2ecf20Sopenharmony_ci#define R_H8_DIR16S_20 22
808c2ecf20Sopenharmony_ci#define R_H8_DIR16S    23
818c2ecf20Sopenharmony_ci#define R_H8_DIR8      24
828c2ecf20Sopenharmony_ci#define R_H8_DIR8U     25
838c2ecf20Sopenharmony_ci#define R_H8_DIR8Z_32  26
848c2ecf20Sopenharmony_ci#define R_H8_DIR8Z_28  27
858c2ecf20Sopenharmony_ci#define R_H8_DIR8Z_24  28
868c2ecf20Sopenharmony_ci#define R_H8_DIR8Z_20  29
878c2ecf20Sopenharmony_ci#define R_H8_DIR8Z_16  30
888c2ecf20Sopenharmony_ci#define R_H8_PCREL16   31
898c2ecf20Sopenharmony_ci#define R_H8_PCREL8    32
908c2ecf20Sopenharmony_ci#define R_H8_BPOS      33
918c2ecf20Sopenharmony_ci#define R_H8_PCREL32   34
928c2ecf20Sopenharmony_ci#define R_H8_GOT32O    35
938c2ecf20Sopenharmony_ci#define R_H8_GOT16O    36
948c2ecf20Sopenharmony_ci#define R_H8_DIR16A8   59
958c2ecf20Sopenharmony_ci#define R_H8_DIR16R8   60
968c2ecf20Sopenharmony_ci#define R_H8_DIR24A8   61
978c2ecf20Sopenharmony_ci#define R_H8_DIR24R8   62
988c2ecf20Sopenharmony_ci#define R_H8_DIR32A16  63
998c2ecf20Sopenharmony_ci#define R_H8_ABS32     65
1008c2ecf20Sopenharmony_ci#define R_H8_ABS32A16 127
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#endif
103