18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Port on Texas Instruments TMS320C6x architecture
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated
68c2ecf20Sopenharmony_ci *  Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef _ASM_C6X_ELF_H
98c2ecf20Sopenharmony_ci#define _ASM_C6X_ELF_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/*
128c2ecf20Sopenharmony_ci * ELF register definitions..
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_citypedef unsigned long elf_greg_t;
178c2ecf20Sopenharmony_citypedef unsigned long elf_fpreg_t;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define ELF_NGREG  58
208c2ecf20Sopenharmony_ci#define ELF_NFPREG 1
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_citypedef elf_greg_t elf_gregset_t[ELF_NGREG];
238c2ecf20Sopenharmony_citypedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/*
268c2ecf20Sopenharmony_ci * This is used to ensure we don't load something for the wrong architecture.
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci#define elf_check_arch(x) ((x)->e_machine == EM_TI_C6000)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define elf_check_fdpic(x) (1)
318c2ecf20Sopenharmony_ci#define elf_check_const_displacement(x) (0)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define ELF_FDPIC_PLAT_INIT(_regs, _exec_map, _interp_map, _dynamic_addr) \
348c2ecf20Sopenharmony_cido {								\
358c2ecf20Sopenharmony_ci	_regs->b4	= (_exec_map);				\
368c2ecf20Sopenharmony_ci	_regs->a6	= (_interp_map);			\
378c2ecf20Sopenharmony_ci	_regs->b6	= (_dynamic_addr);			\
388c2ecf20Sopenharmony_ci} while (0)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define ELF_FDPIC_CORE_EFLAGS	0
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define ELF_CORE_COPY_FPREGS(...) 0 /* No FPU regs to copy */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * These are used to set parameters in the core dumps.
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN__
488c2ecf20Sopenharmony_ci#define ELF_DATA	ELFDATA2LSB
498c2ecf20Sopenharmony_ci#else
508c2ecf20Sopenharmony_ci#define ELF_DATA	ELFDATA2MSB
518c2ecf20Sopenharmony_ci#endif
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define ELF_CLASS	ELFCLASS32
548c2ecf20Sopenharmony_ci#define ELF_ARCH	EM_TI_C6000
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/* Nothing for now. Need to setup DP... */
578c2ecf20Sopenharmony_ci#define ELF_PLAT_INIT(_r)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define USE_ELF_CORE_DUMP
608c2ecf20Sopenharmony_ci#define ELF_EXEC_PAGESIZE	4096
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define ELF_CORE_COPY_REGS(_dest, _regs)		\
638c2ecf20Sopenharmony_ci	memcpy((char *) &_dest, (char *) _regs,		\
648c2ecf20Sopenharmony_ci	sizeof(struct pt_regs));
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* This yields a mask that user programs can use to figure out what
678c2ecf20Sopenharmony_ci   instruction set this cpu supports.  */
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define ELF_HWCAP	(0)
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* This yields a string that ld.so will use to load implementation
728c2ecf20Sopenharmony_ci   specific libraries for optimization.  This is more specific in
738c2ecf20Sopenharmony_ci   intent than poking at uname or /proc/cpuinfo.  */
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define ELF_PLATFORM  (NULL)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* C6X specific section types */
788c2ecf20Sopenharmony_ci#define SHT_C6000_UNWIND	0x70000001
798c2ecf20Sopenharmony_ci#define SHT_C6000_PREEMPTMAP	0x70000002
808c2ecf20Sopenharmony_ci#define SHT_C6000_ATTRIBUTES	0x70000003
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* C6X specific DT_ tags */
838c2ecf20Sopenharmony_ci#define DT_C6000_DSBT_BASE	0x70000000
848c2ecf20Sopenharmony_ci#define DT_C6000_DSBT_SIZE	0x70000001
858c2ecf20Sopenharmony_ci#define DT_C6000_PREEMPTMAP	0x70000002
868c2ecf20Sopenharmony_ci#define DT_C6000_DSBT_INDEX	0x70000003
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/* C6X specific relocs */
898c2ecf20Sopenharmony_ci#define R_C6000_NONE		0
908c2ecf20Sopenharmony_ci#define R_C6000_ABS32		1
918c2ecf20Sopenharmony_ci#define R_C6000_ABS16		2
928c2ecf20Sopenharmony_ci#define R_C6000_ABS8		3
938c2ecf20Sopenharmony_ci#define R_C6000_PCR_S21		4
948c2ecf20Sopenharmony_ci#define R_C6000_PCR_S12		5
958c2ecf20Sopenharmony_ci#define R_C6000_PCR_S10		6
968c2ecf20Sopenharmony_ci#define R_C6000_PCR_S7		7
978c2ecf20Sopenharmony_ci#define R_C6000_ABS_S16		8
988c2ecf20Sopenharmony_ci#define R_C6000_ABS_L16		9
998c2ecf20Sopenharmony_ci#define R_C6000_ABS_H16		10
1008c2ecf20Sopenharmony_ci#define R_C6000_SBR_U15_B	11
1018c2ecf20Sopenharmony_ci#define R_C6000_SBR_U15_H	12
1028c2ecf20Sopenharmony_ci#define R_C6000_SBR_U15_W	13
1038c2ecf20Sopenharmony_ci#define R_C6000_SBR_S16		14
1048c2ecf20Sopenharmony_ci#define R_C6000_SBR_L16_B	15
1058c2ecf20Sopenharmony_ci#define R_C6000_SBR_L16_H	16
1068c2ecf20Sopenharmony_ci#define R_C6000_SBR_L16_W	17
1078c2ecf20Sopenharmony_ci#define R_C6000_SBR_H16_B	18
1088c2ecf20Sopenharmony_ci#define R_C6000_SBR_H16_H	19
1098c2ecf20Sopenharmony_ci#define R_C6000_SBR_H16_W	20
1108c2ecf20Sopenharmony_ci#define R_C6000_SBR_GOT_U15_W	21
1118c2ecf20Sopenharmony_ci#define R_C6000_SBR_GOT_L16_W	22
1128c2ecf20Sopenharmony_ci#define R_C6000_SBR_GOT_H16_W	23
1138c2ecf20Sopenharmony_ci#define R_C6000_DSBT_INDEX	24
1148c2ecf20Sopenharmony_ci#define R_C6000_PREL31		25
1158c2ecf20Sopenharmony_ci#define R_C6000_COPY		26
1168c2ecf20Sopenharmony_ci#define R_C6000_ALIGN		253
1178c2ecf20Sopenharmony_ci#define R_C6000_FPHEAD		254
1188c2ecf20Sopenharmony_ci#define R_C6000_NOCMP		255
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#endif /*_ASM_C6X_ELF_H */
121