ia64/xen-unstable

changeset 8982:875e0e96e574

Add include/asm-i386/{a.out,elf}.h to sparse tree

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Feb 23 15:22:17 2006 +0000 (2006-02-23)
parents 13e4df60caf1
children 822a27d28afe
files linux-2.6-xen-sparse/include/asm-i386/a.out.h linux-2.6-xen-sparse/include/asm-i386/elf.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/a.out.h	Thu Feb 23 15:22:17 2006 +0000
     1.3 @@ -0,0 +1,26 @@
     1.4 +#ifndef __I386_A_OUT_H__
     1.5 +#define __I386_A_OUT_H__
     1.6 +
     1.7 +struct exec
     1.8 +{
     1.9 +  unsigned long a_info;		/* Use macros N_MAGIC, etc for access */
    1.10 +  unsigned a_text;		/* length of text, in bytes */
    1.11 +  unsigned a_data;		/* length of data, in bytes */
    1.12 +  unsigned a_bss;		/* length of uninitialized data area for file, in bytes */
    1.13 +  unsigned a_syms;		/* length of symbol table data in file, in bytes */
    1.14 +  unsigned a_entry;		/* start address */
    1.15 +  unsigned a_trsize;		/* length of relocation info for text, in bytes */
    1.16 +  unsigned a_drsize;		/* length of relocation info for data, in bytes */
    1.17 +};
    1.18 +
    1.19 +#define N_TRSIZE(a)	((a).a_trsize)
    1.20 +#define N_DRSIZE(a)	((a).a_drsize)
    1.21 +#define N_SYMSIZE(a)	((a).a_syms)
    1.22 +
    1.23 +#ifdef __KERNEL__
    1.24 +
    1.25 +#define STACK_TOP	TASK_SIZE
    1.26 +
    1.27 +#endif
    1.28 +
    1.29 +#endif /* __A_OUT_GNU_H__ */
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/elf.h	Thu Feb 23 15:22:17 2006 +0000
     2.3 @@ -0,0 +1,189 @@
     2.4 +#ifndef __ASMi386_ELF_H
     2.5 +#define __ASMi386_ELF_H
     2.6 +
     2.7 +/*
     2.8 + * ELF register definitions..
     2.9 + */
    2.10 +
    2.11 +#include <asm/ptrace.h>
    2.12 +#include <asm/user.h>
    2.13 +#include <asm/processor.h>
    2.14 +#include <asm/system.h>		/* for savesegment */
    2.15 +#include <asm/auxvec.h>
    2.16 +
    2.17 +#include <linux/utsname.h>
    2.18 +
    2.19 +#define R_386_NONE	0
    2.20 +#define R_386_32	1
    2.21 +#define R_386_PC32	2
    2.22 +#define R_386_GOT32	3
    2.23 +#define R_386_PLT32	4
    2.24 +#define R_386_COPY	5
    2.25 +#define R_386_GLOB_DAT	6
    2.26 +#define R_386_JMP_SLOT	7
    2.27 +#define R_386_RELATIVE	8
    2.28 +#define R_386_GOTOFF	9
    2.29 +#define R_386_GOTPC	10
    2.30 +#define R_386_NUM	11
    2.31 +
    2.32 +typedef unsigned long elf_greg_t;
    2.33 +
    2.34 +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
    2.35 +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
    2.36 +
    2.37 +typedef struct user_i387_struct elf_fpregset_t;
    2.38 +typedef struct user_fxsr_struct elf_fpxregset_t;
    2.39 +
    2.40 +/*
    2.41 + * This is used to ensure we don't load something for the wrong architecture.
    2.42 + */
    2.43 +#define elf_check_arch(x) \
    2.44 +	(((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
    2.45 +
    2.46 +/*
    2.47 + * These are used to set parameters in the core dumps.
    2.48 + */
    2.49 +#define ELF_CLASS	ELFCLASS32
    2.50 +#define ELF_DATA	ELFDATA2LSB
    2.51 +#define ELF_ARCH	EM_386
    2.52 +
    2.53 +/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
    2.54 +   contains a pointer to a function which might be registered using `atexit'.
    2.55 +   This provides a mean for the dynamic linker to call DT_FINI functions for
    2.56 +   shared libraries that have been loaded before the code runs.
    2.57 +
    2.58 +   A value of 0 tells we have no such handler. 
    2.59 +
    2.60 +   We might as well make sure everything else is cleared too (except for %esp),
    2.61 +   just to make things more deterministic.
    2.62 + */
    2.63 +#define ELF_PLAT_INIT(_r, load_addr)	do { \
    2.64 +	_r->ebx = 0; _r->ecx = 0; _r->edx = 0; \
    2.65 +	_r->esi = 0; _r->edi = 0; _r->ebp = 0; \
    2.66 +	_r->eax = 0; \
    2.67 +} while (0)
    2.68 +
    2.69 +#define USE_ELF_CORE_DUMP
    2.70 +#define ELF_EXEC_PAGESIZE	4096
    2.71 +
    2.72 +/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
    2.73 +   use of this is to invoke "./ld.so someprog" to test out a new version of
    2.74 +   the loader.  We need to make sure that it is out of the way of the program
    2.75 +   that it will "exec", and that there is sufficient room for the brk.  */
    2.76 +
    2.77 +#define ELF_ET_DYN_BASE         (TASK_SIZE / 3 * 2)
    2.78 +
    2.79 +/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
    2.80 +   now struct_user_regs, they are different) */
    2.81 +
    2.82 +#define ELF_CORE_COPY_REGS(pr_reg, regs)		\
    2.83 +	pr_reg[0] = regs->ebx;				\
    2.84 +	pr_reg[1] = regs->ecx;				\
    2.85 +	pr_reg[2] = regs->edx;				\
    2.86 +	pr_reg[3] = regs->esi;				\
    2.87 +	pr_reg[4] = regs->edi;				\
    2.88 +	pr_reg[5] = regs->ebp;				\
    2.89 +	pr_reg[6] = regs->eax;				\
    2.90 +	pr_reg[7] = regs->xds;				\
    2.91 +	pr_reg[8] = regs->xes;				\
    2.92 +	savesegment(fs,pr_reg[9]);			\
    2.93 +	savesegment(gs,pr_reg[10]);			\
    2.94 +	pr_reg[11] = regs->orig_eax;			\
    2.95 +	pr_reg[12] = regs->eip;				\
    2.96 +	pr_reg[13] = regs->xcs;				\
    2.97 +	pr_reg[14] = regs->eflags;			\
    2.98 +	pr_reg[15] = regs->esp;				\
    2.99 +	pr_reg[16] = regs->xss;
   2.100 +
   2.101 +/* This yields a mask that user programs can use to figure out what
   2.102 +   instruction set this CPU supports.  This could be done in user space,
   2.103 +   but it's not easy, and we've already done it here.  */
   2.104 +
   2.105 +#define ELF_HWCAP	(boot_cpu_data.x86_capability[0])
   2.106 +
   2.107 +/* This yields a string that ld.so will use to load implementation
   2.108 +   specific libraries for optimization.  This is more specific in
   2.109 +   intent than poking at uname or /proc/cpuinfo.
   2.110 +
   2.111 +   For the moment, we have only optimizations for the Intel generations,
   2.112 +   but that could change... */
   2.113 +
   2.114 +#define ELF_PLATFORM  (system_utsname.machine)
   2.115 +
   2.116 +#ifdef __KERNEL__
   2.117 +#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
   2.118 +
   2.119 +/*
   2.120 + * An executable for which elf_read_implies_exec() returns TRUE will
   2.121 + * have the READ_IMPLIES_EXEC personality flag set automatically.
   2.122 + */
   2.123 +#define elf_read_implies_exec(ex, executable_stack)	(executable_stack != EXSTACK_DISABLE_X)
   2.124 +
   2.125 +struct task_struct;
   2.126 +
   2.127 +extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
   2.128 +extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
   2.129 +extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *);
   2.130 +
   2.131 +#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
   2.132 +#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
   2.133 +#define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
   2.134 +
   2.135 +#define VSYSCALL_BASE	(__fix_to_virt(FIX_VSYSCALL))
   2.136 +#define VSYSCALL_EHDR	((const struct elfhdr *) VSYSCALL_BASE)
   2.137 +#define VSYSCALL_ENTRY	((unsigned long) &__kernel_vsyscall)
   2.138 +extern void __kernel_vsyscall;
   2.139 +
   2.140 +#define ARCH_DLINFO						\
   2.141 +do {								\
   2.142 +		NEW_AUX_ENT(AT_SYSINFO,	VSYSCALL_ENTRY);	\
   2.143 +		NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL_BASE);	\
   2.144 +} while (0)
   2.145 +
   2.146 +/*
   2.147 + * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
   2.148 + * extra segments containing the vsyscall DSO contents.  Dumping its
   2.149 + * contents makes post-mortem fully interpretable later without matching up
   2.150 + * the same kernel and hardware config to see what PC values meant.
   2.151 + * Dumping its extra ELF program headers includes all the other information
   2.152 + * a debugger needs to easily find how the vsyscall DSO was being used.
   2.153 + */
   2.154 +#define ELF_CORE_EXTRA_PHDRS		(VSYSCALL_EHDR->e_phnum)
   2.155 +#define ELF_CORE_WRITE_EXTRA_PHDRS					      \
   2.156 +do {									      \
   2.157 +	const struct elf_phdr *const vsyscall_phdrs =			      \
   2.158 +		(const struct elf_phdr *) (VSYSCALL_BASE		      \
   2.159 +					   + VSYSCALL_EHDR->e_phoff);	      \
   2.160 +	int i;								      \
   2.161 +	Elf32_Off ofs = 0;						      \
   2.162 +	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
   2.163 +		struct elf_phdr phdr = vsyscall_phdrs[i];		      \
   2.164 +		if (phdr.p_type == PT_LOAD) {				      \
   2.165 +			BUG_ON(ofs != 0);				      \
   2.166 +			ofs = phdr.p_offset = offset;			      \
   2.167 +			phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);	      \
   2.168 +			phdr.p_filesz = phdr.p_memsz;			      \
   2.169 +			offset += phdr.p_filesz;			      \
   2.170 +		}							      \
   2.171 +		else							      \
   2.172 +			phdr.p_offset += ofs;				      \
   2.173 +		phdr.p_paddr = 0; /* match other core phdrs */		      \
   2.174 +		DUMP_WRITE(&phdr, sizeof(phdr));			      \
   2.175 +	}								      \
   2.176 +} while (0)
   2.177 +#define ELF_CORE_WRITE_EXTRA_DATA					      \
   2.178 +do {									      \
   2.179 +	const struct elf_phdr *const vsyscall_phdrs =			      \
   2.180 +		(const struct elf_phdr *) (VSYSCALL_BASE		      \
   2.181 +					   + VSYSCALL_EHDR->e_phoff);	      \
   2.182 +	int i;								      \
   2.183 +	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
   2.184 +		if (vsyscall_phdrs[i].p_type == PT_LOAD)		      \
   2.185 +			DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr,	      \
   2.186 +				   PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));    \
   2.187 +	}								      \
   2.188 +} while (0)
   2.189 +
   2.190 +#endif
   2.191 +
   2.192 +#endif