/* MN10300 ELF constant and register definitions1*2* Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.3* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.4* Written by David Howells ([email protected])5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public Licence8* as published by the Free Software Foundation; either version9* 2 of the Licence, or (at your option) any later version.10*/11#ifndef _ASM_ELF_H12#define _ASM_ELF_H1314#include <linux/utsname.h>15#include <asm/ptrace.h>16#include <asm/user.h>1718/*19* AM33 relocations20*/21#define R_MN10300_NONE 0 /* No reloc. */22#define R_MN10300_32 1 /* Direct 32 bit. */23#define R_MN10300_16 2 /* Direct 16 bit. */24#define R_MN10300_8 3 /* Direct 8 bit. */25#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */26#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */27#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */28#define R_MN10300_24 9 /* Direct 24 bit. */29#define R_MN10300_RELATIVE 23 /* Adjust by program base. */30#define R_MN10300_SYM_DIFF 33 /* Adjustment when relaxing. */31#define R_MN10300_ALIGN 34 /* Alignment requirement. */3233/*34* AM33/AM34 HW Capabilities35*/36#define HWCAP_MN10300_ATOMIC_OP_UNIT 1 /* Has AM34 Atomic Operations */373839/*40* ELF register definitions..41*/42typedef unsigned long elf_greg_t;4344#define ELF_NGREG ((sizeof(struct pt_regs) / sizeof(elf_greg_t)) - 1)45typedef elf_greg_t elf_gregset_t[ELF_NGREG];4647#define ELF_NFPREG 3248typedef float elf_fpreg_t;4950typedef struct {51elf_fpreg_t fpregs[ELF_NFPREG];52u_int32_t fpcr;53} elf_fpregset_t;5455/*56* This is used to ensure we don't load something for the wrong architecture57*/58#define elf_check_arch(x) \59(((x)->e_machine == EM_CYGNUS_MN10300) || \60((x)->e_machine == EM_MN10300))6162/*63* These are used to set parameters in the core dumps.64*/65#define ELF_CLASS ELFCLASS3266#define ELF_DATA ELFDATA2LSB67#define ELF_ARCH EM_MN103006869/*70* ELF process initialiser71*/72#define ELF_PLAT_INIT(_r, load_addr) \73do { \74struct pt_regs *_ur = current->thread.uregs; \75_ur->a3 = 0; _ur->a2 = 0; _ur->d3 = 0; _ur->d2 = 0; \76_ur->mcvf = 0; _ur->mcrl = 0; _ur->mcrh = 0; _ur->mdrq = 0; \77_ur->e1 = 0; _ur->e0 = 0; _ur->e7 = 0; _ur->e6 = 0; \78_ur->e5 = 0; _ur->e4 = 0; _ur->e3 = 0; _ur->e2 = 0; \79_ur->lar = 0; _ur->lir = 0; _ur->mdr = 0; \80_ur->a1 = 0; _ur->a0 = 0; _ur->d1 = 0; _ur->d0 = 0; \81} while (0)8283#define CORE_DUMP_USE_REGSET84#define ELF_EXEC_PAGESIZE 40968586/*87* This is the location that an ET_DYN program is loaded if exec'ed. Typical88* use of this is to invoke "./ld.so someprog" to test out a new version of89* the loader. We need to make sure that it is out of the way of the program90* that it will "exec", and that there is sufficient room for the brk.91* - must clear the VMALLOC area92*/93#define ELF_ET_DYN_BASE 0x040000009495/*96* regs is struct pt_regs, pr_reg is elf_gregset_t (which is97* now struct user_regs, they are different)98* - ELF_CORE_COPY_REGS has been guessed, and may be wrong99*/100#define ELF_CORE_COPY_REGS(pr_reg, regs) \101do { \102pr_reg[0] = regs->a3; \103pr_reg[1] = regs->a2; \104pr_reg[2] = regs->d3; \105pr_reg[3] = regs->d2; \106pr_reg[4] = regs->mcvf; \107pr_reg[5] = regs->mcrl; \108pr_reg[6] = regs->mcrh; \109pr_reg[7] = regs->mdrq; \110pr_reg[8] = regs->e1; \111pr_reg[9] = regs->e0; \112pr_reg[10] = regs->e7; \113pr_reg[11] = regs->e6; \114pr_reg[12] = regs->e5; \115pr_reg[13] = regs->e4; \116pr_reg[14] = regs->e3; \117pr_reg[15] = regs->e2; \118pr_reg[16] = regs->sp; \119pr_reg[17] = regs->lar; \120pr_reg[18] = regs->lir; \121pr_reg[19] = regs->mdr; \122pr_reg[20] = regs->a1; \123pr_reg[21] = regs->a0; \124pr_reg[22] = regs->d1; \125pr_reg[23] = regs->d0; \126pr_reg[24] = regs->orig_d0; \127pr_reg[25] = regs->epsw; \128pr_reg[26] = regs->pc; \129} while (0);130131/*132* This yields a mask that user programs can use to figure out what133* instruction set this CPU supports. This could be done in user space,134* but it's not easy, and we've already done it here.135*/136#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT137#define ELF_HWCAP (HWCAP_MN10300_ATOMIC_OP_UNIT)138#else139#define ELF_HWCAP (0)140#endif141142/*143* This yields a string that ld.so will use to load implementation144* specific libraries for optimization. This is more specific in145* intent than poking at uname or /proc/cpuinfo.146*147* For the moment, we have only optimizations for the Intel generations,148* but that could change...149*/150#define ELF_PLATFORM (NULL)151152#ifdef __KERNEL__153#define SET_PERSONALITY(ex) set_personality(PER_LINUX)154#endif155156#endif /* _ASM_ELF_H */157158159