1 /* elf.h: FR-V ELF definitions
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-m68knommu/elf.h
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
15 #include <linux/config.h>
16 #include <asm/ptrace.h>
22 * ELF header e_flags defines.
24 #define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */
25 #define EF_FRV_GPR32 0x00000001 /* Only uses GR on 32-register */
26 #define EF_FRV_GPR64 0x00000002 /* Only uses GR on 64-register */
27 #define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */
28 #define EF_FRV_FPR32 0x00000004 /* Only uses FR on 32-register */
29 #define EF_FRV_FPR64 0x00000008 /* Only uses FR on 64-register */
30 #define EF_FRV_FPR_NONE 0x0000000C /* Uses software floating-point */
31 #define EF_FRV_DWORD_MASK 0x00000030 /* mask for dword support */
32 #define EF_FRV_DWORD_YES 0x00000010 /* Assumes stack aligned to 8-byte boundaries. */
33 #define EF_FRV_DWORD_NO 0x00000020 /* Assumes stack aligned to 4-byte boundaries. */
34 #define EF_FRV_DOUBLE 0x00000040 /* Uses double instructions. */
35 #define EF_FRV_MEDIA 0x00000080 /* Uses media instructions. */
36 #define EF_FRV_PIC 0x00000100 /* Uses position independent code. */
37 #define EF_FRV_NON_PIC_RELOCS 0x00000200 /* Does not use position Independent code. */
38 #define EF_FRV_MULADD 0x00000400 /* -mmuladd */
39 #define EF_FRV_BIGPIC 0x00000800 /* -fPIC */
40 #define EF_FRV_LIBPIC 0x00001000 /* -mlibrary-pic */
41 #define EF_FRV_G0 0x00002000 /* -G 0, no small data ptr */
42 #define EF_FRV_NOPACK 0x00004000 /* -mnopack */
43 #define EF_FRV_FDPIC 0x00008000 /* -mfdpic */
44 #define EF_FRV_CPU_MASK 0xff000000 /* specific cpu bits */
45 #define EF_FRV_CPU_GENERIC 0x00000000 /* Set CPU type is FR-V */
46 #define EF_FRV_CPU_FR500 0x01000000 /* Set CPU type is FR500 */
47 #define EF_FRV_CPU_FR300 0x02000000 /* Set CPU type is FR300 */
48 #define EF_FRV_CPU_SIMPLE 0x03000000 /* SIMPLE */
49 #define EF_FRV_CPU_TOMCAT 0x04000000 /* Tomcat, FR500 prototype */
50 #define EF_FRV_CPU_FR400 0x05000000 /* Set CPU type is FR400 */
51 #define EF_FRV_CPU_FR550 0x06000000 /* Set CPU type is FR550 */
52 #define EF_FRV_CPU_FR405 0x07000000 /* Set CPU type is FR405 */
53 #define EF_FRV_CPU_FR450 0x08000000 /* Set CPU type is FR450 */
56 * FR-V ELF relocation types
61 * ELF register definitions..
63 typedef unsigned long elf_greg_t;
65 #define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
66 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
68 typedef struct fpmedia_struct elf_fpregset_t;
71 * This is used to ensure we don't load something for the wrong architecture.
73 extern int elf_check_arch(const struct elf32_hdr *hdr);
75 #define elf_check_fdpic(x) ((x)->e_flags & EF_FRV_FDPIC && !((x)->e_flags & EF_FRV_NON_PIC_RELOCS))
76 #define elf_check_const_displacement(x) ((x)->e_flags & EF_FRV_PIC)
79 * These are used to set parameters in the core dumps.
81 #define ELF_CLASS ELFCLASS32
82 #define ELF_DATA ELFDATA2MSB
83 #define ELF_ARCH EM_FRV
85 #define ELF_PLAT_INIT(_r) \
87 __kernel_frame0_ptr->gr16 = 0; \
88 __kernel_frame0_ptr->gr17 = 0; \
89 __kernel_frame0_ptr->gr18 = 0; \
90 __kernel_frame0_ptr->gr19 = 0; \
91 __kernel_frame0_ptr->gr20 = 0; \
92 __kernel_frame0_ptr->gr21 = 0; \
93 __kernel_frame0_ptr->gr22 = 0; \
94 __kernel_frame0_ptr->gr23 = 0; \
95 __kernel_frame0_ptr->gr24 = 0; \
96 __kernel_frame0_ptr->gr25 = 0; \
97 __kernel_frame0_ptr->gr26 = 0; \
98 __kernel_frame0_ptr->gr27 = 0; \
99 __kernel_frame0_ptr->gr29 = 0; \
102 #define ELF_FDPIC_PLAT_INIT(_regs, _exec_map_addr, _interp_map_addr, _dynamic_addr) \
104 __kernel_frame0_ptr->gr16 = _exec_map_addr; \
105 __kernel_frame0_ptr->gr17 = _interp_map_addr; \
106 __kernel_frame0_ptr->gr18 = _dynamic_addr; \
107 __kernel_frame0_ptr->gr19 = 0; \
108 __kernel_frame0_ptr->gr20 = 0; \
109 __kernel_frame0_ptr->gr21 = 0; \
110 __kernel_frame0_ptr->gr22 = 0; \
111 __kernel_frame0_ptr->gr23 = 0; \
112 __kernel_frame0_ptr->gr24 = 0; \
113 __kernel_frame0_ptr->gr25 = 0; \
114 __kernel_frame0_ptr->gr26 = 0; \
115 __kernel_frame0_ptr->gr27 = 0; \
116 __kernel_frame0_ptr->gr29 = 0; \
119 #define USE_ELF_CORE_DUMP
120 #define ELF_EXEC_PAGESIZE 16384
122 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
123 use of this is to invoke "./ld.so someprog" to test out a new version of
124 the loader. We need to make sure that it is out of the way of the program
125 that it will "exec", and that there is sufficient room for the brk. */
127 #define ELF_ET_DYN_BASE 0x08000000UL
129 #define ELF_CORE_COPY_REGS(pr_reg, regs) \
130 memcpy(&pr_reg[0], ®s->sp, 31 * sizeof(uint32_t));
132 /* This yields a mask that user programs can use to figure out what
133 instruction set this cpu supports. */
135 #define ELF_HWCAP (0)
137 /* This yields a string that ld.so will use to load implementation
138 specific libraries for optimization. This is more specific in
139 intent than poking at uname or /proc/cpuinfo. */
141 #define ELF_PLATFORM (NULL)
144 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)