diff options
Diffstat (limited to 'arch/um/sys-i386/asm')
| -rw-r--r-- | arch/um/sys-i386/asm/archparam.h | 16 | ||||
| -rw-r--r-- | arch/um/sys-i386/asm/elf.h | 125 | ||||
| -rw-r--r-- | arch/um/sys-i386/asm/module.h | 13 | ||||
| -rw-r--r-- | arch/um/sys-i386/asm/processor.h | 78 | ||||
| -rw-r--r-- | arch/um/sys-i386/asm/ptrace.h | 51 |
5 files changed, 283 insertions, 0 deletions
diff --git a/arch/um/sys-i386/asm/archparam.h b/arch/um/sys-i386/asm/archparam.h new file mode 100644 index 00000000000..2a18a884ca1 --- /dev/null +++ b/arch/um/sys-i386/asm/archparam.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __UM_ARCHPARAM_I386_H | ||
| 7 | #define __UM_ARCHPARAM_I386_H | ||
| 8 | |||
| 9 | #ifdef CONFIG_X86_PAE | ||
| 10 | #define LAST_PKMAP 512 | ||
| 11 | #else | ||
| 12 | #define LAST_PKMAP 1024 | ||
| 13 | #endif | ||
| 14 | |||
| 15 | #endif | ||
| 16 | |||
diff --git a/arch/um/sys-i386/asm/elf.h b/arch/um/sys-i386/asm/elf.h new file mode 100644 index 00000000000..42305551d20 --- /dev/null +++ b/arch/um/sys-i386/asm/elf.h | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | #ifndef __UM_ELF_I386_H | ||
| 6 | #define __UM_ELF_I386_H | ||
| 7 | |||
| 8 | #include <asm/user.h> | ||
| 9 | #include "skas.h" | ||
| 10 | |||
| 11 | #define R_386_NONE 0 | ||
| 12 | #define R_386_32 1 | ||
| 13 | #define R_386_PC32 2 | ||
| 14 | #define R_386_GOT32 3 | ||
| 15 | #define R_386_PLT32 4 | ||
| 16 | #define R_386_COPY 5 | ||
| 17 | #define R_386_GLOB_DAT 6 | ||
| 18 | #define R_386_JMP_SLOT 7 | ||
| 19 | #define R_386_RELATIVE 8 | ||
| 20 | #define R_386_GOTOFF 9 | ||
| 21 | #define R_386_GOTPC 10 | ||
| 22 | #define R_386_NUM 11 | ||
| 23 | |||
| 24 | typedef unsigned long elf_greg_t; | ||
| 25 | |||
| 26 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) | ||
| 27 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
| 28 | |||
| 29 | typedef struct user_i387_struct elf_fpregset_t; | ||
| 30 | |||
| 31 | /* | ||
| 32 | * This is used to ensure we don't load something for the wrong architecture. | ||
| 33 | */ | ||
| 34 | #define elf_check_arch(x) \ | ||
| 35 | (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486)) | ||
| 36 | |||
| 37 | #define ELF_CLASS ELFCLASS32 | ||
| 38 | #define ELF_DATA ELFDATA2LSB | ||
| 39 | #define ELF_ARCH EM_386 | ||
| 40 | |||
| 41 | #define ELF_PLAT_INIT(regs, load_addr) do { \ | ||
| 42 | PT_REGS_EBX(regs) = 0; \ | ||
| 43 | PT_REGS_ECX(regs) = 0; \ | ||
| 44 | PT_REGS_EDX(regs) = 0; \ | ||
| 45 | PT_REGS_ESI(regs) = 0; \ | ||
| 46 | PT_REGS_EDI(regs) = 0; \ | ||
| 47 | PT_REGS_EBP(regs) = 0; \ | ||
| 48 | PT_REGS_EAX(regs) = 0; \ | ||
| 49 | } while (0) | ||
| 50 | |||
| 51 | #define ELF_EXEC_PAGESIZE 4096 | ||
| 52 | |||
| 53 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
| 54 | |||
| 55 | /* Shamelessly stolen from include/asm-i386/elf.h */ | ||
| 56 | |||
| 57 | #define ELF_CORE_COPY_REGS(pr_reg, regs) do { \ | ||
| 58 | pr_reg[0] = PT_REGS_EBX(regs); \ | ||
| 59 | pr_reg[1] = PT_REGS_ECX(regs); \ | ||
| 60 | pr_reg[2] = PT_REGS_EDX(regs); \ | ||
| 61 | pr_reg[3] = PT_REGS_ESI(regs); \ | ||
| 62 | pr_reg[4] = PT_REGS_EDI(regs); \ | ||
| 63 | pr_reg[5] = PT_REGS_EBP(regs); \ | ||
| 64 | pr_reg[6] = PT_REGS_EAX(regs); \ | ||
| 65 | pr_reg[7] = PT_REGS_DS(regs); \ | ||
| 66 | pr_reg[8] = PT_REGS_ES(regs); \ | ||
| 67 | /* fake once used fs and gs selectors? */ \ | ||
| 68 | pr_reg[9] = PT_REGS_DS(regs); \ | ||
| 69 | pr_reg[10] = PT_REGS_DS(regs); \ | ||
| 70 | pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \ | ||
| 71 | pr_reg[12] = PT_REGS_IP(regs); \ | ||
| 72 | pr_reg[13] = PT_REGS_CS(regs); \ | ||
| 73 | pr_reg[14] = PT_REGS_EFLAGS(regs); \ | ||
| 74 | pr_reg[15] = PT_REGS_SP(regs); \ | ||
| 75 | pr_reg[16] = PT_REGS_SS(regs); \ | ||
| 76 | } while (0); | ||
| 77 | |||
| 78 | #define task_pt_regs(t) (&(t)->thread.regs) | ||
| 79 | |||
| 80 | struct task_struct; | ||
| 81 | |||
| 82 | extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu); | ||
| 83 | |||
| 84 | #define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu) | ||
| 85 | |||
| 86 | extern long elf_aux_hwcap; | ||
| 87 | #define ELF_HWCAP (elf_aux_hwcap) | ||
| 88 | |||
| 89 | extern char * elf_aux_platform; | ||
| 90 | #define ELF_PLATFORM (elf_aux_platform) | ||
| 91 | |||
| 92 | #define SET_PERSONALITY(ex) do { } while (0) | ||
| 93 | |||
| 94 | extern unsigned long vsyscall_ehdr; | ||
| 95 | extern unsigned long vsyscall_end; | ||
| 96 | extern unsigned long __kernel_vsyscall; | ||
| 97 | |||
| 98 | #define VSYSCALL_BASE vsyscall_ehdr | ||
| 99 | #define VSYSCALL_END vsyscall_end | ||
| 100 | |||
| 101 | /* | ||
| 102 | * This is the range that is readable by user mode, and things | ||
| 103 | * acting like user mode such as get_user_pages. | ||
| 104 | */ | ||
| 105 | #define FIXADDR_USER_START VSYSCALL_BASE | ||
| 106 | #define FIXADDR_USER_END VSYSCALL_END | ||
| 107 | |||
| 108 | #define __HAVE_ARCH_GATE_AREA 1 | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Architecture-neutral AT_ values in 0-17, leave some room | ||
| 112 | * for more of them, start the x86-specific ones at 32. | ||
| 113 | */ | ||
| 114 | #define AT_SYSINFO 32 | ||
| 115 | #define AT_SYSINFO_EHDR 33 | ||
| 116 | |||
| 117 | #define ARCH_DLINFO \ | ||
| 118 | do { \ | ||
| 119 | if ( vsyscall_ehdr ) { \ | ||
| 120 | NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \ | ||
| 121 | NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \ | ||
| 122 | } \ | ||
| 123 | } while (0) | ||
| 124 | |||
| 125 | #endif | ||
diff --git a/arch/um/sys-i386/asm/module.h b/arch/um/sys-i386/asm/module.h new file mode 100644 index 00000000000..5ead4a0b2e3 --- /dev/null +++ b/arch/um/sys-i386/asm/module.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #ifndef __UM_MODULE_I386_H | ||
| 2 | #define __UM_MODULE_I386_H | ||
| 3 | |||
| 4 | /* UML is simple */ | ||
| 5 | struct mod_arch_specific | ||
| 6 | { | ||
| 7 | }; | ||
| 8 | |||
| 9 | #define Elf_Shdr Elf32_Shdr | ||
| 10 | #define Elf_Sym Elf32_Sym | ||
| 11 | #define Elf_Ehdr Elf32_Ehdr | ||
| 12 | |||
| 13 | #endif | ||
diff --git a/arch/um/sys-i386/asm/processor.h b/arch/um/sys-i386/asm/processor.h new file mode 100644 index 00000000000..82a9061ab5b --- /dev/null +++ b/arch/um/sys-i386/asm/processor.h | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __UM_PROCESSOR_I386_H | ||
| 7 | #define __UM_PROCESSOR_I386_H | ||
| 8 | |||
| 9 | #include "linux/string.h" | ||
| 10 | #include <sysdep/host_ldt.h> | ||
| 11 | #include "asm/segment.h" | ||
| 12 | |||
| 13 | extern int host_has_cmov; | ||
| 14 | |||
| 15 | /* include faultinfo structure */ | ||
| 16 | #include "sysdep/faultinfo.h" | ||
| 17 | |||
| 18 | struct uml_tls_struct { | ||
| 19 | struct user_desc tls; | ||
| 20 | unsigned flushed:1; | ||
| 21 | unsigned present:1; | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct arch_thread { | ||
| 25 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ||
| 26 | unsigned long debugregs[8]; | ||
| 27 | int debugregs_seq; | ||
| 28 | struct faultinfo faultinfo; | ||
| 29 | }; | ||
| 30 | |||
| 31 | #define INIT_ARCH_THREAD { \ | ||
| 32 | .tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \ | ||
| 33 | { .present = 0, .flushed = 0 } }, \ | ||
| 34 | .debugregs = { [ 0 ... 7 ] = 0 }, \ | ||
| 35 | .debugregs_seq = 0, \ | ||
| 36 | .faultinfo = { 0, 0, 0 } \ | ||
| 37 | } | ||
| 38 | |||
| 39 | static inline void arch_flush_thread(struct arch_thread *thread) | ||
| 40 | { | ||
| 41 | /* Clear any TLS still hanging */ | ||
| 42 | memset(&thread->tls_array, 0, sizeof(thread->tls_array)); | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline void arch_copy_thread(struct arch_thread *from, | ||
| 46 | struct arch_thread *to) | ||
| 47 | { | ||
| 48 | memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array)); | ||
| 49 | } | ||
| 50 | |||
| 51 | #include <asm/user.h> | ||
| 52 | |||
| 53 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | ||
| 54 | static inline void rep_nop(void) | ||
| 55 | { | ||
| 56 | __asm__ __volatile__("rep;nop": : :"memory"); | ||
| 57 | } | ||
| 58 | |||
| 59 | #define cpu_relax() rep_nop() | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Default implementation of macro that returns current | ||
| 63 | * instruction pointer ("program counter"). Stolen | ||
| 64 | * from asm-i386/processor.h | ||
| 65 | */ | ||
| 66 | #define current_text_addr() \ | ||
| 67 | ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) | ||
| 68 | |||
| 69 | #define ARCH_IS_STACKGROW(address) \ | ||
| 70 | (address + 32 >= UPT_SP(¤t->thread.regs.regs)) | ||
| 71 | |||
| 72 | #define KSTK_EIP(tsk) KSTK_REG(tsk, EIP) | ||
| 73 | #define KSTK_ESP(tsk) KSTK_REG(tsk, UESP) | ||
| 74 | #define KSTK_EBP(tsk) KSTK_REG(tsk, EBP) | ||
| 75 | |||
| 76 | #include "asm/processor-generic.h" | ||
| 77 | |||
| 78 | #endif | ||
diff --git a/arch/um/sys-i386/asm/ptrace.h b/arch/um/sys-i386/asm/ptrace.h new file mode 100644 index 00000000000..5d2a5911253 --- /dev/null +++ b/arch/um/sys-i386/asm/ptrace.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __UM_PTRACE_I386_H | ||
| 7 | #define __UM_PTRACE_I386_H | ||
| 8 | |||
| 9 | #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 | ||
| 10 | |||
| 11 | #include "linux/compiler.h" | ||
| 12 | #include "asm/ptrace-generic.h" | ||
| 13 | |||
| 14 | #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) | ||
| 15 | #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) | ||
| 16 | #define PT_REGS_ECX(r) UPT_ECX(&(r)->regs) | ||
| 17 | #define PT_REGS_EDX(r) UPT_EDX(&(r)->regs) | ||
| 18 | #define PT_REGS_ESI(r) UPT_ESI(&(r)->regs) | ||
| 19 | #define PT_REGS_EDI(r) UPT_EDI(&(r)->regs) | ||
| 20 | #define PT_REGS_EBP(r) UPT_EBP(&(r)->regs) | ||
| 21 | |||
| 22 | #define PT_REGS_CS(r) UPT_CS(&(r)->regs) | ||
| 23 | #define PT_REGS_SS(r) UPT_SS(&(r)->regs) | ||
| 24 | #define PT_REGS_DS(r) UPT_DS(&(r)->regs) | ||
| 25 | #define PT_REGS_ES(r) UPT_ES(&(r)->regs) | ||
| 26 | #define PT_REGS_FS(r) UPT_FS(&(r)->regs) | ||
| 27 | #define PT_REGS_GS(r) UPT_GS(&(r)->regs) | ||
| 28 | |||
| 29 | #define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs) | ||
| 30 | |||
| 31 | #define PT_REGS_ORIG_SYSCALL(r) PT_REGS_EAX(r) | ||
| 32 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r) | ||
| 33 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) | ||
| 34 | |||
| 35 | #define profile_pc(regs) PT_REGS_IP(regs) | ||
| 36 | |||
| 37 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Forward declaration to avoid including sysdep/tls.h, which causes a | ||
| 41 | * circular include, and compilation failures. | ||
| 42 | */ | ||
| 43 | struct user_desc; | ||
| 44 | |||
| 45 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, | ||
| 46 | struct user_desc __user *user_desc); | ||
| 47 | |||
| 48 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, | ||
| 49 | struct user_desc __user *user_desc); | ||
| 50 | |||
| 51 | #endif | ||
