PageRenderTime 214ms CodeModel.GetById 30ms app.highlight 65ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/mn10300/include/asm/elf.h

https://bitbucket.org/thekraven/iscream_thunderc-2.6.35
C++ Header | 149 lines | 81 code | 17 blank | 51 comment | 4 complexity | 3ab1440e98ff2c50ad03c7d4410867d4 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1/* MN10300 ELF constant and register definitions
  2 *
  3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
  4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  5 * Written by David Howells (dhowells@redhat.com)
  6 *
  7 * This program is free software; you can redistribute it and/or
  8 * modify it under the terms of the GNU General Public Licence
  9 * as published by the Free Software Foundation; either version
 10 * 2 of the Licence, or (at your option) any later version.
 11 */
 12#ifndef _ASM_ELF_H
 13#define _ASM_ELF_H
 14
 15#include <linux/utsname.h>
 16#include <asm/ptrace.h>
 17#include <asm/user.h>
 18
 19/*
 20 * AM33 relocations
 21 */
 22#define R_MN10300_NONE		0	/* No reloc.  */
 23#define R_MN10300_32		1	/* Direct 32 bit.  */
 24#define R_MN10300_16		2	/* Direct 16 bit.  */
 25#define R_MN10300_8		3	/* Direct 8 bit.  */
 26#define R_MN10300_PCREL32	4	/* PC-relative 32-bit.  */
 27#define R_MN10300_PCREL16	5	/* PC-relative 16-bit signed.  */
 28#define R_MN10300_PCREL8	6	/* PC-relative 8-bit signed.  */
 29#define R_MN10300_24		9	/* Direct 24 bit.  */
 30#define R_MN10300_RELATIVE	23	/* Adjust by program base.  */
 31#define R_MN10300_SYM_DIFF	33	/* Adjustment when relaxing. */
 32#define R_MN10300_ALIGN 	34	/* Alignment requirement. */
 33
 34/*
 35 * ELF register definitions..
 36 */
 37typedef unsigned long elf_greg_t;
 38
 39#define ELF_NGREG ((sizeof(struct pt_regs) / sizeof(elf_greg_t)) - 1)
 40typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 41
 42#define ELF_NFPREG 32
 43typedef float elf_fpreg_t;
 44
 45typedef struct {
 46	elf_fpreg_t	fpregs[ELF_NFPREG];
 47	u_int32_t	fpcr;
 48} elf_fpregset_t;
 49
 50extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
 51
 52/*
 53 * This is used to ensure we don't load something for the wrong architecture
 54 */
 55#define elf_check_arch(x) \
 56	(((x)->e_machine == EM_CYGNUS_MN10300) ||	\
 57	 ((x)->e_machine == EM_MN10300))
 58
 59/*
 60 * These are used to set parameters in the core dumps.
 61 */
 62#define ELF_CLASS	ELFCLASS32
 63#define ELF_DATA	ELFDATA2LSB
 64#define ELF_ARCH	EM_MN10300
 65
 66/*
 67 * ELF process initialiser
 68 */
 69#define ELF_PLAT_INIT(_r, load_addr)					\
 70do {									\
 71	struct pt_regs *_ur = current->thread.uregs;			\
 72	_ur->a3   = 0;	_ur->a2   = 0;	_ur->d3   = 0;	_ur->d2   = 0;	\
 73	_ur->mcvf = 0;	_ur->mcrl = 0;	_ur->mcrh = 0;	_ur->mdrq = 0;	\
 74	_ur->e1   = 0;	_ur->e0   = 0;	_ur->e7   = 0;	_ur->e6   = 0;	\
 75	_ur->e5   = 0;	_ur->e4   = 0;	_ur->e3   = 0;	_ur->e2   = 0;	\
 76	_ur->lar  = 0;	_ur->lir  = 0;	_ur->mdr  = 0;			\
 77	_ur->a1   = 0;	_ur->a0   = 0;	_ur->d1   = 0;	_ur->d0   = 0;	\
 78} while (0)
 79
 80#define CORE_DUMP_USE_REGSET
 81#define ELF_EXEC_PAGESIZE	4096
 82
 83/*
 84 * This is the location that an ET_DYN program is loaded if exec'ed.  Typical
 85 * use of this is to invoke "./ld.so someprog" to test out a new version of
 86 * the loader.  We need to make sure that it is out of the way of the program
 87 * that it will "exec", and that there is sufficient room for the brk.
 88 * - must clear the VMALLOC area
 89 */
 90#define ELF_ET_DYN_BASE         0x04000000
 91
 92/*
 93 * regs is struct pt_regs, pr_reg is elf_gregset_t (which is
 94 * now struct user_regs, they are different)
 95 * - ELF_CORE_COPY_REGS has been guessed, and may be wrong
 96 */
 97#define ELF_CORE_COPY_REGS(pr_reg, regs)	\
 98do {						\
 99	pr_reg[0]	= regs->a3;		\
100	pr_reg[1]	= regs->a2;		\
101	pr_reg[2]	= regs->d3;		\
102	pr_reg[3]	= regs->d2;		\
103	pr_reg[4]	= regs->mcvf;		\
104	pr_reg[5]	= regs->mcrl;		\
105	pr_reg[6]	= regs->mcrh;		\
106	pr_reg[7]	= regs->mdrq;		\
107	pr_reg[8]	= regs->e1;		\
108	pr_reg[9]	= regs->e0;		\
109	pr_reg[10]	= regs->e7;		\
110	pr_reg[11]	= regs->e6;		\
111	pr_reg[12]	= regs->e5;		\
112	pr_reg[13]	= regs->e4;		\
113	pr_reg[14]	= regs->e3;		\
114	pr_reg[15]	= regs->e2;		\
115	pr_reg[16]	= regs->sp;		\
116	pr_reg[17]	= regs->lar;		\
117	pr_reg[18]	= regs->lir;		\
118	pr_reg[19]	= regs->mdr;		\
119	pr_reg[20]	= regs->a1;		\
120	pr_reg[21]	= regs->a0;		\
121	pr_reg[22]	= regs->d1;		\
122	pr_reg[23]	= regs->d0;		\
123	pr_reg[24]	= regs->orig_d0;	\
124	pr_reg[25]	= regs->epsw;		\
125	pr_reg[26]	= regs->pc;		\
126} while (0);
127
128/*
129 * This yields a mask that user programs can use to figure out what
130 * instruction set this CPU supports.  This could be done in user space,
131 * but it's not easy, and we've already done it here.
132 */
133#define ELF_HWCAP	(0)
134
135/*
136 * This yields a string that ld.so will use to load implementation
137 * specific libraries for optimization.  This is more specific in
138 * intent than poking at uname or /proc/cpuinfo.
139 *
140 * For the moment, we have only optimizations for the Intel generations,
141 * but that could change...
142 */
143#define ELF_PLATFORM  (NULL)
144
145#ifdef __KERNEL__
146#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
147#endif
148
149#endif /* _ASM_ELF_H */