2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
6 #ifndef __UM_ARCHPARAM_I386_H
7 #define __UM_ARCHPARAM_I386_H
9 /********* Bits for asm-um/elf.h ************/
13 #define ELF_PLATFORM "i586"
15 #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
17 typedef struct user_i387_struct elf_fpregset_t
;
18 typedef unsigned long elf_greg_t
;
20 #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
21 typedef elf_greg_t elf_gregset_t
[ELF_NGREG
];
23 #define ELF_DATA ELFDATA2LSB
24 #define ELF_ARCH EM_386
26 #define ELF_PLAT_INIT(regs, load_addr) do { \
27 PT_REGS_EBX(regs) = 0; \
28 PT_REGS_ECX(regs) = 0; \
29 PT_REGS_EDX(regs) = 0; \
30 PT_REGS_ESI(regs) = 0; \
31 PT_REGS_EDI(regs) = 0; \
32 PT_REGS_EBP(regs) = 0; \
33 PT_REGS_EAX(regs) = 0; \
36 /* Shamelessly stolen from include/asm-i386/elf.h */
38 #define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
39 pr_reg[0] = PT_REGS_EBX(regs); \
40 pr_reg[1] = PT_REGS_ECX(regs); \
41 pr_reg[2] = PT_REGS_EDX(regs); \
42 pr_reg[3] = PT_REGS_ESI(regs); \
43 pr_reg[4] = PT_REGS_EDI(regs); \
44 pr_reg[5] = PT_REGS_EBP(regs); \
45 pr_reg[6] = PT_REGS_EAX(regs); \
46 pr_reg[7] = PT_REGS_DS(regs); \
47 pr_reg[8] = PT_REGS_ES(regs); \
48 /* fake once used fs and gs selectors? */ \
49 pr_reg[9] = PT_REGS_DS(regs); \
50 pr_reg[10] = PT_REGS_DS(regs); \
51 pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
52 pr_reg[12] = PT_REGS_IP(regs); \
53 pr_reg[13] = PT_REGS_CS(regs); \
54 pr_reg[14] = PT_REGS_EFLAGS(regs); \
55 pr_reg[15] = PT_REGS_SP(regs); \
56 pr_reg[16] = PT_REGS_SS(regs); \
59 #if 0 /* Turn this back on when UML has VSYSCALL working */
60 #define VSYSCALL_BASE (__fix_to_virt(FIX_VSYSCALL))
62 #define VSYSCALL_BASE 0
65 #define VSYSCALL_EHDR ((const struct elfhdr *) VSYSCALL_BASE)
66 #define VSYSCALL_ENTRY ((unsigned long) &__kernel_vsyscall)
67 extern void *__kernel_vsyscall
;
70 * Architecture-neutral AT_ values in 0-17, leave some room
71 * for more of them, start the x86-specific ones at 32.
74 #define AT_SYSINFO_EHDR 33
78 NEW_AUX_ENT(AT_SYSINFO, VSYSCALL_ENTRY); \
79 NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL_BASE); \
83 * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
84 * extra segments containing the vsyscall DSO contents. Dumping its
85 * contents makes post-mortem fully interpretable later without matching up
86 * the same kernel and hardware config to see what PC values meant.
87 * Dumping its extra ELF program headers includes all the other information
88 * a debugger needs to easily find how the vsyscall DSO was being used.
91 #define ELF_CORE_EXTRA_PHDRS (VSYSCALL_EHDR->e_phnum)
94 #undef ELF_CORE_EXTRA_PHDRS
97 #define ELF_CORE_WRITE_EXTRA_PHDRS \
99 const struct elf_phdr *const vsyscall_phdrs = \
100 (const struct elf_phdr *) (VSYSCALL_BASE \
101 + VSYSCALL_EHDR->e_phoff); \
104 for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \
105 struct elf_phdr phdr = vsyscall_phdrs[i]; \
106 if (phdr.p_type == PT_LOAD) { \
107 ofs = phdr.p_offset = offset; \
108 offset += phdr.p_filesz; \
111 phdr.p_offset += ofs; \
112 phdr.p_paddr = 0; /* match other core phdrs */ \
113 DUMP_WRITE(&phdr, sizeof(phdr)); \
116 #define ELF_CORE_WRITE_EXTRA_DATA \
118 const struct elf_phdr *const vsyscall_phdrs = \
119 (const struct elf_phdr *) (VSYSCALL_BASE \
120 + VSYSCALL_EHDR->e_phoff); \
122 for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \
123 if (vsyscall_phdrs[i].p_type == PT_LOAD) \
124 DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \
125 vsyscall_phdrs[i].p_filesz); \
130 #undef ELF_CORE_WRITE_EXTRA_PHDRS
131 #undef ELF_CORE_WRITE_EXTRA_DATA
136 #define R_386_GOT32 3
137 #define R_386_PLT32 4
139 #define R_386_GLOB_DAT 6
140 #define R_386_JMP_SLOT 7
141 #define R_386_RELATIVE 8
142 #define R_386_GOTOFF 9
143 #define R_386_GOTPC 10
146 /********* Bits for asm-um/delay.h **********/
148 typedef unsigned long um_udelay_t
;
150 /********* Nothing for asm-um/hardirq.h **********/
152 /********* Nothing for asm-um/hw_irq.h **********/
154 /********* Nothing for asm-um/string.h **********/
159 * Overrides for Emacs so that we follow Linus's tabbing style.
160 * Emacs will notice this stuff at the end of the file and automatically
161 * adjust the settings for this buffer only. This must remain at the end
163 * ---------------------------------------------------------------------------
165 * c-file-style: "linux"