summaryrefslogtreecommitdiff
path: root/arch/frv/include/asm/elf.h
blob: 7279ec07d62e32007f91a01bfe58a20014283a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* elf.h: FR-V ELF definitions
 *
 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 * - Derived from include/asm-m68knommu/elf.h
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */
#ifndef __ASM_ELF_H
#define __ASM_ELF_H

#include <asm/ptrace.h>
#include <asm/user.h>

struct elf32_hdr;

/*
 * ELF header e_flags defines.
 */
#define EF_FRV_GPR_MASK         0x00000003 /* mask for # of gprs */
#define EF_FRV_GPR32		0x00000001 /* Only uses GR on 32-register */
#define EF_FRV_GPR64		0x00000002 /* Only uses GR on 64-register */
#define EF_FRV_FPR_MASK         0x0000000c /* mask for # of fprs */
#define EF_FRV_FPR32		0x00000004 /* Only uses FR on 32-register */
#define EF_FRV_FPR64		0x00000008 /* Only uses FR on 64-register */
#define EF_FRV_FPR_NONE		0x0000000C /* Uses software floating-point */
#define EF_FRV_DWORD_MASK       0x00000030 /* mask for dword support */
#define EF_FRV_DWORD_YES	0x00000010 /* Assumes stack aligned to 8-byte boundaries. */
#define EF_FRV_DWORD_NO		0x00000020 /* Assumes stack aligned to 4-byte boundaries. */
#define EF_FRV_DOUBLE		0x00000040 /* Uses double instructions. */
#define EF_FRV_MEDIA		0x00000080 /* Uses media instructions. */
#define EF_FRV_PIC		0x00000100 /* Uses position independent code. */
#define EF_FRV_NON_PIC_RELOCS	0x00000200 /* Does not use position Independent code. */
#define EF_FRV_MULADD           0x00000400 /* -mmuladd */
#define EF_FRV_BIGPIC           0x00000800 /* -fPIC */
#define EF_FRV_LIBPIC           0x00001000 /* -mlibrary-pic */
#define EF_FRV_G0               0x00002000 /* -G 0, no small data ptr */
#define EF_FRV_NOPACK           0x00004000 /* -mnopack */
#define EF_FRV_FDPIC            0x00008000 /* -mfdpic */
#define EF_FRV_CPU_MASK         0xff000000 /* specific cpu bits */
#define EF_FRV_CPU_GENERIC	0x00000000 /* Set CPU type is FR-V */
#define EF_FRV_CPU_FR500	0x01000000 /* Set CPU type is FR500 */
#define EF_FRV_CPU_FR300	0x02000000 /* Set CPU type is FR300 */
#define EF_FRV_CPU_SIMPLE       0x03000000 /* SIMPLE */
#define EF_FRV_CPU_TOMCAT       0x04000000 /* Tomcat, FR500 prototype */
#define EF_FRV_CPU_FR400	0x05000000 /* Set CPU type is FR400 */
#define EF_FRV_CPU_FR550        0x06000000 /* Set CPU type is FR550 */
#define EF_FRV_CPU_FR405	0x07000000 /* Set CPU type is FR405 */
#define EF_FRV_CPU_FR450	0x08000000 /* Set CPU type is FR450 */

/*
 * FR-V ELF relocation types
 */


/*
 * ELF register definitions..
 */
typedef unsigned long elf_greg_t;

#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];

typedef struct user_fpmedia_regs elf_fpregset_t;

/*
 * This is used to ensure we don't load something for the wrong architecture.
 */
extern int elf_check_arch(const struct elf32_hdr *hdr);

#define elf_check_fdpic(x) ((x)->e_flags & EF_FRV_FDPIC && !((x)->e_flags & EF_FRV_NON_PIC_RELOCS))
#define elf_check_const_displacement(x) ((x)->e_flags & EF_FRV_PIC)

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

#define ELF_PLAT_INIT(_r)			\
do {						\
	__kernel_frame0_ptr->gr16	= 0;	\
	__kernel_frame0_ptr->gr17	= 0;	\
	__kernel_frame0_ptr->gr18	= 0;	\
	__kernel_frame0_ptr->gr19	= 0;	\
	__kernel_frame0_ptr->gr20	= 0;	\
	__kernel_frame0_ptr->gr21	= 0;	\
	__kernel_frame0_ptr->gr22	= 0;	\
	__kernel_frame0_ptr->gr23	= 0;	\
	__kernel_frame0_ptr->gr24	= 0;	\
	__kernel_frame0_ptr->gr25	= 0;	\
	__kernel_frame0_ptr->gr26	= 0;	\
	__kernel_frame0_ptr->gr27	= 0;	\
	__kernel_frame0_ptr->gr29	= 0;	\
} while(0)

#define ELF_FDPIC_PLAT_INIT(_regs, _exec_map_addr, _interp_map_addr, _dynamic_addr)	\
do {											\
	__kernel_frame0_ptr->gr16	= _exec_map_addr;				\
	__kernel_frame0_ptr->gr17	= _interp_map_addr;				\
	__kernel_frame0_ptr->gr18	= _dynamic_addr;				\
	__kernel_frame0_ptr->gr19	= 0;						\
	__kernel_frame0_ptr->gr20	= 0;						\
	__kernel_frame0_ptr->gr21	= 0;						\
	__kernel_frame0_ptr->gr22	= 0;						\
	__kernel_frame0_ptr->gr23	= 0;						\
	__kernel_frame0_ptr->gr24	= 0;						\
	__kernel_frame0_ptr->gr25	= 0;						\
	__kernel_frame0_ptr->gr26	= 0;						\
	__kernel_frame0_ptr->gr27	= 0;						\
	__kernel_frame0_ptr->gr29	= 0;						\
} while(0)

#define USE_ELF_CORE_DUMP
#define ELF_FDPIC_CORE_EFLAGS	EF_FRV_FDPIC
#define ELF_EXEC_PAGESIZE	16384

/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
   use of this is to invoke "./ld.so someprog" to test out a new version of
   the loader.  We need to make sure that it is out of the way of the program
   that it will "exec", and that there is sufficient room for the brk.  */

#define ELF_ET_DYN_BASE         0x08000000UL

/* This yields a mask that user programs can use to figure out what
   instruction set this cpu supports.  */

#define ELF_HWCAP	(0)

/* This yields a string that ld.so will use to load implementation
   specific libraries for optimization.  This is more specific in
   intent than poking at uname or /proc/cpuinfo.  */

#define ELF_PLATFORM  (NULL)

#define SET_PERSONALITY(ex) set_personality(PER_LINUX)

#endif