diff options
Diffstat (limited to 'arch/um/include')
-rw-r--r-- | arch/um/include/mem.h | 1 | ||||
-rw-r--r-- | arch/um/include/registers.h | 1 | ||||
-rw-r--r-- | arch/um/include/sysdep-i386/ptrace_user.h | 13 | ||||
-rw-r--r-- | arch/um/include/sysdep-i386/stub.h | 65 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/ptrace_user.h | 14 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/stub.h | 58 | ||||
-rw-r--r-- | arch/um/include/time_user.h | 1 | ||||
-rw-r--r-- | arch/um/include/tlb.h | 30 |
8 files changed, 165 insertions, 18 deletions
diff --git a/arch/um/include/mem.h b/arch/um/include/mem.h index 10c46c38949a..99d3ad4a03e5 100644 --- a/arch/um/include/mem.h +++ b/arch/um/include/mem.h | |||
@@ -13,6 +13,7 @@ extern int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w); | |||
13 | extern int is_remapped(void *virt); | 13 | extern int is_remapped(void *virt); |
14 | extern int physmem_remove_mapping(void *virt); | 14 | extern int physmem_remove_mapping(void *virt); |
15 | extern void physmem_forget_descriptor(int fd); | 15 | extern void physmem_forget_descriptor(int fd); |
16 | extern unsigned long to_phys(void *virt); | ||
16 | 17 | ||
17 | #endif | 18 | #endif |
18 | 19 | ||
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h index 8744abb5224f..0a35e6d0baa0 100644 --- a/arch/um/include/registers.h +++ b/arch/um/include/registers.h | |||
@@ -14,6 +14,7 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs); | |||
14 | extern void save_registers(int pid, union uml_pt_regs *regs); | 14 | extern void save_registers(int pid, union uml_pt_regs *regs); |
15 | extern void restore_registers(int pid, union uml_pt_regs *regs); | 15 | extern void restore_registers(int pid, union uml_pt_regs *regs); |
16 | extern void init_registers(int pid); | 16 | extern void init_registers(int pid); |
17 | extern void get_safe_registers(unsigned long * regs); | ||
17 | 18 | ||
18 | #endif | 19 | #endif |
19 | 20 | ||
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h index eca8066e7a43..899aa4b2a78d 100644 --- a/arch/um/include/sysdep-i386/ptrace_user.h +++ b/arch/um/include/sysdep-i386/ptrace_user.h | |||
@@ -20,11 +20,24 @@ | |||
20 | #define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX) | 20 | #define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX) |
21 | #define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI) | 21 | #define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI) |
22 | #define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI) | 22 | #define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI) |
23 | #define PT_SYSCALL_ARG6_OFFSET PT_OFFSET(EBP) | ||
23 | 24 | ||
24 | #define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX) | 25 | #define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX) |
25 | 26 | ||
27 | #define REGS_SYSCALL_NR EAX /* This is used before a system call */ | ||
28 | #define REGS_SYSCALL_ARG1 EBX | ||
29 | #define REGS_SYSCALL_ARG2 ECX | ||
30 | #define REGS_SYSCALL_ARG3 EDX | ||
31 | #define REGS_SYSCALL_ARG4 ESI | ||
32 | #define REGS_SYSCALL_ARG5 EDI | ||
33 | #define REGS_SYSCALL_ARG6 EBP | ||
34 | |||
35 | #define REGS_IP_INDEX EIP | ||
36 | #define REGS_SP_INDEX UESP | ||
37 | |||
26 | #define PT_IP_OFFSET PT_OFFSET(EIP) | 38 | #define PT_IP_OFFSET PT_OFFSET(EIP) |
27 | #define PT_IP(regs) ((regs)[EIP]) | 39 | #define PT_IP(regs) ((regs)[EIP]) |
40 | #define PT_SP_OFFSET PT_OFFSET(UESP) | ||
28 | #define PT_SP(regs) ((regs)[UESP]) | 41 | #define PT_SP(regs) ((regs)[UESP]) |
29 | 42 | ||
30 | #ifndef FRAME_SIZE | 43 | #ifndef FRAME_SIZE |
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h new file mode 100644 index 000000000000..d3699fe1c613 --- /dev/null +++ b/arch/um/include/sysdep-i386/stub.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_STUB_H | ||
7 | #define __SYSDEP_STUB_H | ||
8 | |||
9 | #include <asm/ptrace.h> | ||
10 | #include <asm/unistd.h> | ||
11 | |||
12 | extern void stub_segv_handler(int sig); | ||
13 | extern void stub_clone_handler(void); | ||
14 | |||
15 | #define STUB_SYSCALL_RET EAX | ||
16 | #define STUB_MMAP_NR __NR_mmap2 | ||
17 | #define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT) | ||
18 | |||
19 | static inline long stub_syscall2(long syscall, long arg1, long arg2) | ||
20 | { | ||
21 | long ret; | ||
22 | |||
23 | __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx"); | ||
24 | __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx"); | ||
25 | __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax"); | ||
26 | __asm__("int $0x80;" : : : "%eax"); | ||
27 | __asm__ __volatile__("movl %%eax, %0; " : "=g" (ret) :); | ||
28 | return(ret); | ||
29 | } | ||
30 | |||
31 | static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3) | ||
32 | { | ||
33 | __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx"); | ||
34 | return(stub_syscall2(syscall, arg1, arg2)); | ||
35 | } | ||
36 | |||
37 | static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, | ||
38 | long arg4) | ||
39 | { | ||
40 | __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi"); | ||
41 | return(stub_syscall3(syscall, arg1, arg2, arg3)); | ||
42 | } | ||
43 | |||
44 | static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, | ||
45 | long arg4, long arg5, long arg6) | ||
46 | { | ||
47 | long ret; | ||
48 | __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax"); | ||
49 | __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx"); | ||
50 | __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx"); | ||
51 | __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx"); | ||
52 | __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi"); | ||
53 | __asm__("movl %0, %%edi; " : : "g" (arg5) : "%edi"); | ||
54 | __asm__ __volatile__("pushl %%ebp ; movl %1, %%ebp; " | ||
55 | "int $0x80; popl %%ebp ; " | ||
56 | "movl %%eax, %0; " : "=g" (ret) : "g" (arg6) : "%eax"); | ||
57 | return(ret); | ||
58 | } | ||
59 | |||
60 | static inline void trap_myself(void) | ||
61 | { | ||
62 | __asm("int3"); | ||
63 | } | ||
64 | |||
65 | #endif | ||
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h index 31729973fb14..128faf027364 100644 --- a/arch/um/include/sysdep-x86_64/ptrace_user.h +++ b/arch/um/include/sysdep-x86_64/ptrace_user.h | |||
@@ -55,6 +55,20 @@ | |||
55 | #define PTRACE_OLDSETOPTIONS 21 | 55 | #define PTRACE_OLDSETOPTIONS 21 |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | /* These are before the system call, so the the system call number is RAX | ||
59 | * rather than ORIG_RAX, and arg4 is R10 rather than RCX | ||
60 | */ | ||
61 | #define REGS_SYSCALL_NR PT_INDEX(RAX) | ||
62 | #define REGS_SYSCALL_ARG1 PT_INDEX(RDI) | ||
63 | #define REGS_SYSCALL_ARG2 PT_INDEX(RSI) | ||
64 | #define REGS_SYSCALL_ARG3 PT_INDEX(RDX) | ||
65 | #define REGS_SYSCALL_ARG4 PT_INDEX(R10) | ||
66 | #define REGS_SYSCALL_ARG5 PT_INDEX(R8) | ||
67 | #define REGS_SYSCALL_ARG6 PT_INDEX(R9) | ||
68 | |||
69 | #define REGS_IP_INDEX PT_INDEX(RIP) | ||
70 | #define REGS_SP_INDEX PT_INDEX(RSP) | ||
71 | |||
58 | #endif | 72 | #endif |
59 | 73 | ||
60 | /* | 74 | /* |
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h new file mode 100644 index 000000000000..f599058d8263 --- /dev/null +++ b/arch/um/include/sysdep-x86_64/stub.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_STUB_H | ||
7 | #define __SYSDEP_STUB_H | ||
8 | |||
9 | #include <asm/ptrace.h> | ||
10 | #include <asm/unistd.h> | ||
11 | #include <sysdep/ptrace_user.h> | ||
12 | |||
13 | extern void stub_segv_handler(int sig); | ||
14 | extern void stub_clone_handler(void); | ||
15 | |||
16 | #define STUB_SYSCALL_RET PT_INDEX(RAX) | ||
17 | #define STUB_MMAP_NR __NR_mmap | ||
18 | #define MMAP_OFFSET(o) (o) | ||
19 | |||
20 | static inline long stub_syscall2(long syscall, long arg1, long arg2) | ||
21 | { | ||
22 | long ret; | ||
23 | |||
24 | __asm__("movq %0, %%rsi; " : : "g" (arg2) : "%rsi"); | ||
25 | __asm__("movq %0, %%rdi; " : : "g" (arg1) : "%rdi"); | ||
26 | __asm__("movq %0, %%rax; " : : "g" (syscall) : "%rax"); | ||
27 | __asm__("syscall;" : : : "%rax", "%r11", "%rcx"); | ||
28 | __asm__ __volatile__("movq %%rax, %0; " : "=g" (ret) :); | ||
29 | return(ret); | ||
30 | } | ||
31 | |||
32 | static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3) | ||
33 | { | ||
34 | __asm__("movq %0, %%rdx; " : : "g" (arg3) : "%rdx"); | ||
35 | return(stub_syscall2(syscall, arg1, arg2)); | ||
36 | } | ||
37 | |||
38 | static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, | ||
39 | long arg4) | ||
40 | { | ||
41 | __asm__("movq %0, %%r10; " : : "g" (arg4) : "%r10"); | ||
42 | return(stub_syscall3(syscall, arg1, arg2, arg3)); | ||
43 | } | ||
44 | |||
45 | static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, | ||
46 | long arg4, long arg5, long arg6) | ||
47 | { | ||
48 | __asm__("movq %0, %%r9; " : : "g" (arg6) : "%r9"); | ||
49 | __asm__("movq %0, %%r8; " : : "g" (arg5) : "%r8"); | ||
50 | return(stub_syscall4(syscall, arg1, arg2, arg3, arg4)); | ||
51 | } | ||
52 | |||
53 | static inline void trap_myself(void) | ||
54 | { | ||
55 | __asm("int3"); | ||
56 | } | ||
57 | |||
58 | #endif | ||
diff --git a/arch/um/include/time_user.h b/arch/um/include/time_user.h index f64ef77019a3..17d7ef2141f4 100644 --- a/arch/um/include/time_user.h +++ b/arch/um/include/time_user.h | |||
@@ -10,6 +10,7 @@ extern void timer(void); | |||
10 | extern void switch_timers(int to_real); | 10 | extern void switch_timers(int to_real); |
11 | extern void idle_sleep(int secs); | 11 | extern void idle_sleep(int secs); |
12 | extern void enable_timer(void); | 12 | extern void enable_timer(void); |
13 | extern void prepare_timer(void * ptr); | ||
13 | extern void disable_timer(void); | 14 | extern void disable_timer(void); |
14 | extern unsigned long time_lock(void); | 15 | extern unsigned long time_lock(void); |
15 | extern void time_unlock(unsigned long); | 16 | extern void time_unlock(unsigned long); |
diff --git a/arch/um/include/tlb.h b/arch/um/include/tlb.h index da1097285b8c..c6f9628f39bf 100644 --- a/arch/um/include/tlb.h +++ b/arch/um/include/tlb.h | |||
@@ -37,31 +37,25 @@ struct host_vm_op { | |||
37 | extern void mprotect_kernel_vm(int w); | 37 | extern void mprotect_kernel_vm(int w); |
38 | extern void force_flush_all(void); | 38 | extern void force_flush_all(void); |
39 | extern void fix_range_common(struct mm_struct *mm, unsigned long start_addr, | 39 | extern void fix_range_common(struct mm_struct *mm, unsigned long start_addr, |
40 | unsigned long end_addr, int force, int data, | 40 | unsigned long end_addr, int force, |
41 | void (*do_ops)(int, struct host_vm_op *, int)); | 41 | void (*do_ops)(union mm_context *, |
42 | struct host_vm_op *, int)); | ||
42 | extern int flush_tlb_kernel_range_common(unsigned long start, | 43 | extern int flush_tlb_kernel_range_common(unsigned long start, |
43 | unsigned long end); | 44 | unsigned long end); |
44 | 45 | ||
45 | extern int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, | 46 | extern int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, |
46 | int r, int w, int x, struct host_vm_op *ops, int index, | 47 | int r, int w, int x, struct host_vm_op *ops, int index, |
47 | int last_filled, int data, | 48 | int last_filled, union mm_context *mmu, |
48 | void (*do_ops)(int, struct host_vm_op *, int)); | 49 | void (*do_ops)(union mm_context *, struct host_vm_op *, |
50 | int)); | ||
49 | extern int add_munmap(unsigned long addr, unsigned long len, | 51 | extern int add_munmap(unsigned long addr, unsigned long len, |
50 | struct host_vm_op *ops, int index, int last_filled, | 52 | struct host_vm_op *ops, int index, int last_filled, |
51 | int data, void (*do_ops)(int, struct host_vm_op *, int)); | 53 | union mm_context *mmu, |
54 | void (*do_ops)(union mm_context *, struct host_vm_op *, | ||
55 | int)); | ||
52 | extern int add_mprotect(unsigned long addr, unsigned long len, int r, int w, | 56 | extern int add_mprotect(unsigned long addr, unsigned long len, int r, int w, |
53 | int x, struct host_vm_op *ops, int index, | 57 | int x, struct host_vm_op *ops, int index, |
54 | int last_filled, int data, | 58 | int last_filled, union mm_context *mmu, |
55 | void (*do_ops)(int, struct host_vm_op *, int)); | 59 | void (*do_ops)(union mm_context *, struct host_vm_op *, |
60 | int)); | ||
56 | #endif | 61 | #endif |
57 | |||
58 | /* | ||
59 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
60 | * Emacs will notice this stuff at the end of the file and automatically | ||
61 | * adjust the settings for this buffer only. This must remain at the end | ||
62 | * of the file. | ||
63 | * --------------------------------------------------------------------------- | ||
64 | * Local variables: | ||
65 | * c-file-style: "linux" | ||
66 | * End: | ||
67 | */ | ||