diff options
63 files changed, 512 insertions, 812 deletions
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c index b050e267befe..19ea26f32f14 100644 --- a/arch/um/drivers/harddog_user.c +++ b/arch/um/drivers/harddog_user.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include "user.h" | 9 | #include "user.h" |
10 | #include "mconsole.h" | 10 | #include "mconsole.h" |
11 | #include "os.h" | 11 | #include "os.h" |
12 | #include "mode.h" | ||
13 | 12 | ||
14 | struct dog_data { | 13 | struct dog_data { |
15 | int stdin; | 14 | int stdin; |
diff --git a/arch/um/include/arch.h b/arch/um/include/arch.h index 10ad52daa8c5..49c601ff2bac 100644 --- a/arch/um/include/arch.h +++ b/arch/um/include/arch.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #include "sysdep/ptrace.h" | 9 | #include "sysdep/ptrace.h" |
10 | 10 | ||
11 | extern void arch_check_bugs(void); | 11 | extern void arch_check_bugs(void); |
12 | extern int arch_fixup(unsigned long address, union uml_pt_regs *regs); | 12 | extern int arch_fixup(unsigned long address, struct uml_pt_regs *regs); |
13 | extern int arch_handle_signal(int sig, union uml_pt_regs *regs); | 13 | extern int arch_handle_signal(int sig, struct uml_pt_regs *regs); |
14 | 14 | ||
15 | #endif | 15 | #endif |
diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h index e44f32940f8a..2f16a1c7d616 100644 --- a/arch/um/include/as-layout.h +++ b/arch/um/include/as-layout.h | |||
@@ -29,6 +29,6 @@ extern unsigned long brk_start; | |||
29 | 29 | ||
30 | extern int linux_main(int argc, char **argv); | 30 | extern int linux_main(int argc, char **argv); |
31 | 31 | ||
32 | extern void (*sig_info[])(int, union uml_pt_regs *); | 32 | extern void (*sig_info[])(int, struct uml_pt_regs *); |
33 | 33 | ||
34 | #endif | 34 | #endif |
diff --git a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h index 741cb7d6f859..e16ebce1290d 100644 --- a/arch/um/include/irq_user.h +++ b/arch/um/include/irq_user.h | |||
@@ -21,7 +21,7 @@ struct irq_fd { | |||
21 | 21 | ||
22 | enum { IRQ_READ, IRQ_WRITE }; | 22 | enum { IRQ_READ, IRQ_WRITE }; |
23 | 23 | ||
24 | extern void sigio_handler(int sig, union uml_pt_regs *regs); | 24 | extern void sigio_handler(int sig, struct uml_pt_regs *regs); |
25 | extern int activate_fd(int irq, int fd, int type, void *dev_id); | 25 | extern int activate_fd(int irq, int fd, int type, void *dev_id); |
26 | extern void free_irq_by_irq_and_dev(unsigned int irq, void *dev_id); | 26 | extern void free_irq_by_irq_and_dev(unsigned int irq, void *dev_id); |
27 | extern void free_irq_by_fd(int fd); | 27 | extern void free_irq_by_fd(int fd); |
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h index 578156db3039..9d3110f41ddb 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/kern_util.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #include "sysdep/faultinfo.h" | 10 | #include "sysdep/faultinfo.h" |
11 | #include "uml-config.h" | 11 | #include "uml-config.h" |
12 | 12 | ||
13 | typedef void (*kern_hndl)(int, union uml_pt_regs *); | 13 | typedef void (*kern_hndl)(int, struct uml_pt_regs *); |
14 | 14 | ||
15 | struct kern_handlers { | 15 | struct kern_handlers { |
16 | kern_hndl relay_signal; | 16 | kern_hndl relay_signal; |
@@ -41,7 +41,7 @@ extern unsigned long alloc_stack(int order, int atomic); | |||
41 | extern int do_signal(void); | 41 | extern int do_signal(void); |
42 | extern int is_stack_fault(unsigned long sp); | 42 | extern int is_stack_fault(unsigned long sp); |
43 | extern unsigned long segv(struct faultinfo fi, unsigned long ip, | 43 | extern unsigned long segv(struct faultinfo fi, unsigned long ip, |
44 | int is_user, union uml_pt_regs *regs); | 44 | int is_user, struct uml_pt_regs *regs); |
45 | extern int handle_page_fault(unsigned long address, unsigned long ip, | 45 | extern int handle_page_fault(unsigned long address, unsigned long ip, |
46 | int is_write, int is_user, int *code_out); | 46 | int is_write, int is_user, int *code_out); |
47 | extern void syscall_ready(void); | 47 | extern void syscall_ready(void); |
@@ -54,7 +54,7 @@ extern int need_finish_fork(void); | |||
54 | extern void free_stack(unsigned long stack, int order); | 54 | extern void free_stack(unsigned long stack, int order); |
55 | extern void add_input_request(int op, void (*proc)(int), void *arg); | 55 | extern void add_input_request(int op, void (*proc)(int), void *arg); |
56 | extern char *current_cmd(void); | 56 | extern char *current_cmd(void); |
57 | extern void timer_handler(int sig, union uml_pt_regs *regs); | 57 | extern void timer_handler(int sig, struct uml_pt_regs *regs); |
58 | extern int set_signals(int enable); | 58 | extern int set_signals(int enable); |
59 | extern int pid_to_processor_id(int pid); | 59 | extern int pid_to_processor_id(int pid); |
60 | extern void deliver_signals(void *t); | 60 | extern void deliver_signals(void *t); |
@@ -64,9 +64,9 @@ extern void finish_fork(void); | |||
64 | extern void paging_init(void); | 64 | extern void paging_init(void); |
65 | extern void init_flush_vm(void); | 65 | extern void init_flush_vm(void); |
66 | extern void *syscall_sp(void *t); | 66 | extern void *syscall_sp(void *t); |
67 | extern void syscall_trace(union uml_pt_regs *regs, int entryexit); | 67 | extern void syscall_trace(struct uml_pt_regs *regs, int entryexit); |
68 | extern int hz(void); | 68 | extern int hz(void); |
69 | extern unsigned int do_IRQ(int irq, union uml_pt_regs *regs); | 69 | extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs); |
70 | extern void interrupt_end(void); | 70 | extern void interrupt_end(void); |
71 | extern void initial_thread_cb(void (*proc)(void *), void *arg); | 71 | extern void initial_thread_cb(void (*proc)(void *), void *arg); |
72 | extern int debugger_signal(int status, int pid); | 72 | extern int debugger_signal(int status, int pid); |
@@ -76,9 +76,9 @@ extern int init_ptrace_proxy(int idle_pid, int startup, int stop); | |||
76 | extern int init_parent_proxy(int pid); | 76 | extern int init_parent_proxy(int pid); |
77 | extern int singlestepping(void *t); | 77 | extern int singlestepping(void *t); |
78 | extern void check_stack_overflow(void *ptr); | 78 | extern void check_stack_overflow(void *ptr); |
79 | extern void relay_signal(int sig, union uml_pt_regs *regs); | 79 | extern void relay_signal(int sig, struct uml_pt_regs *regs); |
80 | extern int user_context(unsigned long sp); | 80 | extern int user_context(unsigned long sp); |
81 | extern void timer_irq(union uml_pt_regs *regs); | 81 | extern void timer_irq(struct uml_pt_regs *regs); |
82 | extern void do_uml_exitcalls(void); | 82 | extern void do_uml_exitcalls(void); |
83 | extern int attach_debugger(int idle_pid, int pid, int stop); | 83 | extern int attach_debugger(int idle_pid, int pid, int stop); |
84 | extern int config_gdb(char *str); | 84 | extern int config_gdb(char *str); |
@@ -109,11 +109,9 @@ extern void time_init_kern(void); | |||
109 | 109 | ||
110 | /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ | 110 | /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ |
111 | extern int __cant_sleep(void); | 111 | extern int __cant_sleep(void); |
112 | extern void sigio_handler(int sig, union uml_pt_regs *regs); | 112 | extern void sigio_handler(int sig, struct uml_pt_regs *regs); |
113 | 113 | extern void copy_sc(struct uml_pt_regs *regs, void *from); | |
114 | extern void copy_sc(union uml_pt_regs *regs, void *from); | ||
115 | |||
116 | extern unsigned long to_irq_stack(unsigned long *mask_out); | 114 | extern unsigned long to_irq_stack(unsigned long *mask_out); |
117 | unsigned long from_irq_stack(int nested); | 115 | unsigned long from_irq_stack(int nested); |
118 | 116 | extern int start_uml(void); | |
119 | #endif | 117 | #endif |
diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h index b282839c1625..a2c35fecd1f5 100644 --- a/arch/um/include/mconsole.h +++ b/arch/um/include/mconsole.h | |||
@@ -63,7 +63,7 @@ struct mc_request | |||
63 | 63 | ||
64 | struct mconsole_request request; | 64 | struct mconsole_request request; |
65 | struct mconsole_command *cmd; | 65 | struct mconsole_command *cmd; |
66 | union uml_pt_regs regs; | 66 | struct uml_pt_regs regs; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | extern char mconsole_socket_name[]; | 69 | extern char mconsole_socket_name[]; |
diff --git a/arch/um/include/mode.h b/arch/um/include/mode.h deleted file mode 100644 index fcce95cbc16a..000000000000 --- a/arch/um/include/mode.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __MODE_H__ | ||
7 | #define __MODE_H__ | ||
8 | |||
9 | #include "mode-skas.h" | ||
10 | |||
11 | #endif | ||
diff --git a/arch/um/include/mode_kern.h b/arch/um/include/mode_kern.h deleted file mode 100644 index b2a44c0dcd00..000000000000 --- a/arch/um/include/mode_kern.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __MODE_KERN_H__ | ||
7 | #define __MODE_KERN_H__ | ||
8 | |||
9 | #include "mode_kern_skas.h" | ||
10 | |||
11 | #endif | ||
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 208d9b91fc93..daf188843a94 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h | |||
@@ -281,9 +281,9 @@ extern int protect(struct mm_id * mm_idp, unsigned long addr, | |||
281 | extern int is_skas_winch(int pid, int fd, void *data); | 281 | extern int is_skas_winch(int pid, int fd, void *data); |
282 | extern int start_userspace(unsigned long stub_stack); | 282 | extern int start_userspace(unsigned long stub_stack); |
283 | extern int copy_context_skas0(unsigned long stack, int pid); | 283 | extern int copy_context_skas0(unsigned long stack, int pid); |
284 | extern void save_registers(int pid, union uml_pt_regs *regs); | 284 | extern void save_registers(int pid, struct uml_pt_regs *regs); |
285 | extern void restore_registers(int pid, union uml_pt_regs *regs); | 285 | extern void restore_registers(int pid, struct uml_pt_regs *regs); |
286 | extern void userspace(union uml_pt_regs *regs); | 286 | extern void userspace(struct uml_pt_regs *regs); |
287 | extern void map_stub_pages(int fd, unsigned long code, | 287 | extern void map_stub_pages(int fd, unsigned long code, |
288 | unsigned long data, unsigned long stack); | 288 | unsigned long data, unsigned long stack); |
289 | extern void new_thread(void *stack, jmp_buf *buf, void (*handler)(void)); | 289 | extern void new_thread(void *stack, jmp_buf *buf, void (*handler)(void)); |
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h index b7d2c4e2c613..8e8ea9651189 100644 --- a/arch/um/include/registers.h +++ b/arch/um/include/registers.h | |||
@@ -9,11 +9,11 @@ | |||
9 | #include "sysdep/ptrace.h" | 9 | #include "sysdep/ptrace.h" |
10 | #include "sysdep/archsetjmp.h" | 10 | #include "sysdep/archsetjmp.h" |
11 | 11 | ||
12 | extern void init_thread_registers(union uml_pt_regs *to); | 12 | extern void init_thread_registers(struct uml_pt_regs *to); |
13 | extern int save_fp_registers(int pid, unsigned long *fp_regs); | 13 | extern int save_fp_registers(int pid, unsigned long *fp_regs); |
14 | extern int restore_fp_registers(int pid, unsigned long *fp_regs); | 14 | extern int restore_fp_registers(int pid, unsigned long *fp_regs); |
15 | extern void save_registers(int pid, union uml_pt_regs *regs); | 15 | extern void save_registers(int pid, struct uml_pt_regs *regs); |
16 | extern void restore_registers(int pid, union uml_pt_regs *regs); | 16 | extern void restore_registers(int pid, struct uml_pt_regs *regs); |
17 | extern void init_registers(int pid); | 17 | extern void init_registers(int pid); |
18 | extern void get_safe_registers(unsigned long *regs); | 18 | extern void get_safe_registers(unsigned long *regs); |
19 | extern unsigned long get_thread_reg(int reg, jmp_buf *buf); | 19 | extern unsigned long get_thread_reg(int reg, jmp_buf *buf); |
diff --git a/arch/um/include/skas/mmu-skas.h b/arch/um/include/skas/mmu-skas.h index b26986c0c3d2..838dfd75e2aa 100644 --- a/arch/um/include/skas/mmu-skas.h +++ b/arch/um/include/skas/mmu-skas.h | |||
@@ -18,6 +18,6 @@ struct mmu_context_skas { | |||
18 | uml_ldt_t ldt; | 18 | uml_ldt_t ldt; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | extern void switch_mm_skas(struct mm_id * mm_idp); | 21 | extern void __switch_mm(struct mm_id * mm_idp); |
22 | 22 | ||
23 | #endif | 23 | #endif |
diff --git a/arch/um/include/skas/mode_kern_skas.h b/arch/um/include/skas/mode_kern_skas.h deleted file mode 100644 index c29485109a9a..000000000000 --- a/arch/um/include/skas/mode_kern_skas.h +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SKAS_MODE_KERN_H__ | ||
7 | #define __SKAS_MODE_KERN_H__ | ||
8 | |||
9 | #include "linux/sched.h" | ||
10 | #include "asm/page.h" | ||
11 | #include "asm/ptrace.h" | ||
12 | #include "mem_user.h" | ||
13 | |||
14 | extern void flush_thread_skas(void); | ||
15 | extern void switch_to_skas(void *prev, void *next); | ||
16 | extern void start_thread_skas(struct pt_regs *regs, unsigned long eip, | ||
17 | unsigned long esp); | ||
18 | extern int copy_thread_skas(int nr, unsigned long clone_flags, | ||
19 | unsigned long sp, unsigned long stack_top, | ||
20 | struct task_struct *p, struct pt_regs *regs); | ||
21 | extern void release_thread_skas(struct task_struct *task); | ||
22 | extern void init_idle_skas(void); | ||
23 | extern void flush_tlb_kernel_range_skas(unsigned long start, | ||
24 | unsigned long end); | ||
25 | extern void flush_tlb_kernel_vm_skas(void); | ||
26 | extern void __flush_tlb_one_skas(unsigned long addr); | ||
27 | extern void flush_tlb_range_skas(struct vm_area_struct *vma, | ||
28 | unsigned long start, unsigned long end); | ||
29 | extern void flush_tlb_mm_skas(struct mm_struct *mm); | ||
30 | extern void force_flush_all_skas(void); | ||
31 | extern long execute_syscall_skas(void *r); | ||
32 | extern void before_mem_skas(unsigned long unused); | ||
33 | extern unsigned long set_task_sizes_skas(unsigned long *task_size_out); | ||
34 | extern int start_uml_skas(void); | ||
35 | extern int external_pid_skas(struct task_struct *task); | ||
36 | extern int thread_pid_skas(struct task_struct *task); | ||
37 | extern void flush_tlb_page_skas(struct vm_area_struct *vma, | ||
38 | unsigned long address); | ||
39 | |||
40 | #define kmem_end_skas (host_task_size - 1024 * 1024) | ||
41 | |||
42 | #endif | ||
diff --git a/arch/um/include/skas/skas.h b/arch/um/include/skas/skas.h index e88926b16072..b4a95e485929 100644 --- a/arch/um/include/skas/skas.h +++ b/arch/um/include/skas/skas.h | |||
@@ -15,7 +15,7 @@ extern int skas_needs_stub; | |||
15 | 15 | ||
16 | extern int user_thread(unsigned long stack, int flags); | 16 | extern int user_thread(unsigned long stack, int flags); |
17 | extern void new_thread_handler(void); | 17 | extern void new_thread_handler(void); |
18 | extern void handle_syscall(union uml_pt_regs *regs); | 18 | extern void handle_syscall(struct uml_pt_regs *regs); |
19 | extern int new_mm(unsigned long stack); | 19 | extern int new_mm(unsigned long stack); |
20 | extern void get_skas_faultinfo(int pid, struct faultinfo * fi); | 20 | extern void get_skas_faultinfo(int pid, struct faultinfo * fi); |
21 | extern long execute_syscall_skas(void *r); | 21 | extern long execute_syscall_skas(void *r); |
diff --git a/arch/um/include/sysdep-i386/ptrace.h b/arch/um/include/sysdep-i386/ptrace.h index 45573088864c..d765175d42be 100644 --- a/arch/um/include/sysdep-i386/ptrace.h +++ b/arch/um/include/sysdep-i386/ptrace.h | |||
@@ -52,37 +52,34 @@ extern int sysemu_supported; | |||
52 | #define PTRACE_SYSEMU_SINGLESTEP 32 | 52 | #define PTRACE_SYSEMU_SINGLESTEP 32 |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | union uml_pt_regs { | 55 | struct uml_pt_regs { |
56 | struct skas_regs { | 56 | unsigned long regs[MAX_REG_NR]; |
57 | unsigned long regs[MAX_REG_NR]; | 57 | unsigned long fp[HOST_FP_SIZE]; |
58 | unsigned long fp[HOST_FP_SIZE]; | 58 | unsigned long xfp[HOST_XFP_SIZE]; |
59 | unsigned long xfp[HOST_XFP_SIZE]; | 59 | struct faultinfo faultinfo; |
60 | struct faultinfo faultinfo; | 60 | long syscall; |
61 | long syscall; | 61 | int is_user; |
62 | int is_user; | ||
63 | } skas; | ||
64 | }; | 62 | }; |
65 | 63 | ||
66 | #define EMPTY_UML_PT_REGS { } | 64 | #define EMPTY_UML_PT_REGS { } |
67 | 65 | ||
68 | #define UPT_SC(r) ((r)->tt.sc) | 66 | #define UPT_IP(r) REGS_IP((r)->regs) |
69 | #define UPT_IP(r) REGS_IP((r)->skas.regs) | 67 | #define UPT_SP(r) REGS_SP((r)->regs) |
70 | #define UPT_SP(r) REGS_SP((r)->skas.regs) | 68 | #define UPT_EFLAGS(r) REGS_EFLAGS((r)->regs) |
71 | #define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs) | 69 | #define UPT_EAX(r) REGS_EAX((r)->regs) |
72 | #define UPT_EAX(r) REGS_EAX((r)->skas.regs) | 70 | #define UPT_EBX(r) REGS_EBX((r)->regs) |
73 | #define UPT_EBX(r) REGS_EBX((r)->skas.regs) | 71 | #define UPT_ECX(r) REGS_ECX((r)->regs) |
74 | #define UPT_ECX(r) REGS_ECX((r)->skas.regs) | 72 | #define UPT_EDX(r) REGS_EDX((r)->regs) |
75 | #define UPT_EDX(r) REGS_EDX((r)->skas.regs) | 73 | #define UPT_ESI(r) REGS_ESI((r)->regs) |
76 | #define UPT_ESI(r) REGS_ESI((r)->skas.regs) | 74 | #define UPT_EDI(r) REGS_EDI((r)->regs) |
77 | #define UPT_EDI(r) REGS_EDI((r)->skas.regs) | 75 | #define UPT_EBP(r) REGS_EBP((r)->regs) |
78 | #define UPT_EBP(r) REGS_EBP((r)->skas.regs) | 76 | #define UPT_ORIG_EAX(r) ((r)->syscall) |
79 | #define UPT_ORIG_EAX(r) ((r)->skas.syscall) | 77 | #define UPT_CS(r) REGS_CS((r)->regs) |
80 | #define UPT_CS(r) REGS_CS((r)->skas.regs) | 78 | #define UPT_SS(r) REGS_SS((r)->regs) |
81 | #define UPT_SS(r) REGS_SS((r)->skas.regs) | 79 | #define UPT_DS(r) REGS_DS((r)->regs) |
82 | #define UPT_DS(r) REGS_DS((r)->skas.regs) | 80 | #define UPT_ES(r) REGS_ES((r)->regs) |
83 | #define UPT_ES(r) REGS_ES((r)->skas.regs) | 81 | #define UPT_FS(r) REGS_FS((r)->regs) |
84 | #define UPT_FS(r) REGS_FS((r)->skas.regs) | 82 | #define UPT_GS(r) REGS_GS((r)->regs) |
85 | #define UPT_GS(r) REGS_GS((r)->skas.regs) | ||
86 | 83 | ||
87 | #define UPT_SYSCALL_ARG1(r) UPT_EBX(r) | 84 | #define UPT_SYSCALL_ARG1(r) UPT_EBX(r) |
88 | #define UPT_SYSCALL_ARG2(r) UPT_ECX(r) | 85 | #define UPT_SYSCALL_ARG2(r) UPT_ECX(r) |
@@ -93,7 +90,7 @@ union uml_pt_regs { | |||
93 | 90 | ||
94 | extern int user_context(unsigned long sp); | 91 | extern int user_context(unsigned long sp); |
95 | 92 | ||
96 | #define UPT_IS_USER(r) ((r)->skas.is_user) | 93 | #define UPT_IS_USER(r) ((r)->is_user) |
97 | 94 | ||
98 | struct syscall_args { | 95 | struct syscall_args { |
99 | unsigned long args[6]; | 96 | unsigned long args[6]; |
@@ -162,14 +159,14 @@ struct syscall_args { | |||
162 | } while (0) | 159 | } while (0) |
163 | 160 | ||
164 | #define UPT_SET_SYSCALL_RETURN(r, res) \ | 161 | #define UPT_SET_SYSCALL_RETURN(r, res) \ |
165 | REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)) | 162 | REGS_SET_SYSCALL_RETURN((r)->regs, (res)) |
166 | 163 | ||
167 | #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs) | 164 | #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->regs) |
168 | 165 | ||
169 | #define UPT_ORIG_SYSCALL(r) UPT_EAX(r) | 166 | #define UPT_ORIG_SYSCALL(r) UPT_EAX(r) |
170 | #define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r) | 167 | #define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r) |
171 | #define UPT_SYSCALL_RET(r) UPT_EAX(r) | 168 | #define UPT_SYSCALL_RET(r) UPT_EAX(r) |
172 | 169 | ||
173 | #define UPT_FAULTINFO(r) (&(r)->skas.faultinfo) | 170 | #define UPT_FAULTINFO(r) (&(r)->faultinfo) |
174 | 171 | ||
175 | #endif | 172 | #endif |
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h index b3412b64cbea..ea4afdce59c1 100644 --- a/arch/um/include/sysdep-x86_64/ptrace.h +++ b/arch/um/include/sysdep-x86_64/ptrace.h | |||
@@ -84,58 +84,52 @@ | |||
84 | 84 | ||
85 | #define REGS_ERR(r) ((r)->fault_type) | 85 | #define REGS_ERR(r) ((r)->fault_type) |
86 | 86 | ||
87 | /* XXX */ | 87 | struct uml_pt_regs { |
88 | union uml_pt_regs { | 88 | unsigned long regs[MAX_REG_NR]; |
89 | struct skas_regs { | 89 | unsigned long fp[HOST_FP_SIZE]; |
90 | unsigned long regs[MAX_REG_NR]; | 90 | struct faultinfo faultinfo; |
91 | unsigned long fp[HOST_FP_SIZE]; | 91 | long syscall; |
92 | struct faultinfo faultinfo; | 92 | int is_user; |
93 | long syscall; | ||
94 | int is_user; | ||
95 | } skas; | ||
96 | }; | 93 | }; |
97 | 94 | ||
98 | #define EMPTY_UML_PT_REGS { } | 95 | #define EMPTY_UML_PT_REGS { } |
99 | 96 | ||
100 | #define UPT_RBX(r) REGS_RBX((r)->skas.regs) | 97 | #define UPT_RBX(r) REGS_RBX((r)->regs) |
101 | #define UPT_RCX(r) REGS_RCX((r)->skas.regs) | 98 | #define UPT_RCX(r) REGS_RCX((r)->regs) |
102 | #define UPT_RDX(r) REGS_RDX((r)->skas.regs) | 99 | #define UPT_RDX(r) REGS_RDX((r)->regs) |
103 | #define UPT_RSI(r) REGS_RSI((r)->skas.regs) | 100 | #define UPT_RSI(r) REGS_RSI((r)->regs) |
104 | #define UPT_RDI(r) REGS_RDI((r)->skas.regs) | 101 | #define UPT_RDI(r) REGS_RDI((r)->regs) |
105 | #define UPT_RBP(r) REGS_RBP((r)->skas.regs) | 102 | #define UPT_RBP(r) REGS_RBP((r)->regs) |
106 | #define UPT_RAX(r) REGS_RAX((r)->skas.regs) | 103 | #define UPT_RAX(r) REGS_RAX((r)->regs) |
107 | #define UPT_R8(r) REGS_R8((r)->skas.regs) | 104 | #define UPT_R8(r) REGS_R8((r)->regs) |
108 | #define UPT_R9(r) REGS_R9((r)->skas.regs) | 105 | #define UPT_R9(r) REGS_R9((r)->regs) |
109 | #define UPT_R10(r) REGS_R10((r)->skas.regs) | 106 | #define UPT_R10(r) REGS_R10((r)->regs) |
110 | #define UPT_R11(r) REGS_R11((r)->skas.regs) | 107 | #define UPT_R11(r) REGS_R11((r)->regs) |
111 | #define UPT_R12(r) REGS_R12((r)->skas.regs) | 108 | #define UPT_R12(r) REGS_R12((r)->regs) |
112 | #define UPT_R13(r) REGS_R13((r)->skas.regs) | 109 | #define UPT_R13(r) REGS_R13((r)->regs) |
113 | #define UPT_R14(r) REGS_R14((r)->skas.regs) | 110 | #define UPT_R14(r) REGS_R14((r)->regs) |
114 | #define UPT_R15(r) REGS_R15((r)->skas.regs) | 111 | #define UPT_R15(r) REGS_R15((r)->regs) |
115 | #define UPT_CS(r) REGS_CS((r)->skas.regs) | 112 | #define UPT_CS(r) REGS_CS((r)->regs) |
116 | #define UPT_FS_BASE(r) \ | 113 | #define UPT_FS_BASE(r) REGS_FS_BASE((r)->regs) |
117 | REGS_FS_BASE((r)->skas.regs) | 114 | #define UPT_FS(r) REGS_FS((r)->regs) |
118 | #define UPT_FS(r) REGS_FS((r)->skas.regs) | 115 | #define UPT_GS_BASE(r) REGS_GS_BASE((r)->regs) |
119 | #define UPT_GS_BASE(r) \ | 116 | #define UPT_GS(r) REGS_GS((r)->regs) |
120 | REGS_GS_BASE((r)->skas.regs) | 117 | #define UPT_DS(r) REGS_DS((r)->regs) |
121 | #define UPT_GS(r) REGS_GS((r)->skas.regs) | 118 | #define UPT_ES(r) REGS_ES((r)->regs) |
122 | #define UPT_DS(r) REGS_DS((r)->skas.regs) | 119 | #define UPT_CS(r) REGS_CS((r)->regs) |
123 | #define UPT_ES(r) REGS_ES((r)->skas.regs) | 120 | #define UPT_SS(r) REGS_SS((r)->regs) |
124 | #define UPT_CS(r) REGS_CS((r)->skas.regs) | 121 | #define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->regs) |
125 | #define UPT_SS(r) REGS_SS((r)->skas.regs) | 122 | |
126 | #define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->skas.regs) | 123 | #define UPT_IP(r) REGS_IP((r)->regs) |
127 | 124 | #define UPT_SP(r) REGS_SP((r)->regs) | |
128 | #define UPT_IP(r) REGS_IP((r)->skas.regs) | 125 | |
129 | #define UPT_SP(r) REGS_SP((r)->skas.regs) | 126 | #define UPT_EFLAGS(r) REGS_EFLAGS((r)->regs) |
130 | 127 | #define UPT_SYSCALL_NR(r) ((r)->syscall) | |
131 | #define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs) | ||
132 | #define UPT_SC(r) ((r)->tt.sc) | ||
133 | #define UPT_SYSCALL_NR(r) ((r)->skas.syscall) | ||
134 | #define UPT_SYSCALL_RET(r) UPT_RAX(r) | 128 | #define UPT_SYSCALL_RET(r) UPT_RAX(r) |
135 | 129 | ||
136 | extern int user_context(unsigned long sp); | 130 | extern int user_context(unsigned long sp); |
137 | 131 | ||
138 | #define UPT_IS_USER(r) ((r)->skas.is_user) | 132 | #define UPT_IS_USER(r) ((r)->is_user) |
139 | 133 | ||
140 | #define UPT_SYSCALL_ARG1(r) UPT_RDI(r) | 134 | #define UPT_SYSCALL_ARG1(r) UPT_RDI(r) |
141 | #define UPT_SYSCALL_ARG2(r) UPT_RSI(r) | 135 | #define UPT_SYSCALL_ARG2(r) UPT_RSI(r) |
@@ -232,12 +226,12 @@ struct syscall_args { | |||
232 | }) | 226 | }) |
233 | 227 | ||
234 | #define UPT_SET_SYSCALL_RETURN(r, res) \ | 228 | #define UPT_SET_SYSCALL_RETURN(r, res) \ |
235 | REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)) | 229 | REGS_SET_SYSCALL_RETURN((r)->regs, (res)) |
236 | 230 | ||
237 | #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs) | 231 | #define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->regs) |
238 | 232 | ||
239 | #define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas) | 233 | #define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas) |
240 | 234 | ||
241 | #define UPT_FAULTINFO(r) (&(r)->skas.faultinfo) | 235 | #define UPT_FAULTINFO(r) (&(r)->faultinfo) |
242 | 236 | ||
243 | #endif | 237 | #endif |
diff --git a/arch/um/include/task.h b/arch/um/include/task.h index 6375ba7203c9..3fe726b3cf48 100644 --- a/arch/um/include/task.h +++ b/arch/um/include/task.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <kern_constants.h> | 4 | #include <kern_constants.h> |
5 | 5 | ||
6 | #define TASK_REGS(task) ((union uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) | 6 | #define TASK_REGS(task) ((struct uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) |
7 | #define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID])) | 7 | #define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID])) |
8 | 8 | ||
9 | #endif | 9 | #endif |
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 8f774c25b765..5064fb691eb5 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -18,17 +18,31 @@ | |||
18 | #include "irq_user.h" | 18 | #include "irq_user.h" |
19 | #include "tlb.h" | 19 | #include "tlb.h" |
20 | #include "os.h" | 20 | #include "os.h" |
21 | #include "mode_kern.h" | 21 | #include "skas/skas.h" |
22 | 22 | ||
23 | void flush_thread(void) | 23 | void flush_thread(void) |
24 | { | 24 | { |
25 | void *data = NULL; | ||
26 | unsigned long end = proc_mm ? task_size : CONFIG_STUB_START; | ||
27 | int ret; | ||
28 | |||
25 | arch_flush_thread(¤t->thread.arch); | 29 | arch_flush_thread(¤t->thread.arch); |
26 | flush_thread_skas(); | 30 | |
31 | ret = unmap(¤t->mm->context.skas.id, 0, end, 1, &data); | ||
32 | if(ret){ | ||
33 | printk("flush_thread - clearing address space failed, " | ||
34 | "err = %d\n", ret); | ||
35 | force_sig(SIGKILL, current); | ||
36 | } | ||
37 | |||
38 | __switch_mm(¤t->mm->context.skas.id); | ||
27 | } | 39 | } |
28 | 40 | ||
29 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | 41 | void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) |
30 | { | 42 | { |
31 | start_thread_skas(regs, eip, esp); | 43 | set_fs(USER_DS); |
44 | PT_REGS_IP(regs) = eip; | ||
45 | PT_REGS_SP(regs) = esp; | ||
32 | } | 46 | } |
33 | 47 | ||
34 | #ifdef CONFIG_TTY_LOG | 48 | #ifdef CONFIG_TTY_LOG |
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index ec1ed680032b..b10ee28b97cb 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c | |||
@@ -91,7 +91,7 @@ static struct irq_fd **last_irq_ptr = &active_fds; | |||
91 | 91 | ||
92 | extern void free_irqs(void); | 92 | extern void free_irqs(void); |
93 | 93 | ||
94 | void sigio_handler(int sig, union uml_pt_regs *regs) | 94 | void sigio_handler(int sig, struct uml_pt_regs *regs) |
95 | { | 95 | { |
96 | struct irq_fd *irq_fd; | 96 | struct irq_fd *irq_fd; |
97 | int n; | 97 | int n; |
@@ -344,7 +344,7 @@ int deactivate_all_fds(void) | |||
344 | * SMP cross-CPU interrupts have their own specific | 344 | * SMP cross-CPU interrupts have their own specific |
345 | * handlers). | 345 | * handlers). |
346 | */ | 346 | */ |
347 | unsigned int do_IRQ(int irq, union uml_pt_regs *regs) | 347 | unsigned int do_IRQ(int irq, struct uml_pt_regs *regs) |
348 | { | 348 | { |
349 | struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs); | 349 | struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs); |
350 | irq_enter(); | 350 | irq_enter(); |
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index f7b2f3594793..90e89e838173 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include "as-layout.h" | 10 | #include "as-layout.h" |
11 | #include "init.h" | 11 | #include "init.h" |
12 | #include "kern.h" | 12 | #include "kern.h" |
13 | #include "mode_kern.h" | 13 | #include "mem_user.h" |
14 | #include "os.h" | 14 | #include "os.h" |
15 | 15 | ||
16 | static int physmem_fd = -1; | 16 | static int physmem_fd = -1; |
@@ -61,7 +61,7 @@ static unsigned long kmem_top = 0; | |||
61 | unsigned long get_kmem_end(void) | 61 | unsigned long get_kmem_end(void) |
62 | { | 62 | { |
63 | if (kmem_top == 0) | 63 | if (kmem_top == 0) |
64 | kmem_top = kmem_end_skas; | 64 | kmem_top = host_task_size - 1024 * 1024; |
65 | return kmem_top; | 65 | return kmem_top; |
66 | } | 66 | } |
67 | 67 | ||
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 22ad46fd2c08..d3b9c62e73c7 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -43,8 +43,7 @@ | |||
43 | #include "frame_kern.h" | 43 | #include "frame_kern.h" |
44 | #include "sigcontext.h" | 44 | #include "sigcontext.h" |
45 | #include "os.h" | 45 | #include "os.h" |
46 | #include "mode.h" | 46 | #include "skas.h" |
47 | #include "mode_kern.h" | ||
48 | 47 | ||
49 | /* This is a per-cpu array. A processor only modifies its entry and it only | 48 | /* This is a per-cpu array. A processor only modifies its entry and it only |
50 | * cares about its entry, so it's OK if another processor is modifying its | 49 | * cares about its entry, so it's OK if another processor is modifying its |
@@ -54,7 +53,8 @@ struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { -1, NULL } }; | |||
54 | 53 | ||
55 | static inline int external_pid(struct task_struct *task) | 54 | static inline int external_pid(struct task_struct *task) |
56 | { | 55 | { |
57 | return external_pid_skas(task); | 56 | /* FIXME: Need to look up userspace_pid by cpu */ |
57 | return(userspace_pid[0]); | ||
58 | } | 58 | } |
59 | 59 | ||
60 | int pid_to_processor_id(int pid) | 60 | int pid_to_processor_id(int pid) |
@@ -104,6 +104,8 @@ static inline void set_current(struct task_struct *task) | |||
104 | { external_pid(task), task }); | 104 | { external_pid(task), task }); |
105 | } | 105 | } |
106 | 106 | ||
107 | extern void arch_switch_to(struct task_struct *from, struct task_struct *to); | ||
108 | |||
107 | void *_switch_to(void *prev, void *next, void *last) | 109 | void *_switch_to(void *prev, void *next, void *last) |
108 | { | 110 | { |
109 | struct task_struct *from = prev; | 111 | struct task_struct *from = prev; |
@@ -114,7 +116,19 @@ void *_switch_to(void *prev, void *next, void *last) | |||
114 | 116 | ||
115 | do { | 117 | do { |
116 | current->thread.saved_task = NULL; | 118 | current->thread.saved_task = NULL; |
117 | switch_to_skas(prev, next); | 119 | |
120 | /* XXX need to check runqueues[cpu].idle */ | ||
121 | if(current->pid == 0) | ||
122 | switch_timers(0); | ||
123 | |||
124 | switch_threads(&from->thread.switch_buf, | ||
125 | &to->thread.switch_buf); | ||
126 | |||
127 | arch_switch_to(current->thread.prev_sched, current); | ||
128 | |||
129 | if(current->pid == 0) | ||
130 | switch_timers(1); | ||
131 | |||
118 | if(current->thread.saved_task) | 132 | if(current->thread.saved_task) |
119 | show_regs(&(current->thread.regs)); | 133 | show_regs(&(current->thread.regs)); |
120 | next= current->thread.saved_task; | 134 | next= current->thread.saved_task; |
@@ -133,11 +147,6 @@ void interrupt_end(void) | |||
133 | do_signal(); | 147 | do_signal(); |
134 | } | 148 | } |
135 | 149 | ||
136 | void release_thread(struct task_struct *task) | ||
137 | { | ||
138 | release_thread_skas(task); | ||
139 | } | ||
140 | |||
141 | void exit_thread(void) | 150 | void exit_thread(void) |
142 | { | 151 | { |
143 | } | 152 | } |
@@ -147,27 +156,95 @@ void *get_current(void) | |||
147 | return current; | 156 | return current; |
148 | } | 157 | } |
149 | 158 | ||
159 | extern void schedule_tail(struct task_struct *prev); | ||
160 | |||
161 | /* This is called magically, by its address being stuffed in a jmp_buf | ||
162 | * and being longjmp-d to. | ||
163 | */ | ||
164 | void new_thread_handler(void) | ||
165 | { | ||
166 | int (*fn)(void *), n; | ||
167 | void *arg; | ||
168 | |||
169 | if(current->thread.prev_sched != NULL) | ||
170 | schedule_tail(current->thread.prev_sched); | ||
171 | current->thread.prev_sched = NULL; | ||
172 | |||
173 | fn = current->thread.request.u.thread.proc; | ||
174 | arg = current->thread.request.u.thread.arg; | ||
175 | |||
176 | /* The return value is 1 if the kernel thread execs a process, | ||
177 | * 0 if it just exits | ||
178 | */ | ||
179 | n = run_kernel_thread(fn, arg, ¤t->thread.exec_buf); | ||
180 | if(n == 1){ | ||
181 | /* Handle any immediate reschedules or signals */ | ||
182 | interrupt_end(); | ||
183 | userspace(¤t->thread.regs.regs); | ||
184 | } | ||
185 | else do_exit(0); | ||
186 | } | ||
187 | |||
188 | /* Called magically, see new_thread_handler above */ | ||
189 | void fork_handler(void) | ||
190 | { | ||
191 | force_flush_all(); | ||
192 | if(current->thread.prev_sched == NULL) | ||
193 | panic("blech"); | ||
194 | |||
195 | schedule_tail(current->thread.prev_sched); | ||
196 | |||
197 | /* XXX: if interrupt_end() calls schedule, this call to | ||
198 | * arch_switch_to isn't needed. We could want to apply this to | ||
199 | * improve performance. -bb */ | ||
200 | arch_switch_to(current->thread.prev_sched, current); | ||
201 | |||
202 | current->thread.prev_sched = NULL; | ||
203 | |||
204 | /* Handle any immediate reschedules or signals */ | ||
205 | interrupt_end(); | ||
206 | |||
207 | userspace(¤t->thread.regs.regs); | ||
208 | } | ||
209 | |||
150 | int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, | 210 | int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, |
151 | unsigned long stack_top, struct task_struct * p, | 211 | unsigned long stack_top, struct task_struct * p, |
152 | struct pt_regs *regs) | 212 | struct pt_regs *regs) |
153 | { | 213 | { |
154 | int ret; | 214 | void (*handler)(void); |
215 | int ret = 0; | ||
155 | 216 | ||
156 | p->thread = (struct thread_struct) INIT_THREAD; | 217 | p->thread = (struct thread_struct) INIT_THREAD; |
157 | ret = copy_thread_skas(nr, clone_flags, sp, stack_top, p, regs); | ||
158 | 218 | ||
159 | if (ret || !current->thread.forking) | 219 | if(current->thread.forking){ |
160 | goto out; | 220 | memcpy(&p->thread.regs.regs, ®s->regs, |
221 | sizeof(p->thread.regs.regs)); | ||
222 | REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.regs, 0); | ||
223 | if(sp != 0) | ||
224 | REGS_SP(p->thread.regs.regs.regs) = sp; | ||
161 | 225 | ||
162 | clear_flushed_tls(p); | 226 | handler = fork_handler; |
163 | 227 | ||
164 | /* | 228 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); |
165 | * Set a new TLS for the child thread? | 229 | } |
166 | */ | 230 | else { |
167 | if (clone_flags & CLONE_SETTLS) | 231 | init_thread_registers(&p->thread.regs.regs); |
168 | ret = arch_copy_tls(p); | 232 | p->thread.request.u.thread = current->thread.request.u.thread; |
233 | handler = new_thread_handler; | ||
234 | } | ||
235 | |||
236 | new_thread(task_stack_page(p), &p->thread.switch_buf, handler); | ||
237 | |||
238 | if (current->thread.forking) { | ||
239 | clear_flushed_tls(p); | ||
240 | |||
241 | /* | ||
242 | * Set a new TLS for the child thread? | ||
243 | */ | ||
244 | if (clone_flags & CLONE_SETTLS) | ||
245 | ret = arch_copy_tls(p); | ||
246 | } | ||
169 | 247 | ||
170 | out: | ||
171 | return ret; | 248 | return ret; |
172 | } | 249 | } |
173 | 250 | ||
@@ -198,7 +275,8 @@ void default_idle(void) | |||
198 | 275 | ||
199 | void cpu_idle(void) | 276 | void cpu_idle(void) |
200 | { | 277 | { |
201 | init_idle_skas(); | 278 | cpu_tasks[current_thread->cpu].pid = os_getpid(); |
279 | default_idle(); | ||
202 | } | 280 | } |
203 | 281 | ||
204 | void *um_virt_to_phys(struct task_struct *task, unsigned long addr, | 282 | void *um_virt_to_phys(struct task_struct *task, unsigned long addr, |
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 36debc0de594..bbc3a4a9a0fa 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -228,7 +228,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
228 | #ifdef PTRACE_ARCH_PRCTL | 228 | #ifdef PTRACE_ARCH_PRCTL |
229 | case PTRACE_ARCH_PRCTL: | 229 | case PTRACE_ARCH_PRCTL: |
230 | /* XXX Calls ptrace on the host - needs some SMP thinking */ | 230 | /* XXX Calls ptrace on the host - needs some SMP thinking */ |
231 | ret = arch_prctl_skas(child, data, (void *) addr); | 231 | ret = arch_prctl(child, data, (void *) addr); |
232 | break; | 232 | break; |
233 | #endif | 233 | #endif |
234 | default: | 234 | default: |
@@ -239,7 +239,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
239 | return ret; | 239 | return ret; |
240 | } | 240 | } |
241 | 241 | ||
242 | void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, | 242 | void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs, |
243 | int error_code) | 243 | int error_code) |
244 | { | 244 | { |
245 | struct siginfo info; | 245 | struct siginfo info; |
@@ -258,7 +258,7 @@ void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, | |||
258 | /* XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and | 258 | /* XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and |
259 | * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check | 259 | * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check |
260 | */ | 260 | */ |
261 | void syscall_trace(union uml_pt_regs *regs, int entryexit) | 261 | void syscall_trace(struct uml_pt_regs *regs, int entryexit) |
262 | { | 262 | { |
263 | int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit; | 263 | int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit; |
264 | int tracesysgood; | 264 | int tracesysgood; |
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c index 4a0def32e323..f3bd18bbf07f 100644 --- a/arch/um/kernel/reboot.c +++ b/arch/um/kernel/reboot.c | |||
@@ -9,13 +9,30 @@ | |||
9 | #include "kern_util.h" | 9 | #include "kern_util.h" |
10 | #include "kern.h" | 10 | #include "kern.h" |
11 | #include "os.h" | 11 | #include "os.h" |
12 | #include "mode.h" | 12 | #include "skas.h" |
13 | 13 | ||
14 | void (*pm_power_off)(void); | 14 | void (*pm_power_off)(void); |
15 | 15 | ||
16 | static void kill_off_processes(void) | 16 | static void kill_off_processes(void) |
17 | { | 17 | { |
18 | kill_off_processes_skas(); | 18 | if(proc_mm) |
19 | /* | ||
20 | * FIXME: need to loop over userspace_pids | ||
21 | */ | ||
22 | os_kill_ptraced_process(userspace_pid[0], 1); | ||
23 | else { | ||
24 | struct task_struct *p; | ||
25 | int pid, me; | ||
26 | |||
27 | me = os_getpid(); | ||
28 | for_each_process(p){ | ||
29 | if(p->mm == NULL) | ||
30 | continue; | ||
31 | |||
32 | pid = p->mm->context.skas.id.u.pid; | ||
33 | os_kill_ptraced_process(pid, 1); | ||
34 | } | ||
35 | } | ||
19 | } | 36 | } |
20 | 37 | ||
21 | void uml_cleanup(void) | 38 | void uml_cleanup(void) |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index c4020c3d7857..4dab7e417ba9 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "kern.h" | 23 | #include "kern.h" |
24 | #include "frame_kern.h" | 24 | #include "frame_kern.h" |
25 | #include "sigcontext.h" | 25 | #include "sigcontext.h" |
26 | #include "mode.h" | ||
27 | 26 | ||
28 | EXPORT_SYMBOL(block_signals); | 27 | EXPORT_SYMBOL(block_signals); |
29 | EXPORT_SYMBOL(unblock_signals); | 28 | EXPORT_SYMBOL(unblock_signals); |
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile index 3e3fa7e7e3cf..b2823cdd783e 100644 --- a/arch/um/kernel/skas/Makefile +++ b/arch/um/kernel/skas/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # Licensed under the GPL | 3 | # Licensed under the GPL |
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y := clone.o exec.o mem.o mmu.o process.o syscall.o tlb.o uaccess.o | 6 | obj-y := clone.o mmu.o process.o syscall.o uaccess.o |
7 | 7 | ||
8 | # clone.o is in the stub, so it can't be built with profiling | 8 | # clone.o is in the stub, so it can't be built with profiling |
9 | # GCC hardened also auto-enables -fpic, but we need %ebx so it can't work -> | 9 | # GCC hardened also auto-enables -fpic, but we need %ebx so it can't work -> |
diff --git a/arch/um/kernel/skas/exec.c b/arch/um/kernel/skas/exec.c deleted file mode 100644 index 580eb6468949..000000000000 --- a/arch/um/kernel/skas/exec.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include "linux/kernel.h" | ||
7 | #include "asm/current.h" | ||
8 | #include "asm/page.h" | ||
9 | #include "asm/signal.h" | ||
10 | #include "asm/ptrace.h" | ||
11 | #include "asm/uaccess.h" | ||
12 | #include "asm/mmu_context.h" | ||
13 | #include "tlb.h" | ||
14 | #include "skas.h" | ||
15 | #include "um_mmu.h" | ||
16 | #include "os.h" | ||
17 | |||
18 | void flush_thread_skas(void) | ||
19 | { | ||
20 | void *data = NULL; | ||
21 | unsigned long end = proc_mm ? task_size : CONFIG_STUB_START; | ||
22 | int ret; | ||
23 | |||
24 | ret = unmap(¤t->mm->context.skas.id, 0, end, 1, &data); | ||
25 | if(ret){ | ||
26 | printk("flush_thread_skas - clearing address space failed, " | ||
27 | "err = %d\n", ret); | ||
28 | force_sig(SIGKILL, current); | ||
29 | } | ||
30 | |||
31 | switch_mm_skas(¤t->mm->context.skas.id); | ||
32 | } | ||
33 | |||
34 | void start_thread_skas(struct pt_regs *regs, unsigned long eip, | ||
35 | unsigned long esp) | ||
36 | { | ||
37 | set_fs(USER_DS); | ||
38 | PT_REGS_IP(regs) = eip; | ||
39 | PT_REGS_SP(regs) = esp; | ||
40 | } | ||
diff --git a/arch/um/kernel/skas/mem.c b/arch/um/kernel/skas/mem.c deleted file mode 100644 index 7c18dfcd7d8e..000000000000 --- a/arch/um/kernel/skas/mem.c +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include "linux/mm.h" | ||
7 | #include "asm/pgtable.h" | ||
8 | #include "mem_user.h" | ||
9 | #include "skas.h" | ||
10 | |||
11 | unsigned long set_task_sizes_skas(unsigned long *task_size_out) | ||
12 | { | ||
13 | /* Round up to the nearest 4M */ | ||
14 | unsigned long host_task_size = ROUND_4M((unsigned long) | ||
15 | &host_task_size); | ||
16 | |||
17 | if (!skas_needs_stub) | ||
18 | *task_size_out = host_task_size; | ||
19 | else *task_size_out = CONFIG_STUB_START & PGDIR_MASK; | ||
20 | |||
21 | return host_task_size; | ||
22 | } | ||
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index 2c6d090a2e87..902d74138952 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c | |||
@@ -71,7 +71,7 @@ static int init_stub_pte(struct mm_struct *mm, unsigned long proc, | |||
71 | return(-ENOMEM); | 71 | return(-ENOMEM); |
72 | } | 72 | } |
73 | 73 | ||
74 | int init_new_context_skas(struct task_struct *task, struct mm_struct *mm) | 74 | int init_new_context(struct task_struct *task, struct mm_struct *mm) |
75 | { | 75 | { |
76 | struct mmu_context_skas *from_mm = NULL; | 76 | struct mmu_context_skas *from_mm = NULL; |
77 | struct mmu_context_skas *to_mm = &mm->context.skas; | 77 | struct mmu_context_skas *to_mm = &mm->context.skas; |
@@ -137,7 +137,7 @@ int init_new_context_skas(struct task_struct *task, struct mm_struct *mm) | |||
137 | return ret; | 137 | return ret; |
138 | } | 138 | } |
139 | 139 | ||
140 | void destroy_context_skas(struct mm_struct *mm) | 140 | void destroy_context(struct mm_struct *mm) |
141 | { | 141 | { |
142 | struct mmu_context_skas *mmu = &mm->context.skas; | 142 | struct mmu_context_skas *mmu = &mm->context.skas; |
143 | 143 | ||
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index 48051a98525f..dabae62d52be 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -18,129 +18,22 @@ | |||
18 | #include "os.h" | 18 | #include "os.h" |
19 | #include "tlb.h" | 19 | #include "tlb.h" |
20 | #include "kern.h" | 20 | #include "kern.h" |
21 | #include "mode.h" | ||
22 | #include "registers.h" | 21 | #include "registers.h" |
23 | 22 | ||
24 | void switch_to_skas(void *prev, void *next) | ||
25 | { | ||
26 | struct task_struct *from, *to; | ||
27 | |||
28 | from = prev; | ||
29 | to = next; | ||
30 | |||
31 | /* XXX need to check runqueues[cpu].idle */ | ||
32 | if(current->pid == 0) | ||
33 | switch_timers(0); | ||
34 | |||
35 | switch_threads(&from->thread.mode.skas.switch_buf, | ||
36 | &to->thread.mode.skas.switch_buf); | ||
37 | |||
38 | arch_switch_to_skas(current->thread.prev_sched, current); | ||
39 | |||
40 | if(current->pid == 0) | ||
41 | switch_timers(1); | ||
42 | } | ||
43 | |||
44 | extern void schedule_tail(struct task_struct *prev); | 23 | extern void schedule_tail(struct task_struct *prev); |
45 | 24 | ||
46 | /* This is called magically, by its address being stuffed in a jmp_buf | ||
47 | * and being longjmp-d to. | ||
48 | */ | ||
49 | void new_thread_handler(void) | ||
50 | { | ||
51 | int (*fn)(void *), n; | ||
52 | void *arg; | ||
53 | |||
54 | if(current->thread.prev_sched != NULL) | ||
55 | schedule_tail(current->thread.prev_sched); | ||
56 | current->thread.prev_sched = NULL; | ||
57 | |||
58 | fn = current->thread.request.u.thread.proc; | ||
59 | arg = current->thread.request.u.thread.arg; | ||
60 | |||
61 | /* The return value is 1 if the kernel thread execs a process, | ||
62 | * 0 if it just exits | ||
63 | */ | ||
64 | n = run_kernel_thread(fn, arg, ¤t->thread.exec_buf); | ||
65 | if(n == 1){ | ||
66 | /* Handle any immediate reschedules or signals */ | ||
67 | interrupt_end(); | ||
68 | userspace(¤t->thread.regs.regs); | ||
69 | } | ||
70 | else do_exit(0); | ||
71 | } | ||
72 | |||
73 | void release_thread_skas(struct task_struct *task) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | /* Called magically, see new_thread_handler above */ | ||
78 | void fork_handler(void) | ||
79 | { | ||
80 | force_flush_all(); | ||
81 | if(current->thread.prev_sched == NULL) | ||
82 | panic("blech"); | ||
83 | |||
84 | schedule_tail(current->thread.prev_sched); | ||
85 | |||
86 | /* XXX: if interrupt_end() calls schedule, this call to | ||
87 | * arch_switch_to_skas isn't needed. We could want to apply this to | ||
88 | * improve performance. -bb */ | ||
89 | arch_switch_to_skas(current->thread.prev_sched, current); | ||
90 | |||
91 | current->thread.prev_sched = NULL; | ||
92 | |||
93 | /* Handle any immediate reschedules or signals */ | ||
94 | interrupt_end(); | ||
95 | |||
96 | userspace(¤t->thread.regs.regs); | ||
97 | } | ||
98 | |||
99 | int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp, | ||
100 | unsigned long stack_top, struct task_struct * p, | ||
101 | struct pt_regs *regs) | ||
102 | { | ||
103 | void (*handler)(void); | ||
104 | |||
105 | if(current->thread.forking){ | ||
106 | memcpy(&p->thread.regs.regs.skas, ®s->regs.skas, | ||
107 | sizeof(p->thread.regs.regs.skas)); | ||
108 | REGS_SET_SYSCALL_RETURN(p->thread.regs.regs.skas.regs, 0); | ||
109 | if(sp != 0) REGS_SP(p->thread.regs.regs.skas.regs) = sp; | ||
110 | |||
111 | handler = fork_handler; | ||
112 | |||
113 | arch_copy_thread(¤t->thread.arch, &p->thread.arch); | ||
114 | } | ||
115 | else { | ||
116 | init_thread_registers(&p->thread.regs.regs); | ||
117 | p->thread.request.u.thread = current->thread.request.u.thread; | ||
118 | handler = new_thread_handler; | ||
119 | } | ||
120 | |||
121 | new_thread(task_stack_page(p), &p->thread.mode.skas.switch_buf, | ||
122 | handler); | ||
123 | return(0); | ||
124 | } | ||
125 | |||
126 | int new_mm(unsigned long stack) | 25 | int new_mm(unsigned long stack) |
127 | { | 26 | { |
128 | int fd; | 27 | int fd; |
129 | 28 | ||
130 | fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); | 29 | fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); |
131 | if(fd < 0) | 30 | if(fd < 0) |
132 | return(fd); | 31 | return fd; |
133 | 32 | ||
134 | if(skas_needs_stub) | 33 | if(skas_needs_stub) |
135 | map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack); | 34 | map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack); |
136 | 35 | ||
137 | return(fd); | 36 | return fd; |
138 | } | ||
139 | |||
140 | void init_idle_skas(void) | ||
141 | { | ||
142 | cpu_tasks[current_thread->cpu].pid = os_getpid(); | ||
143 | default_idle(); | ||
144 | } | 37 | } |
145 | 38 | ||
146 | extern void start_kernel(void); | 39 | extern void start_kernel(void); |
@@ -158,14 +51,14 @@ static int __init start_kernel_proc(void *unused) | |||
158 | cpu_online_map = cpumask_of_cpu(0); | 51 | cpu_online_map = cpumask_of_cpu(0); |
159 | #endif | 52 | #endif |
160 | start_kernel(); | 53 | start_kernel(); |
161 | return(0); | 54 | return 0; |
162 | } | 55 | } |
163 | 56 | ||
164 | extern int userspace_pid[]; | 57 | extern int userspace_pid[]; |
165 | 58 | ||
166 | extern char cpu0_irqstack[]; | 59 | extern char cpu0_irqstack[]; |
167 | 60 | ||
168 | int __init start_uml_skas(void) | 61 | int __init start_uml(void) |
169 | { | 62 | { |
170 | stack_protections((unsigned long) &cpu0_irqstack); | 63 | stack_protections((unsigned long) &cpu0_irqstack); |
171 | set_sigstack(cpu0_irqstack, THREAD_SIZE); | 64 | set_sigstack(cpu0_irqstack, THREAD_SIZE); |
@@ -176,49 +69,14 @@ int __init start_uml_skas(void) | |||
176 | 69 | ||
177 | init_task.thread.request.u.thread.proc = start_kernel_proc; | 70 | init_task.thread.request.u.thread.proc = start_kernel_proc; |
178 | init_task.thread.request.u.thread.arg = NULL; | 71 | init_task.thread.request.u.thread.arg = NULL; |
179 | return(start_idle_thread(task_stack_page(&init_task), | 72 | return start_idle_thread(task_stack_page(&init_task), |
180 | &init_task.thread.mode.skas.switch_buf)); | 73 | &init_task.thread.switch_buf); |
181 | } | ||
182 | |||
183 | int external_pid_skas(struct task_struct *task) | ||
184 | { | ||
185 | /* FIXME: Need to look up userspace_pid by cpu */ | ||
186 | return(userspace_pid[0]); | ||
187 | } | ||
188 | |||
189 | int thread_pid_skas(struct task_struct *task) | ||
190 | { | ||
191 | /* FIXME: Need to look up userspace_pid by cpu */ | ||
192 | return(userspace_pid[0]); | ||
193 | } | ||
194 | |||
195 | void kill_off_processes_skas(void) | ||
196 | { | ||
197 | if(proc_mm) | ||
198 | /* | ||
199 | * FIXME: need to loop over userspace_pids in | ||
200 | * kill_off_processes_skas | ||
201 | */ | ||
202 | os_kill_ptraced_process(userspace_pid[0], 1); | ||
203 | else { | ||
204 | struct task_struct *p; | ||
205 | int pid, me; | ||
206 | |||
207 | me = os_getpid(); | ||
208 | for_each_process(p){ | ||
209 | if(p->mm == NULL) | ||
210 | continue; | ||
211 | |||
212 | pid = p->mm->context.skas.id.u.pid; | ||
213 | os_kill_ptraced_process(pid, 1); | ||
214 | } | ||
215 | } | ||
216 | } | 74 | } |
217 | 75 | ||
218 | unsigned long current_stub_stack(void) | 76 | unsigned long current_stub_stack(void) |
219 | { | 77 | { |
220 | if(current->mm == NULL) | 78 | if(current->mm == NULL) |
221 | return(0); | 79 | return 0; |
222 | 80 | ||
223 | return(current->mm->context.skas.id.stack); | 81 | return current->mm->context.skas.id.stack; |
224 | } | 82 | } |
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c index 0ae4eea21be4..e183da633c89 100644 --- a/arch/um/kernel/skas/syscall.c +++ b/arch/um/kernel/skas/syscall.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include "kern_util.h" | 13 | #include "kern_util.h" |
14 | #include "syscall.h" | 14 | #include "syscall.h" |
15 | 15 | ||
16 | void handle_syscall(union uml_pt_regs *r) | 16 | void handle_syscall(struct uml_pt_regs *r) |
17 | { | 17 | { |
18 | struct pt_regs *regs = container_of(r, struct pt_regs, regs); | 18 | struct pt_regs *regs = container_of(r, struct pt_regs, regs); |
19 | long result; | 19 | long result; |
@@ -37,7 +37,7 @@ void handle_syscall(union uml_pt_regs *r) | |||
37 | result = -ENOSYS; | 37 | result = -ENOSYS; |
38 | else result = EXECUTE_SYSCALL(syscall, regs); | 38 | else result = EXECUTE_SYSCALL(syscall, regs); |
39 | 39 | ||
40 | REGS_SET_SYSCALL_RETURN(r->skas.regs, result); | 40 | REGS_SET_SYSCALL_RETURN(r->regs, result); |
41 | 41 | ||
42 | syscall_trace(r, 1); | 42 | syscall_trace(r, 1); |
43 | } | 43 | } |
diff --git a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c deleted file mode 100644 index c0f0693743ba..000000000000 --- a/arch/um/kernel/skas/tlb.c +++ /dev/null | |||
@@ -1,164 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #include "linux/stddef.h" | ||
8 | #include "linux/sched.h" | ||
9 | #include "linux/mm.h" | ||
10 | #include "asm/page.h" | ||
11 | #include "asm/pgtable.h" | ||
12 | #include "asm/mmu.h" | ||
13 | #include "mem_user.h" | ||
14 | #include "mem.h" | ||
15 | #include "skas.h" | ||
16 | #include "os.h" | ||
17 | #include "tlb.h" | ||
18 | |||
19 | static int do_ops(union mm_context *mmu, struct host_vm_op *ops, int last, | ||
20 | int finished, void **flush) | ||
21 | { | ||
22 | struct host_vm_op *op; | ||
23 | int i, ret = 0; | ||
24 | |||
25 | for(i = 0; i <= last && !ret; i++){ | ||
26 | op = &ops[i]; | ||
27 | switch(op->type){ | ||
28 | case MMAP: | ||
29 | ret = map(&mmu->skas.id, op->u.mmap.addr, | ||
30 | op->u.mmap.len, op->u.mmap.prot, | ||
31 | op->u.mmap.fd, op->u.mmap.offset, finished, | ||
32 | flush); | ||
33 | break; | ||
34 | case MUNMAP: | ||
35 | ret = unmap(&mmu->skas.id, op->u.munmap.addr, | ||
36 | op->u.munmap.len, finished, flush); | ||
37 | break; | ||
38 | case MPROTECT: | ||
39 | ret = protect(&mmu->skas.id, op->u.mprotect.addr, | ||
40 | op->u.mprotect.len, op->u.mprotect.prot, | ||
41 | finished, flush); | ||
42 | break; | ||
43 | default: | ||
44 | printk("Unknown op type %d in do_ops\n", op->type); | ||
45 | break; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | extern int proc_mm; | ||
53 | |||
54 | static void fix_range(struct mm_struct *mm, unsigned long start_addr, | ||
55 | unsigned long end_addr, int force) | ||
56 | { | ||
57 | if(!proc_mm && (end_addr > CONFIG_STUB_START)) | ||
58 | end_addr = CONFIG_STUB_START; | ||
59 | |||
60 | fix_range_common(mm, start_addr, end_addr, force, do_ops); | ||
61 | } | ||
62 | |||
63 | void __flush_tlb_one_skas(unsigned long addr) | ||
64 | { | ||
65 | flush_tlb_kernel_range_common(addr, addr + PAGE_SIZE); | ||
66 | } | ||
67 | |||
68 | void flush_tlb_range_skas(struct vm_area_struct *vma, unsigned long start, | ||
69 | unsigned long end) | ||
70 | { | ||
71 | if(vma->vm_mm == NULL) | ||
72 | flush_tlb_kernel_range_common(start, end); | ||
73 | else fix_range(vma->vm_mm, start, end, 0); | ||
74 | } | ||
75 | |||
76 | void flush_tlb_mm_skas(struct mm_struct *mm) | ||
77 | { | ||
78 | unsigned long end; | ||
79 | |||
80 | /* Don't bother flushing if this address space is about to be | ||
81 | * destroyed. | ||
82 | */ | ||
83 | if(atomic_read(&mm->mm_users) == 0) | ||
84 | return; | ||
85 | |||
86 | end = proc_mm ? task_size : CONFIG_STUB_START; | ||
87 | fix_range(mm, 0, end, 0); | ||
88 | } | ||
89 | |||
90 | void force_flush_all_skas(void) | ||
91 | { | ||
92 | struct mm_struct *mm = current->mm; | ||
93 | struct vm_area_struct *vma = mm->mmap; | ||
94 | |||
95 | while(vma != NULL) { | ||
96 | fix_range(mm, vma->vm_start, vma->vm_end, 1); | ||
97 | vma = vma->vm_next; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | void flush_tlb_page_skas(struct vm_area_struct *vma, unsigned long address) | ||
102 | { | ||
103 | pgd_t *pgd; | ||
104 | pud_t *pud; | ||
105 | pmd_t *pmd; | ||
106 | pte_t *pte; | ||
107 | struct mm_struct *mm = vma->vm_mm; | ||
108 | void *flush = NULL; | ||
109 | int r, w, x, prot, err = 0; | ||
110 | struct mm_id *mm_id; | ||
111 | |||
112 | pgd = pgd_offset(mm, address); | ||
113 | if(!pgd_present(*pgd)) | ||
114 | goto kill; | ||
115 | |||
116 | pud = pud_offset(pgd, address); | ||
117 | if(!pud_present(*pud)) | ||
118 | goto kill; | ||
119 | |||
120 | pmd = pmd_offset(pud, address); | ||
121 | if(!pmd_present(*pmd)) | ||
122 | goto kill; | ||
123 | |||
124 | pte = pte_offset_kernel(pmd, address); | ||
125 | |||
126 | r = pte_read(*pte); | ||
127 | w = pte_write(*pte); | ||
128 | x = pte_exec(*pte); | ||
129 | if (!pte_young(*pte)) { | ||
130 | r = 0; | ||
131 | w = 0; | ||
132 | } else if (!pte_dirty(*pte)) { | ||
133 | w = 0; | ||
134 | } | ||
135 | |||
136 | mm_id = &mm->context.skas.id; | ||
137 | prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) | | ||
138 | (x ? UM_PROT_EXEC : 0)); | ||
139 | if(pte_newpage(*pte)){ | ||
140 | if(pte_present(*pte)){ | ||
141 | unsigned long long offset; | ||
142 | int fd; | ||
143 | |||
144 | fd = phys_mapping(pte_val(*pte) & PAGE_MASK, &offset); | ||
145 | err = map(mm_id, address, PAGE_SIZE, prot, fd, offset, | ||
146 | 1, &flush); | ||
147 | } | ||
148 | else err = unmap(mm_id, address, PAGE_SIZE, 1, &flush); | ||
149 | } | ||
150 | else if(pte_newprot(*pte)) | ||
151 | err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush); | ||
152 | |||
153 | if(err) | ||
154 | goto kill; | ||
155 | |||
156 | *pte = pte_mkuptodate(*pte); | ||
157 | |||
158 | return; | ||
159 | |||
160 | kill: | ||
161 | printk("Failed to flush page for address 0x%lx\n", address); | ||
162 | force_sig(SIGKILL, current); | ||
163 | } | ||
164 | |||
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index 138bcb43b997..ebb29f5259a9 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include "asm/uaccess.h" | 20 | #include "asm/uaccess.h" |
21 | #include "kern_util.h" | 21 | #include "kern_util.h" |
22 | #include "sysdep/syscalls.h" | 22 | #include "sysdep/syscalls.h" |
23 | #include "mode_kern.h" | ||
24 | 23 | ||
25 | /* Unlocked, I don't care if this is a bit off */ | 24 | /* Unlocked, I don't care if this is a bit off */ |
26 | int nsyscalls = 0; | 25 | int nsyscalls = 0; |
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 3571703a7cb4..90e24e2dbeaa 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include "asm/param.h" | 18 | #include "asm/param.h" |
19 | #include "asm/current.h" | 19 | #include "asm/current.h" |
20 | #include "kern_util.h" | 20 | #include "kern_util.h" |
21 | #include "mode.h" | ||
22 | #include "os.h" | 21 | #include "os.h" |
23 | 22 | ||
24 | int hz(void) | 23 | int hz(void) |
@@ -39,7 +38,7 @@ static unsigned long long prev_nsecs[NR_CPUS]; | |||
39 | static long long delta[NR_CPUS]; /* Deviation per interval */ | 38 | static long long delta[NR_CPUS]; /* Deviation per interval */ |
40 | #endif | 39 | #endif |
41 | 40 | ||
42 | void timer_irq(union uml_pt_regs *regs) | 41 | void timer_irq(struct uml_pt_regs *regs) |
43 | { | 42 | { |
44 | unsigned long long ticks = 0; | 43 | unsigned long long ticks = 0; |
45 | #ifdef CONFIG_UML_REAL_TIME_CLOCK | 44 | #ifdef CONFIG_UML_REAL_TIME_CLOCK |
@@ -175,13 +174,13 @@ int do_settimeofday(struct timespec *tv) | |||
175 | return 0; | 174 | return 0; |
176 | } | 175 | } |
177 | 176 | ||
178 | void timer_handler(int sig, union uml_pt_regs *regs) | 177 | void timer_handler(int sig, struct uml_pt_regs *regs) |
179 | { | 178 | { |
180 | if(current_thread->cpu == 0) | 179 | if(current_thread->cpu == 0) |
181 | timer_irq(regs); | 180 | timer_irq(regs); |
182 | local_irq_disable(); | 181 | local_irq_disable(); |
183 | irq_enter(); | 182 | irq_enter(); |
184 | update_process_times((regs)->skas.is_user); | 183 | update_process_times(regs->is_user); |
185 | irq_exit(); | 184 | irq_exit(); |
186 | local_irq_enable(); | 185 | local_irq_enable(); |
187 | } | 186 | } |
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index 312e8ba30cd3..12b8c637527d 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c | |||
@@ -8,12 +8,12 @@ | |||
8 | #include "asm/pgalloc.h" | 8 | #include "asm/pgalloc.h" |
9 | #include "asm/pgtable.h" | 9 | #include "asm/pgtable.h" |
10 | #include "asm/tlbflush.h" | 10 | #include "asm/tlbflush.h" |
11 | #include "mode_kern.h" | ||
12 | #include "as-layout.h" | 11 | #include "as-layout.h" |
13 | #include "tlb.h" | 12 | #include "tlb.h" |
14 | #include "mem.h" | 13 | #include "mem.h" |
15 | #include "mem_user.h" | 14 | #include "mem_user.h" |
16 | #include "os.h" | 15 | #include "os.h" |
16 | #include "skas.h" | ||
17 | 17 | ||
18 | static int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, | 18 | static int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, |
19 | unsigned int prot, struct host_vm_op *ops, int *index, | 19 | unsigned int prot, struct host_vm_op *ops, int *index, |
@@ -341,6 +341,71 @@ int flush_tlb_kernel_range_common(unsigned long start, unsigned long end) | |||
341 | return(updated); | 341 | return(updated); |
342 | } | 342 | } |
343 | 343 | ||
344 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long address) | ||
345 | { | ||
346 | pgd_t *pgd; | ||
347 | pud_t *pud; | ||
348 | pmd_t *pmd; | ||
349 | pte_t *pte; | ||
350 | struct mm_struct *mm = vma->vm_mm; | ||
351 | void *flush = NULL; | ||
352 | int r, w, x, prot, err = 0; | ||
353 | struct mm_id *mm_id; | ||
354 | |||
355 | address &= PAGE_MASK; | ||
356 | pgd = pgd_offset(mm, address); | ||
357 | if(!pgd_present(*pgd)) | ||
358 | goto kill; | ||
359 | |||
360 | pud = pud_offset(pgd, address); | ||
361 | if(!pud_present(*pud)) | ||
362 | goto kill; | ||
363 | |||
364 | pmd = pmd_offset(pud, address); | ||
365 | if(!pmd_present(*pmd)) | ||
366 | goto kill; | ||
367 | |||
368 | pte = pte_offset_kernel(pmd, address); | ||
369 | |||
370 | r = pte_read(*pte); | ||
371 | w = pte_write(*pte); | ||
372 | x = pte_exec(*pte); | ||
373 | if (!pte_young(*pte)) { | ||
374 | r = 0; | ||
375 | w = 0; | ||
376 | } else if (!pte_dirty(*pte)) { | ||
377 | w = 0; | ||
378 | } | ||
379 | |||
380 | mm_id = &mm->context.skas.id; | ||
381 | prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) | | ||
382 | (x ? UM_PROT_EXEC : 0)); | ||
383 | if(pte_newpage(*pte)){ | ||
384 | if(pte_present(*pte)){ | ||
385 | unsigned long long offset; | ||
386 | int fd; | ||
387 | |||
388 | fd = phys_mapping(pte_val(*pte) & PAGE_MASK, &offset); | ||
389 | err = map(mm_id, address, PAGE_SIZE, prot, fd, offset, | ||
390 | 1, &flush); | ||
391 | } | ||
392 | else err = unmap(mm_id, address, PAGE_SIZE, 1, &flush); | ||
393 | } | ||
394 | else if(pte_newprot(*pte)) | ||
395 | err = protect(mm_id, address, PAGE_SIZE, prot, 1, &flush); | ||
396 | |||
397 | if(err) | ||
398 | goto kill; | ||
399 | |||
400 | *pte = pte_mkuptodate(*pte); | ||
401 | |||
402 | return; | ||
403 | |||
404 | kill: | ||
405 | printk("Failed to flush page for address 0x%lx\n", address); | ||
406 | force_sig(SIGKILL, current); | ||
407 | } | ||
408 | |||
344 | pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address) | 409 | pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address) |
345 | { | 410 | { |
346 | return(pgd_offset(mm, address)); | 411 | return(pgd_offset(mm, address)); |
@@ -387,21 +452,80 @@ void flush_tlb_kernel_vm(void) | |||
387 | 452 | ||
388 | void __flush_tlb_one(unsigned long addr) | 453 | void __flush_tlb_one(unsigned long addr) |
389 | { | 454 | { |
390 | __flush_tlb_one_skas(addr); | 455 | flush_tlb_kernel_range_common(addr, addr + PAGE_SIZE); |
456 | } | ||
457 | |||
458 | static int do_ops(union mm_context *mmu, struct host_vm_op *ops, int last, | ||
459 | int finished, void **flush) | ||
460 | { | ||
461 | struct host_vm_op *op; | ||
462 | int i, ret = 0; | ||
463 | |||
464 | for(i = 0; i <= last && !ret; i++){ | ||
465 | op = &ops[i]; | ||
466 | switch(op->type){ | ||
467 | case MMAP: | ||
468 | ret = map(&mmu->skas.id, op->u.mmap.addr, | ||
469 | op->u.mmap.len, op->u.mmap.prot, | ||
470 | op->u.mmap.fd, op->u.mmap.offset, finished, | ||
471 | flush); | ||
472 | break; | ||
473 | case MUNMAP: | ||
474 | ret = unmap(&mmu->skas.id, op->u.munmap.addr, | ||
475 | op->u.munmap.len, finished, flush); | ||
476 | break; | ||
477 | case MPROTECT: | ||
478 | ret = protect(&mmu->skas.id, op->u.mprotect.addr, | ||
479 | op->u.mprotect.len, op->u.mprotect.prot, | ||
480 | finished, flush); | ||
481 | break; | ||
482 | default: | ||
483 | printk("Unknown op type %d in do_ops\n", op->type); | ||
484 | break; | ||
485 | } | ||
486 | } | ||
487 | |||
488 | return ret; | ||
489 | } | ||
490 | |||
491 | static void fix_range(struct mm_struct *mm, unsigned long start_addr, | ||
492 | unsigned long end_addr, int force) | ||
493 | { | ||
494 | if(!proc_mm && (end_addr > CONFIG_STUB_START)) | ||
495 | end_addr = CONFIG_STUB_START; | ||
496 | |||
497 | fix_range_common(mm, start_addr, end_addr, force, do_ops); | ||
391 | } | 498 | } |
392 | 499 | ||
393 | void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | 500 | void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, |
394 | unsigned long end) | 501 | unsigned long end) |
395 | { | 502 | { |
396 | flush_tlb_range_skas(vma, start, end); | 503 | if(vma->vm_mm == NULL) |
504 | flush_tlb_kernel_range_common(start, end); | ||
505 | else fix_range(vma->vm_mm, start, end, 0); | ||
397 | } | 506 | } |
398 | 507 | ||
399 | void flush_tlb_mm(struct mm_struct *mm) | 508 | void flush_tlb_mm(struct mm_struct *mm) |
400 | { | 509 | { |
401 | flush_tlb_mm_skas(mm); | 510 | unsigned long end; |
511 | |||
512 | /* Don't bother flushing if this address space is about to be | ||
513 | * destroyed. | ||
514 | */ | ||
515 | if(atomic_read(&mm->mm_users) == 0) | ||
516 | return; | ||
517 | |||
518 | end = proc_mm ? task_size : CONFIG_STUB_START; | ||
519 | fix_range(mm, 0, end, 0); | ||
402 | } | 520 | } |
403 | 521 | ||
404 | void force_flush_all(void) | 522 | void force_flush_all(void) |
405 | { | 523 | { |
406 | force_flush_all_skas(); | 524 | struct mm_struct *mm = current->mm; |
525 | struct vm_area_struct *vma = mm->mmap; | ||
526 | |||
527 | while(vma != NULL) { | ||
528 | fix_range(mm, vma->vm_start, vma->vm_end, 1); | ||
529 | vma = vma->vm_next; | ||
530 | } | ||
407 | } | 531 | } |
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index 4b472ca53485..eac63fb6183c 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
@@ -128,7 +128,7 @@ static void bad_segv(struct faultinfo fi, unsigned long ip) | |||
128 | force_sig_info(SIGSEGV, &si, current); | 128 | force_sig_info(SIGSEGV, &si, current); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void segv_handler(int sig, union uml_pt_regs *regs) | 131 | static void segv_handler(int sig, struct uml_pt_regs *regs) |
132 | { | 132 | { |
133 | struct faultinfo * fi = UPT_FAULTINFO(regs); | 133 | struct faultinfo * fi = UPT_FAULTINFO(regs); |
134 | 134 | ||
@@ -146,7 +146,7 @@ static void segv_handler(int sig, union uml_pt_regs *regs) | |||
146 | * give us bad data! | 146 | * give us bad data! |
147 | */ | 147 | */ |
148 | unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, | 148 | unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, |
149 | union uml_pt_regs *regs) | 149 | struct uml_pt_regs *regs) |
150 | { | 150 | { |
151 | struct siginfo si; | 151 | struct siginfo si; |
152 | void *catcher; | 152 | void *catcher; |
@@ -214,7 +214,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, | |||
214 | return 0; | 214 | return 0; |
215 | } | 215 | } |
216 | 216 | ||
217 | void relay_signal(int sig, union uml_pt_regs *regs) | 217 | void relay_signal(int sig, struct uml_pt_regs *regs) |
218 | { | 218 | { |
219 | if (arch_handle_signal(sig, regs)) | 219 | if (arch_handle_signal(sig, regs)) |
220 | return; | 220 | return; |
@@ -230,14 +230,14 @@ void relay_signal(int sig, union uml_pt_regs *regs) | |||
230 | force_sig(sig, current); | 230 | force_sig(sig, current); |
231 | } | 231 | } |
232 | 232 | ||
233 | static void bus_handler(int sig, union uml_pt_regs *regs) | 233 | static void bus_handler(int sig, struct uml_pt_regs *regs) |
234 | { | 234 | { |
235 | if (current->thread.fault_catcher != NULL) | 235 | if (current->thread.fault_catcher != NULL) |
236 | do_longjmp(current->thread.fault_catcher, 1); | 236 | do_longjmp(current->thread.fault_catcher, 1); |
237 | else relay_signal(sig, regs); | 237 | else relay_signal(sig, regs); |
238 | } | 238 | } |
239 | 239 | ||
240 | static void winch(int sig, union uml_pt_regs *regs) | 240 | static void winch(int sig, struct uml_pt_regs *regs) |
241 | { | 241 | { |
242 | do_IRQ(WINCH_IRQ, regs); | 242 | do_IRQ(WINCH_IRQ, regs); |
243 | } | 243 | } |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 9f3a207eb81f..5f3e13c365e5 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include "initrd.h" | 35 | #include "initrd.h" |
36 | #include "init.h" | 36 | #include "init.h" |
37 | #include "os.h" | 37 | #include "os.h" |
38 | #include "mode_kern.h" | ||
39 | #include "mode.h" | ||
40 | #include "skas.h" | 38 | #include "skas.h" |
41 | 39 | ||
42 | #define DEFAULT_COMMAND_LINE "root=98:0" | 40 | #define DEFAULT_COMMAND_LINE "root=98:0" |
@@ -67,7 +65,8 @@ struct cpuinfo_um boot_cpu_data = { | |||
67 | 65 | ||
68 | unsigned long thread_saved_pc(struct task_struct *task) | 66 | unsigned long thread_saved_pc(struct task_struct *task) |
69 | { | 67 | { |
70 | return os_process_pc(thread_pid_skas(task)); | 68 | /* FIXME: Need to look up userspace_pid by cpu */ |
69 | return os_process_pc(userspace_pid[0]); | ||
71 | } | 70 | } |
72 | 71 | ||
73 | /* Changed in setup_arch, which is called in early boot */ | 72 | /* Changed in setup_arch, which is called in early boot */ |
@@ -253,6 +252,19 @@ EXPORT_SYMBOL(end_iomem); | |||
253 | 252 | ||
254 | extern char __binary_start; | 253 | extern char __binary_start; |
255 | 254 | ||
255 | static unsigned long set_task_sizes_skas(unsigned long *task_size_out) | ||
256 | { | ||
257 | /* Round up to the nearest 4M */ | ||
258 | unsigned long host_task_size = ROUND_4M((unsigned long) | ||
259 | &host_task_size); | ||
260 | |||
261 | if (!skas_needs_stub) | ||
262 | *task_size_out = host_task_size; | ||
263 | else *task_size_out = CONFIG_STUB_START & PGDIR_MASK; | ||
264 | |||
265 | return host_task_size; | ||
266 | } | ||
267 | |||
256 | int __init linux_main(int argc, char **argv) | 268 | int __init linux_main(int argc, char **argv) |
257 | { | 269 | { |
258 | unsigned long avail, diff; | 270 | unsigned long avail, diff; |
@@ -289,7 +301,7 @@ int __init linux_main(int argc, char **argv) | |||
289 | os_fill_handlinfo(handlinfo_kern); | 301 | os_fill_handlinfo(handlinfo_kern); |
290 | 302 | ||
291 | brk_start = (unsigned long) sbrk(0); | 303 | brk_start = (unsigned long) sbrk(0); |
292 | before_mem_skas(brk_start); | 304 | |
293 | /* Increase physical memory size for exec-shield users | 305 | /* Increase physical memory size for exec-shield users |
294 | so they actually get what they asked for. This should | 306 | so they actually get what they asked for. This should |
295 | add zero for non-exec shield users */ | 307 | add zero for non-exec shield users */ |
@@ -354,7 +366,7 @@ int __init linux_main(int argc, char **argv) | |||
354 | stack_protections((unsigned long) &init_thread_info); | 366 | stack_protections((unsigned long) &init_thread_info); |
355 | os_flush_stdout(); | 367 | os_flush_stdout(); |
356 | 368 | ||
357 | return start_uml_skas(); | 369 | return start_uml(); |
358 | } | 370 | } |
359 | 371 | ||
360 | extern int uml_exitcode; | 372 | extern int uml_exitcode; |
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c index c8f5b7a2c1c6..11c2b01a92bd 100644 --- a/arch/um/os-Linux/aio.c +++ b/arch/um/os-Linux/aio.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include "aio.h" | 13 | #include "aio.h" |
14 | #include "init.h" | 14 | #include "init.h" |
15 | #include "user.h" | 15 | #include "user.h" |
16 | #include "mode.h" | ||
17 | #include "kern_constants.h" | 16 | #include "kern_constants.h" |
18 | 17 | ||
19 | struct aio_thread_req { | 18 | struct aio_thread_req { |
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index bfabb883daae..aeeecc634733 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include "irq_user.h" | 18 | #include "irq_user.h" |
19 | #include "user.h" | 19 | #include "user.h" |
20 | #include "init.h" | 20 | #include "init.h" |
21 | #include "mode.h" | ||
22 | #include "uml-config.h" | 21 | #include "uml-config.h" |
23 | #include "os.h" | 22 | #include "os.h" |
24 | #include "um_malloc.h" | 23 | #include "um_malloc.h" |
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index d5fef4ce0112..a955e9bcd04d 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c | |||
@@ -244,9 +244,6 @@ void init_new_thread_signals(void) | |||
244 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); | 244 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); |
245 | set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK, | 245 | set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK, |
246 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); | 246 | SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1); |
247 | set_handler(SIGUSR2, (__sighandler_t) sig_handler, | ||
248 | SA_ONSTACK, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, | ||
249 | -1); | ||
250 | signal(SIGHUP, SIG_IGN); | 247 | signal(SIGHUP, SIG_IGN); |
251 | 248 | ||
252 | init_irq_signals(1); | 249 | init_irq_signals(1); |
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 9dc3fad9ea29..ce0b791160e6 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c | |||
@@ -13,26 +13,26 @@ | |||
13 | 13 | ||
14 | static unsigned long exec_regs[MAX_REG_NR]; | 14 | static unsigned long exec_regs[MAX_REG_NR]; |
15 | 15 | ||
16 | void init_thread_registers(union uml_pt_regs *to) | 16 | void init_thread_registers(struct uml_pt_regs *to) |
17 | { | 17 | { |
18 | memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs)); | 18 | memcpy(to->regs, exec_regs, sizeof(to->regs)); |
19 | } | 19 | } |
20 | 20 | ||
21 | void save_registers(int pid, union uml_pt_regs *regs) | 21 | void save_registers(int pid, struct uml_pt_regs *regs) |
22 | { | 22 | { |
23 | int err; | 23 | int err; |
24 | 24 | ||
25 | err = ptrace(PTRACE_GETREGS, pid, 0, regs->skas.regs); | 25 | err = ptrace(PTRACE_GETREGS, pid, 0, regs->regs); |
26 | if(err < 0) | 26 | if(err < 0) |
27 | panic("save_registers - saving registers failed, errno = %d\n", | 27 | panic("save_registers - saving registers failed, errno = %d\n", |
28 | errno); | 28 | errno); |
29 | } | 29 | } |
30 | 30 | ||
31 | void restore_registers(int pid, union uml_pt_regs *regs) | 31 | void restore_registers(int pid, struct uml_pt_regs *regs) |
32 | { | 32 | { |
33 | int err; | 33 | int err; |
34 | 34 | ||
35 | err = ptrace(PTRACE_SETREGS, pid, 0, regs->skas.regs); | 35 | err = ptrace(PTRACE_SETREGS, pid, 0, regs->regs); |
36 | if(err < 0) | 36 | if(err < 0) |
37 | panic("restore_registers - saving registers failed, " | 37 | panic("restore_registers - saving registers failed, " |
38 | "errno = %d\n", errno); | 38 | "errno = %d\n", errno); |
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 0d6122adb8a7..583424b9797d 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include "sysdep/sigcontext.h" | 16 | #include "sysdep/sigcontext.h" |
17 | #include "sysdep/barrier.h" | 17 | #include "sysdep/barrier.h" |
18 | #include "sigcontext.h" | 18 | #include "sigcontext.h" |
19 | #include "mode.h" | ||
20 | #include "os.h" | 19 | #include "os.h" |
21 | 20 | ||
22 | /* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled | 21 | /* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled |
@@ -60,14 +59,14 @@ void sig_handler(int sig, struct sigcontext *sc) | |||
60 | 59 | ||
61 | static void real_alarm_handler(int sig, struct sigcontext *sc) | 60 | static void real_alarm_handler(int sig, struct sigcontext *sc) |
62 | { | 61 | { |
63 | union uml_pt_regs regs; | 62 | struct uml_pt_regs regs; |
64 | 63 | ||
65 | if(sig == SIGALRM) | 64 | if(sig == SIGALRM) |
66 | switch_timers(0); | 65 | switch_timers(0); |
67 | 66 | ||
68 | if(sc != NULL) | 67 | if(sc != NULL) |
69 | copy_sc(®s, sc); | 68 | copy_sc(®s, sc); |
70 | regs.skas.is_user = 0; | 69 | regs.is_user = 0; |
71 | unblock_signals(); | 70 | unblock_signals(); |
72 | timer_handler(sig, ®s); | 71 | timer_handler(sig, ®s); |
73 | 72 | ||
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index 383052baa166..ae7685710c46 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
@@ -294,7 +294,3 @@ int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len, | |||
294 | 294 | ||
295 | return ret; | 295 | return ret; |
296 | } | 296 | } |
297 | |||
298 | void before_mem_skas(unsigned long unused) | ||
299 | { | ||
300 | } | ||
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index db020d21f132..eb027673f357 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -131,19 +131,19 @@ void get_skas_faultinfo(int pid, struct faultinfo * fi) | |||
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | static void handle_segv(int pid, union uml_pt_regs * regs) | 134 | static void handle_segv(int pid, struct uml_pt_regs * regs) |
135 | { | 135 | { |
136 | get_skas_faultinfo(pid, ®s->skas.faultinfo); | 136 | get_skas_faultinfo(pid, ®s->faultinfo); |
137 | segv(regs->skas.faultinfo, 0, 1, NULL); | 137 | segv(regs->faultinfo, 0, 1, NULL); |
138 | } | 138 | } |
139 | 139 | ||
140 | /*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/ | 140 | /*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/ |
141 | static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu) | 141 | static void handle_trap(int pid, struct uml_pt_regs *regs, int local_using_sysemu) |
142 | { | 142 | { |
143 | int err, status; | 143 | int err, status; |
144 | 144 | ||
145 | /* Mark this as a syscall */ | 145 | /* Mark this as a syscall */ |
146 | UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs); | 146 | UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->regs); |
147 | 147 | ||
148 | if (!local_using_sysemu) | 148 | if (!local_using_sysemu) |
149 | { | 149 | { |
@@ -286,7 +286,7 @@ int start_userspace(unsigned long stub_stack) | |||
286 | return(pid); | 286 | return(pid); |
287 | } | 287 | } |
288 | 288 | ||
289 | void userspace(union uml_pt_regs *regs) | 289 | void userspace(struct uml_pt_regs *regs) |
290 | { | 290 | { |
291 | int err, status, op, pid = userspace_pid[0]; | 291 | int err, status, op, pid = userspace_pid[0]; |
292 | /* To prevent races if using_sysemu changes under us.*/ | 292 | /* To prevent races if using_sysemu changes under us.*/ |
@@ -312,7 +312,7 @@ void userspace(union uml_pt_regs *regs) | |||
312 | panic("userspace - waitpid failed, errno = %d\n", | 312 | panic("userspace - waitpid failed, errno = %d\n", |
313 | errno); | 313 | errno); |
314 | 314 | ||
315 | regs->skas.is_user = 1; | 315 | regs->is_user = 1; |
316 | save_registers(pid, regs); | 316 | save_registers(pid, regs); |
317 | UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ | 317 | UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ |
318 | 318 | ||
@@ -321,7 +321,7 @@ void userspace(union uml_pt_regs *regs) | |||
321 | switch(sig){ | 321 | switch(sig){ |
322 | case SIGSEGV: | 322 | case SIGSEGV: |
323 | if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo){ | 323 | if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo){ |
324 | get_skas_faultinfo(pid, ®s->skas.faultinfo); | 324 | get_skas_faultinfo(pid, ®s->faultinfo); |
325 | (*sig_info[SIGSEGV])(SIGSEGV, regs); | 325 | (*sig_info[SIGSEGV])(SIGSEGV, regs); |
326 | } | 326 | } |
327 | else handle_segv(pid, regs); | 327 | else handle_segv(pid, regs); |
@@ -351,7 +351,7 @@ void userspace(union uml_pt_regs *regs) | |||
351 | 351 | ||
352 | /* Avoid -ERESTARTSYS handling in host */ | 352 | /* Avoid -ERESTARTSYS handling in host */ |
353 | if(PT_SYSCALL_NR_OFFSET != PT_SYSCALL_RET_OFFSET) | 353 | if(PT_SYSCALL_NR_OFFSET != PT_SYSCALL_RET_OFFSET) |
354 | PT_SYSCALL_NR(regs->skas.regs) = -1; | 354 | PT_SYSCALL_NR(regs->regs) = -1; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | } | 357 | } |
@@ -578,16 +578,16 @@ void reboot_skas(void) | |||
578 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); | 578 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); |
579 | } | 579 | } |
580 | 580 | ||
581 | void switch_mm_skas(struct mm_id *mm_idp) | 581 | void __switch_mm(struct mm_id *mm_idp) |
582 | { | 582 | { |
583 | int err; | 583 | int err; |
584 | 584 | ||
585 | /* FIXME: need cpu pid in switch_mm_skas */ | 585 | /* FIXME: need cpu pid in __switch_mm */ |
586 | if(proc_mm){ | 586 | if(proc_mm){ |
587 | err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, | 587 | err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, |
588 | mm_idp->u.mm_fd); | 588 | mm_idp->u.mm_fd); |
589 | if(err) | 589 | if(err) |
590 | panic("switch_mm_skas - PTRACE_SWITCH_MM failed, " | 590 | panic("__switch_mm - PTRACE_SWITCH_MM failed, " |
591 | "errno = %d\n", errno); | 591 | "errno = %d\n", errno); |
592 | } | 592 | } |
593 | else userspace_pid[0] = mm_idp->u.pid; | 593 | else userspace_pid[0] = mm_idp->u.pid; |
diff --git a/arch/um/os-Linux/skas/trap.c b/arch/um/os-Linux/skas/trap.c index 3b600c2e63b8..d43e470227de 100644 --- a/arch/um/os-Linux/skas/trap.c +++ b/arch/um/os-Linux/skas/trap.c | |||
@@ -15,13 +15,13 @@ | |||
15 | #include "sysdep/ptrace_user.h" | 15 | #include "sysdep/ptrace_user.h" |
16 | #include "os.h" | 16 | #include "os.h" |
17 | 17 | ||
18 | static union uml_pt_regs ksig_regs[UM_NR_CPUS]; | 18 | static struct uml_pt_regs ksig_regs[UM_NR_CPUS]; |
19 | 19 | ||
20 | void sig_handler_common_skas(int sig, void *sc_ptr) | 20 | void sig_handler_common_skas(int sig, void *sc_ptr) |
21 | { | 21 | { |
22 | struct sigcontext *sc = sc_ptr; | 22 | struct sigcontext *sc = sc_ptr; |
23 | union uml_pt_regs *r; | 23 | struct uml_pt_regs *r; |
24 | void (*handler)(int, union uml_pt_regs *); | 24 | void (*handler)(int, struct uml_pt_regs *); |
25 | int save_user, save_errno = errno; | 25 | int save_user, save_errno = errno; |
26 | 26 | ||
27 | /* This is done because to allow SIGSEGV to be delivered inside a SEGV | 27 | /* This is done because to allow SIGSEGV to be delivered inside a SEGV |
@@ -42,12 +42,12 @@ void sig_handler_common_skas(int sig, void *sc_ptr) | |||
42 | } | 42 | } |
43 | else r = TASK_REGS(get_current()); | 43 | else r = TASK_REGS(get_current()); |
44 | 44 | ||
45 | save_user = r->skas.is_user; | 45 | save_user = r->is_user; |
46 | r->skas.is_user = 0; | 46 | r->is_user = 0; |
47 | if ( sig == SIGFPE || sig == SIGSEGV || | 47 | if ( sig == SIGFPE || sig == SIGSEGV || |
48 | sig == SIGBUS || sig == SIGILL || | 48 | sig == SIGBUS || sig == SIGILL || |
49 | sig == SIGTRAP ) { | 49 | sig == SIGTRAP ) { |
50 | GET_FAULTINFO_FROM_SC(r->skas.faultinfo, sc); | 50 | GET_FAULTINFO_FROM_SC(r->faultinfo, sc); |
51 | } | 51 | } |
52 | 52 | ||
53 | change_sig(SIGUSR1, 1); | 53 | change_sig(SIGUSR1, 1); |
@@ -62,5 +62,5 @@ void sig_handler_common_skas(int sig, void *sc_ptr) | |||
62 | handler(sig, r); | 62 | handler(sig, r); |
63 | 63 | ||
64 | errno = save_errno; | 64 | errno = save_errno; |
65 | r->skas.is_user = save_user; | 65 | r->is_user = save_user; |
66 | } | 66 | } |
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index da5c90df5c9e..abfc094c3c49 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "init.h" | 31 | #include "init.h" |
32 | #include "os.h" | 32 | #include "os.h" |
33 | #include "uml-config.h" | 33 | #include "uml-config.h" |
34 | #include "mode.h" | ||
35 | #include "tempfile.h" | 34 | #include "tempfile.h" |
36 | #include "kern_constants.h" | 35 | #include "kern_constants.h" |
37 | #include "skas.h" | 36 | #include "skas.h" |
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c index b17f546c3655..e87fb5362f44 100644 --- a/arch/um/os-Linux/trap.c +++ b/arch/um/os-Linux/trap.c | |||
@@ -7,15 +7,10 @@ | |||
7 | #include <signal.h> | 7 | #include <signal.h> |
8 | #include "kern_util.h" | 8 | #include "kern_util.h" |
9 | #include "os.h" | 9 | #include "os.h" |
10 | #include "mode.h" | ||
11 | #include "longjmp.h" | 10 | #include "longjmp.h" |
12 | 11 | ||
13 | void usr2_handler(int sig, union uml_pt_regs *regs) | ||
14 | { | ||
15 | } | ||
16 | |||
17 | /* Initialized from linux_main() */ | 12 | /* Initialized from linux_main() */ |
18 | void (*sig_info[NSIG])(int, union uml_pt_regs *); | 13 | void (*sig_info[NSIG])(int, struct uml_pt_regs *); |
19 | 14 | ||
20 | void os_fill_handlinfo(struct kern_handlers h) | 15 | void os_fill_handlinfo(struct kern_handlers h) |
21 | { | 16 | { |
@@ -28,7 +23,6 @@ void os_fill_handlinfo(struct kern_handlers h) | |||
28 | sig_info[SIGIO] = h.sigio_handler; | 23 | sig_info[SIGIO] = h.sigio_handler; |
29 | sig_info[SIGVTALRM] = h.timer_handler; | 24 | sig_info[SIGVTALRM] = h.timer_handler; |
30 | sig_info[SIGALRM] = h.timer_handler; | 25 | sig_info[SIGALRM] = h.timer_handler; |
31 | sig_info[SIGUSR2] = usr2_handler; | ||
32 | } | 26 | } |
33 | 27 | ||
34 | void do_longjmp(void *b, int val) | 28 | void do_longjmp(void *b, int val) |
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index b462863f7172..e36541e5ec00 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include "init.h" | 11 | #include "init.h" |
12 | #include "os.h" | 12 | #include "os.h" |
13 | #include "user.h" | 13 | #include "user.h" |
14 | #include "mode.h" | ||
15 | 14 | ||
16 | #define UML_DIR "~/.uml/" | 15 | #define UML_DIR "~/.uml/" |
17 | 16 | ||
diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c index 0393e44813e7..25c1165d8093 100644 --- a/arch/um/sys-i386/bugs.c +++ b/arch/um/sys-i386/bugs.c | |||
@@ -162,7 +162,7 @@ void arch_check_bugs(void) | |||
162 | host_has_xmm = have_it; | 162 | host_has_xmm = have_it; |
163 | } | 163 | } |
164 | 164 | ||
165 | int arch_handle_signal(int sig, union uml_pt_regs *regs) | 165 | int arch_handle_signal(int sig, struct uml_pt_regs *regs) |
166 | { | 166 | { |
167 | unsigned char tmp[2]; | 167 | unsigned char tmp[2]; |
168 | 168 | ||
diff --git a/arch/um/sys-i386/fault.c b/arch/um/sys-i386/fault.c index 745b4fd49e9f..cc06a5737df0 100644 --- a/arch/um/sys-i386/fault.c +++ b/arch/um/sys-i386/fault.c | |||
@@ -15,7 +15,7 @@ struct exception_table_entry | |||
15 | const struct exception_table_entry *search_exception_tables(unsigned long add); | 15 | const struct exception_table_entry *search_exception_tables(unsigned long add); |
16 | 16 | ||
17 | /* Compare this to arch/i386/mm/extable.c:fixup_exception() */ | 17 | /* Compare this to arch/i386/mm/extable.c:fixup_exception() */ |
18 | int arch_fixup(unsigned long address, union uml_pt_regs *regs) | 18 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs) |
19 | { | 19 | { |
20 | const struct exception_table_entry *fixup; | 20 | const struct exception_table_entry *fixup; |
21 | 21 | ||
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c index 2683d302395d..906c2a4e7279 100644 --- a/arch/um/sys-i386/ldt.c +++ b/arch/um/sys-i386/ldt.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include "asm/ldt.h" | 13 | #include "asm/ldt.h" |
14 | #include "asm/unistd.h" | 14 | #include "asm/unistd.h" |
15 | #include "kern.h" | 15 | #include "kern.h" |
16 | #include "mode_kern.h" | ||
17 | #include "os.h" | 16 | #include "os.h" |
18 | 17 | ||
19 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); | 18 | extern int modify_ldt(int func, void *ptr, unsigned long bytecount); |
@@ -33,7 +32,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, | |||
33 | * modify isn't current->active_mm. | 32 | * modify isn't current->active_mm. |
34 | * If this is called directly by modify_ldt, | 33 | * If this is called directly by modify_ldt, |
35 | * (current->active_mm->context.skas.u == mm_idp) | 34 | * (current->active_mm->context.skas.u == mm_idp) |
36 | * will be true. So no call to switch_mm_skas(mm_idp) is done. | 35 | * will be true. So no call to __switch_mm(mm_idp) is done. |
37 | * If this is called in case of init_new_ldt or PTRACE_LDT, | 36 | * If this is called in case of init_new_ldt or PTRACE_LDT, |
38 | * mm_idp won't belong to current->active_mm, but child->mm. | 37 | * mm_idp won't belong to current->active_mm, but child->mm. |
39 | * So we need to switch child's mm into our userspace, then | 38 | * So we need to switch child's mm into our userspace, then |
@@ -43,7 +42,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, | |||
43 | */ | 42 | */ |
44 | if(!current->active_mm || current->active_mm == &init_mm || | 43 | if(!current->active_mm || current->active_mm == &init_mm || |
45 | mm_idp != ¤t->active_mm->context.skas.id) | 44 | mm_idp != ¤t->active_mm->context.skas.id) |
46 | switch_mm_skas(mm_idp); | 45 | __switch_mm(mm_idp); |
47 | } | 46 | } |
48 | 47 | ||
49 | if(ptrace_ldt) { | 48 | if(ptrace_ldt) { |
@@ -88,7 +87,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc, | |||
88 | */ | 87 | */ |
89 | if(current->active_mm && current->active_mm != &init_mm && | 88 | if(current->active_mm && current->active_mm != &init_mm && |
90 | mm_idp != ¤t->active_mm->context.skas.id) | 89 | mm_idp != ¤t->active_mm->context.skas.id) |
91 | switch_mm_skas(¤t->active_mm->context.skas.id); | 90 | __switch_mm(¤t->active_mm->context.skas.id); |
92 | } | 91 | } |
93 | 92 | ||
94 | return res; | 93 | return res; |
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c index 7792365827a2..dcf0c6b310c8 100644 --- a/arch/um/sys-i386/ptrace.c +++ b/arch/um/sys-i386/ptrace.c | |||
@@ -14,16 +14,18 @@ | |||
14 | #include "sysdep/sigcontext.h" | 14 | #include "sysdep/sigcontext.h" |
15 | #include "sysdep/sc.h" | 15 | #include "sysdep/sc.h" |
16 | 16 | ||
17 | void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) | 17 | extern int arch_switch_tls(struct task_struct *from, struct task_struct *to); |
18 | |||
19 | void arch_switch_to(struct task_struct *from, struct task_struct *to) | ||
18 | { | 20 | { |
19 | int err = arch_switch_tls_skas(from, to); | 21 | int err = arch_switch_tls(from, to); |
20 | if (!err) | 22 | if (!err) |
21 | return; | 23 | return; |
22 | 24 | ||
23 | if (err != -EINVAL) | 25 | if (err != -EINVAL) |
24 | printk(KERN_WARNING "arch_switch_tls_skas failed, errno %d, not EINVAL\n", -err); | 26 | printk(KERN_WARNING "arch_switch_tls failed, errno %d, not EINVAL\n", -err); |
25 | else | 27 | else |
26 | printk(KERN_WARNING "arch_switch_tls_skas failed, errno = EINVAL\n"); | 28 | printk(KERN_WARNING "arch_switch_tls failed, errno = EINVAL\n"); |
27 | } | 29 | } |
28 | 30 | ||
29 | int is_syscall(unsigned long addr) | 31 | int is_syscall(unsigned long addr) |
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index a9fe8d6f72c3..c64d48734e3a 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c | |||
@@ -14,30 +14,30 @@ | |||
14 | #include "registers.h" | 14 | #include "registers.h" |
15 | #include "skas.h" | 15 | #include "skas.h" |
16 | 16 | ||
17 | void copy_sc(union uml_pt_regs *regs, void *from) | 17 | void copy_sc(struct uml_pt_regs *regs, void *from) |
18 | { | 18 | { |
19 | struct sigcontext *sc = from; | 19 | struct sigcontext *sc = from; |
20 | 20 | ||
21 | REGS_GS(regs->skas.regs) = sc->gs; | 21 | REGS_GS(regs->regs) = sc->gs; |
22 | REGS_FS(regs->skas.regs) = sc->fs; | 22 | REGS_FS(regs->regs) = sc->fs; |
23 | REGS_ES(regs->skas.regs) = sc->es; | 23 | REGS_ES(regs->regs) = sc->es; |
24 | REGS_DS(regs->skas.regs) = sc->ds; | 24 | REGS_DS(regs->regs) = sc->ds; |
25 | REGS_EDI(regs->skas.regs) = sc->edi; | 25 | REGS_EDI(regs->regs) = sc->edi; |
26 | REGS_ESI(regs->skas.regs) = sc->esi; | 26 | REGS_ESI(regs->regs) = sc->esi; |
27 | REGS_EBP(regs->skas.regs) = sc->ebp; | 27 | REGS_EBP(regs->regs) = sc->ebp; |
28 | REGS_SP(regs->skas.regs) = sc->esp; | 28 | REGS_SP(regs->regs) = sc->esp; |
29 | REGS_EBX(regs->skas.regs) = sc->ebx; | 29 | REGS_EBX(regs->regs) = sc->ebx; |
30 | REGS_EDX(regs->skas.regs) = sc->edx; | 30 | REGS_EDX(regs->regs) = sc->edx; |
31 | REGS_ECX(regs->skas.regs) = sc->ecx; | 31 | REGS_ECX(regs->regs) = sc->ecx; |
32 | REGS_EAX(regs->skas.regs) = sc->eax; | 32 | REGS_EAX(regs->regs) = sc->eax; |
33 | REGS_IP(regs->skas.regs) = sc->eip; | 33 | REGS_IP(regs->regs) = sc->eip; |
34 | REGS_CS(regs->skas.regs) = sc->cs; | 34 | REGS_CS(regs->regs) = sc->cs; |
35 | REGS_EFLAGS(regs->skas.regs) = sc->eflags; | 35 | REGS_EFLAGS(regs->regs) = sc->eflags; |
36 | REGS_SS(regs->skas.regs) = sc->ss; | 36 | REGS_SS(regs->regs) = sc->ss; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int copy_sc_from_user_skas(struct pt_regs *regs, | 39 | static int copy_sc_from_user(struct pt_regs *regs, |
40 | struct sigcontext __user *from) | 40 | struct sigcontext __user *from) |
41 | { | 41 | { |
42 | struct sigcontext sc; | 42 | struct sigcontext sc; |
43 | unsigned long fpregs[HOST_FP_SIZE]; | 43 | unsigned long fpregs[HOST_FP_SIZE]; |
@@ -60,31 +60,32 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, | |||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp, | 63 | static int copy_sc_to_user(struct sigcontext __user *to, |
64 | struct pt_regs *regs, unsigned long sp) | 64 | struct _fpstate __user *to_fp, struct pt_regs *regs, |
65 | unsigned long sp) | ||
65 | { | 66 | { |
66 | struct sigcontext sc; | 67 | struct sigcontext sc; |
67 | unsigned long fpregs[HOST_FP_SIZE]; | 68 | unsigned long fpregs[HOST_FP_SIZE]; |
68 | struct faultinfo * fi = ¤t->thread.arch.faultinfo; | 69 | struct faultinfo * fi = ¤t->thread.arch.faultinfo; |
69 | int err; | 70 | int err; |
70 | 71 | ||
71 | sc.gs = REGS_GS(regs->regs.skas.regs); | 72 | sc.gs = REGS_GS(regs->regs.regs); |
72 | sc.fs = REGS_FS(regs->regs.skas.regs); | 73 | sc.fs = REGS_FS(regs->regs.regs); |
73 | sc.es = REGS_ES(regs->regs.skas.regs); | 74 | sc.es = REGS_ES(regs->regs.regs); |
74 | sc.ds = REGS_DS(regs->regs.skas.regs); | 75 | sc.ds = REGS_DS(regs->regs.regs); |
75 | sc.edi = REGS_EDI(regs->regs.skas.regs); | 76 | sc.edi = REGS_EDI(regs->regs.regs); |
76 | sc.esi = REGS_ESI(regs->regs.skas.regs); | 77 | sc.esi = REGS_ESI(regs->regs.regs); |
77 | sc.ebp = REGS_EBP(regs->regs.skas.regs); | 78 | sc.ebp = REGS_EBP(regs->regs.regs); |
78 | sc.esp = sp; | 79 | sc.esp = sp; |
79 | sc.ebx = REGS_EBX(regs->regs.skas.regs); | 80 | sc.ebx = REGS_EBX(regs->regs.regs); |
80 | sc.edx = REGS_EDX(regs->regs.skas.regs); | 81 | sc.edx = REGS_EDX(regs->regs.regs); |
81 | sc.ecx = REGS_ECX(regs->regs.skas.regs); | 82 | sc.ecx = REGS_ECX(regs->regs.regs); |
82 | sc.eax = REGS_EAX(regs->regs.skas.regs); | 83 | sc.eax = REGS_EAX(regs->regs.regs); |
83 | sc.eip = REGS_IP(regs->regs.skas.regs); | 84 | sc.eip = REGS_IP(regs->regs.regs); |
84 | sc.cs = REGS_CS(regs->regs.skas.regs); | 85 | sc.cs = REGS_CS(regs->regs.regs); |
85 | sc.eflags = REGS_EFLAGS(regs->regs.skas.regs); | 86 | sc.eflags = REGS_EFLAGS(regs->regs.regs); |
86 | sc.esp_at_signal = regs->regs.skas.regs[UESP]; | 87 | sc.esp_at_signal = regs->regs.regs[UESP]; |
87 | sc.ss = regs->regs.skas.regs[SS]; | 88 | sc.ss = regs->regs.regs[SS]; |
88 | sc.cr2 = fi->cr2; | 89 | sc.cr2 = fi->cr2; |
89 | sc.err = fi->error_code; | 90 | sc.err = fi->error_code; |
90 | sc.trapno = fi->trap_no; | 91 | sc.trapno = fi->trap_no; |
@@ -105,17 +106,6 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *t | |||
105 | copy_to_user(to_fp, fpregs, sizeof(fpregs)); | 106 | copy_to_user(to_fp, fpregs, sizeof(fpregs)); |
106 | } | 107 | } |
107 | 108 | ||
108 | static int copy_sc_from_user(struct pt_regs *to, void __user *from) | ||
109 | { | ||
110 | return copy_sc_from_user_skas(to, from); | ||
111 | } | ||
112 | |||
113 | static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, | ||
114 | struct pt_regs *from, unsigned long sp) | ||
115 | { | ||
116 | return copy_sc_to_user_skas(to, fp, from, sp); | ||
117 | } | ||
118 | |||
119 | static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, | 109 | static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp, |
120 | sigset_t *set, unsigned long sp) | 110 | sigset_t *set, unsigned long sp) |
121 | { | 111 | { |
diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c index bb4d0e23aa81..6cb7cbd137a0 100644 --- a/arch/um/sys-i386/tls.c +++ b/arch/um/sys-i386/tls.c | |||
@@ -14,9 +14,7 @@ | |||
14 | #include "asm/desc.h" | 14 | #include "asm/desc.h" |
15 | #include "kern.h" | 15 | #include "kern.h" |
16 | #include "kern_util.h" | 16 | #include "kern_util.h" |
17 | #include "mode_kern.h" | ||
18 | #include "os.h" | 17 | #include "os.h" |
19 | #include "mode.h" | ||
20 | #include "skas.h" | 18 | #include "skas.h" |
21 | 19 | ||
22 | /* | 20 | /* |
@@ -167,7 +165,7 @@ void clear_flushed_tls(struct task_struct *task) | |||
167 | * And this will not need be used when (and if) we'll add support to the host | 165 | * And this will not need be used when (and if) we'll add support to the host |
168 | * SKAS patch. */ | 166 | * SKAS patch. */ |
169 | 167 | ||
170 | int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to) | 168 | int arch_switch_tls(struct task_struct *from, struct task_struct *to) |
171 | { | 169 | { |
172 | if (!host_supports_tls) | 170 | if (!host_supports_tls) |
173 | return 0; | 171 | return 0; |
diff --git a/arch/um/sys-x86_64/bugs.c b/arch/um/sys-x86_64/bugs.c index 095478890371..506b6765bbcb 100644 --- a/arch/um/sys-x86_64/bugs.c +++ b/arch/um/sys-x86_64/bugs.c | |||
@@ -14,7 +14,7 @@ void arch_check_bugs(void) | |||
14 | { | 14 | { |
15 | } | 15 | } |
16 | 16 | ||
17 | int arch_handle_signal(int sig, union uml_pt_regs *regs) | 17 | int arch_handle_signal(int sig, struct uml_pt_regs *regs) |
18 | { | 18 | { |
19 | return 0; | 19 | return 0; |
20 | } | 20 | } |
diff --git a/arch/um/sys-x86_64/fault.c b/arch/um/sys-x86_64/fault.c index 4636b1465b6c..79f37ef3dceb 100644 --- a/arch/um/sys-x86_64/fault.c +++ b/arch/um/sys-x86_64/fault.c | |||
@@ -14,7 +14,7 @@ struct exception_table_entry | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | const struct exception_table_entry *search_exception_tables(unsigned long add); | 16 | const struct exception_table_entry *search_exception_tables(unsigned long add); |
17 | int arch_fixup(unsigned long address, union uml_pt_regs *regs) | 17 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs) |
18 | { | 18 | { |
19 | const struct exception_table_entry *fixup; | 19 | const struct exception_table_entry *fixup; |
20 | 20 | ||
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index 2d6cdd260c26..a06d66d0c409 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -16,12 +16,12 @@ | |||
16 | #include "frame_kern.h" | 16 | #include "frame_kern.h" |
17 | #include "skas.h" | 17 | #include "skas.h" |
18 | 18 | ||
19 | void copy_sc(union uml_pt_regs *regs, void *from) | 19 | void copy_sc(struct uml_pt_regs *regs, void *from) |
20 | { | 20 | { |
21 | struct sigcontext *sc = from; | 21 | struct sigcontext *sc = from; |
22 | 22 | ||
23 | #define GETREG(regs, regno, sc, regname) \ | 23 | #define GETREG(regs, regno, sc, regname) \ |
24 | (regs)->skas.regs[(regno) / sizeof(unsigned long)] = (sc)->regname | 24 | (regs)->regs[(regno) / sizeof(unsigned long)] = (sc)->regname |
25 | 25 | ||
26 | GETREG(regs, R8, sc, r8); | 26 | GETREG(regs, R8, sc, r8); |
27 | GETREG(regs, R9, sc, r9); | 27 | GETREG(regs, R9, sc, r9); |
@@ -46,13 +46,13 @@ void copy_sc(union uml_pt_regs *regs, void *from) | |||
46 | #undef GETREG | 46 | #undef GETREG |
47 | } | 47 | } |
48 | 48 | ||
49 | static int copy_sc_from_user_skas(struct pt_regs *regs, | 49 | static int copy_sc_from_user(struct pt_regs *regs, |
50 | struct sigcontext __user *from) | 50 | struct sigcontext __user *from) |
51 | { | 51 | { |
52 | int err = 0; | 52 | int err = 0; |
53 | 53 | ||
54 | #define GETREG(regs, regno, sc, regname) \ | 54 | #define GETREG(regs, regno, sc, regname) \ |
55 | __get_user((regs)->regs.skas.regs[(regno) / sizeof(unsigned long)], \ | 55 | __get_user((regs)->regs.regs[(regno) / sizeof(unsigned long)], \ |
56 | &(sc)->regname) | 56 | &(sc)->regname) |
57 | 57 | ||
58 | err |= GETREG(regs, R8, from, r8); | 58 | err |= GETREG(regs, R8, from, r8); |
@@ -80,10 +80,9 @@ static int copy_sc_from_user_skas(struct pt_regs *regs, | |||
80 | return err; | 80 | return err; |
81 | } | 81 | } |
82 | 82 | ||
83 | int copy_sc_to_user_skas(struct sigcontext __user *to, | 83 | static int copy_sc_to_user(struct sigcontext __user *to, |
84 | struct _fpstate __user *to_fp, | 84 | struct _fpstate __user *to_fp, struct pt_regs *regs, |
85 | struct pt_regs *regs, unsigned long mask, | 85 | unsigned long mask, unsigned long sp) |
86 | unsigned long sp) | ||
87 | { | 86 | { |
88 | struct faultinfo * fi = ¤t->thread.arch.faultinfo; | 87 | struct faultinfo * fi = ¤t->thread.arch.faultinfo; |
89 | int err = 0; | 88 | int err = 0; |
@@ -92,7 +91,7 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, | |||
92 | err |= __put_user(0, &to->fs); | 91 | err |= __put_user(0, &to->fs); |
93 | 92 | ||
94 | #define PUTREG(regs, regno, sc, regname) \ | 93 | #define PUTREG(regs, regno, sc, regname) \ |
95 | __put_user((regs)->regs.skas.regs[(regno) / sizeof(unsigned long)], \ | 94 | __put_user((regs)->regs.regs[(regno) / sizeof(unsigned long)], \ |
96 | &(sc)->regname) | 95 | &(sc)->regname) |
97 | 96 | ||
98 | err |= PUTREG(regs, RDI, to, rdi); | 97 | err |= PUTREG(regs, RDI, to, rdi); |
@@ -130,22 +129,6 @@ int copy_sc_to_user_skas(struct sigcontext __user *to, | |||
130 | return(err); | 129 | return(err); |
131 | } | 130 | } |
132 | 131 | ||
133 | static int copy_sc_from_user(struct pt_regs *to, void __user *from) | ||
134 | { | ||
135 | int ret; | ||
136 | |||
137 | ret = copy_sc_from_user_skas(to, from); | ||
138 | return(ret); | ||
139 | } | ||
140 | |||
141 | static int copy_sc_to_user(struct sigcontext __user *to, | ||
142 | struct _fpstate __user *fp, | ||
143 | struct pt_regs *from, unsigned long mask, | ||
144 | unsigned long sp) | ||
145 | { | ||
146 | return copy_sc_to_user_skas(to, fp, from, mask, sp); | ||
147 | } | ||
148 | |||
149 | struct rt_sigframe | 132 | struct rt_sigframe |
150 | { | 133 | { |
151 | char __user *pretcode; | 134 | char __user *pretcode; |
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index d44398c9d27a..bbcab773b23d 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -28,8 +28,7 @@ asmlinkage long sys_uname64(struct new_utsname __user * name) | |||
28 | return err ? -EFAULT : 0; | 28 | return err ? -EFAULT : 0; |
29 | } | 29 | } |
30 | 30 | ||
31 | long arch_prctl_skas(struct task_struct *task, int code, | 31 | long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) |
32 | unsigned long __user *addr) | ||
33 | { | 32 | { |
34 | unsigned long *ptr = addr, tmp; | 33 | unsigned long *ptr = addr, tmp; |
35 | long ret; | 34 | long ret; |
@@ -91,7 +90,7 @@ long arch_prctl_skas(struct task_struct *task, int code, | |||
91 | 90 | ||
92 | long sys_arch_prctl(int code, unsigned long addr) | 91 | long sys_arch_prctl(int code, unsigned long addr) |
93 | { | 92 | { |
94 | return arch_prctl_skas(current, code, (unsigned long __user *) addr); | 93 | return arch_prctl(current, code, (unsigned long __user *) addr); |
95 | } | 94 | } |
96 | 95 | ||
97 | long sys_clone(unsigned long clone_flags, unsigned long newsp, | 96 | long sys_clone(unsigned long clone_flags, unsigned long newsp, |
@@ -108,10 +107,10 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp, | |||
108 | return ret; | 107 | return ret; |
109 | } | 108 | } |
110 | 109 | ||
111 | void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) | 110 | void arch_switch_to(struct task_struct *from, struct task_struct *to) |
112 | { | 111 | { |
113 | if((to->thread.arch.fs == 0) || (to->mm == NULL)) | 112 | if((to->thread.arch.fs == 0) || (to->mm == NULL)) |
114 | return; | 113 | return; |
115 | 114 | ||
116 | arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); | 115 | arch_prctl(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); |
117 | } | 116 | } |
diff --git a/arch/um/sys-x86_64/tls.c b/arch/um/sys-x86_64/tls.c index febbc94be25f..fcd5217c26a5 100644 --- a/arch/um/sys-x86_64/tls.c +++ b/arch/um/sys-x86_64/tls.c | |||
@@ -11,7 +11,7 @@ int arch_copy_tls(struct task_struct *t) | |||
11 | * (which is argument 5, child_tid, of clone) so it can be set | 11 | * (which is argument 5, child_tid, of clone) so it can be set |
12 | * during context switches. | 12 | * during context switches. |
13 | */ | 13 | */ |
14 | t->thread.arch.fs = t->thread.regs.regs.skas.regs[R8 / sizeof(long)]; | 14 | t->thread.arch.fs = t->thread.regs.regs.regs[R8 / sizeof(long)]; |
15 | 15 | ||
16 | return 0; | 16 | return 0; |
17 | } | 17 | } |
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h index a4186af65f24..0c4a375000a9 100644 --- a/include/asm-um/mmu_context.h +++ b/include/asm-um/mmu_context.h | |||
@@ -29,7 +29,7 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) | |||
29 | * possible. | 29 | * possible. |
30 | */ | 30 | */ |
31 | if (old != new && (current->flags & PF_BORROWED_MM)) | 31 | if (old != new && (current->flags & PF_BORROWED_MM)) |
32 | switch_mm_skas(&new->context.skas.id); | 32 | __switch_mm(&new->context.skas.id); |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | 35 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
@@ -41,7 +41,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
41 | cpu_clear(cpu, prev->cpu_vm_mask); | 41 | cpu_clear(cpu, prev->cpu_vm_mask); |
42 | cpu_set(cpu, next->cpu_vm_mask); | 42 | cpu_set(cpu, next->cpu_vm_mask); |
43 | if(next != &init_mm) | 43 | if(next != &init_mm) |
44 | switch_mm_skas(&next->context.skas.id); | 44 | __switch_mm(&next->context.skas.id); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
@@ -50,21 +50,9 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, | |||
50 | { | 50 | { |
51 | } | 51 | } |
52 | 52 | ||
53 | extern int init_new_context_skas(struct task_struct *task, | 53 | extern int init_new_context(struct task_struct *task, struct mm_struct *mm); |
54 | struct mm_struct *mm); | ||
55 | 54 | ||
56 | static inline int init_new_context(struct task_struct *task, | 55 | extern void destroy_context(struct mm_struct *mm); |
57 | struct mm_struct *mm) | ||
58 | { | ||
59 | return(init_new_context_skas(task, mm)); | ||
60 | } | ||
61 | |||
62 | extern void destroy_context_skas(struct mm_struct *mm); | ||
63 | |||
64 | static inline void destroy_context(struct mm_struct *mm) | ||
65 | { | ||
66 | destroy_context_skas(mm); | ||
67 | } | ||
68 | 56 | ||
69 | #endif | 57 | #endif |
70 | 58 | ||
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h index be3ffec3a6a6..126df73f5401 100644 --- a/include/asm-um/processor-generic.h +++ b/include/asm-um/processor-generic.h | |||
@@ -32,12 +32,8 @@ struct thread_struct { | |||
32 | unsigned long temp_stack; | 32 | unsigned long temp_stack; |
33 | void *exec_buf; | 33 | void *exec_buf; |
34 | struct arch_thread arch; | 34 | struct arch_thread arch; |
35 | union { | 35 | jmp_buf switch_buf; |
36 | struct { | 36 | int mm_count; |
37 | jmp_buf switch_buf; | ||
38 | int mm_count; | ||
39 | } skas; | ||
40 | } mode; | ||
41 | struct { | 37 | struct { |
42 | int op; | 38 | int op; |
43 | union { | 39 | union { |
@@ -75,7 +71,10 @@ typedef struct { | |||
75 | 71 | ||
76 | extern struct task_struct *alloc_task_struct(void); | 72 | extern struct task_struct *alloc_task_struct(void); |
77 | 73 | ||
78 | extern void release_thread(struct task_struct *); | 74 | static inline void release_thread(struct task_struct *task) |
75 | { | ||
76 | } | ||
77 | |||
79 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | 78 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); |
80 | 79 | ||
81 | static inline void prepare_to_copy(struct task_struct *tsk) | 80 | static inline void prepare_to_copy(struct task_struct *tsk) |
@@ -125,8 +124,7 @@ extern struct cpuinfo_um cpu_data[]; | |||
125 | #endif | 124 | #endif |
126 | 125 | ||
127 | 126 | ||
128 | #define KSTK_REG(tsk, reg) \ | 127 | #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf) |
129 | get_thread_reg(reg, &tsk->thread.mode.skas.switch_buf) | ||
130 | #define get_wchan(p) (0) | 128 | #define get_wchan(p) (0) |
131 | 129 | ||
132 | #endif | 130 | #endif |
diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h index 99c87c5ce994..c8b3e6bf6a43 100644 --- a/include/asm-um/ptrace-generic.h +++ b/include/asm-um/ptrace-generic.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include "sysdep/ptrace.h" | 12 | #include "sysdep/ptrace.h" |
13 | 13 | ||
14 | struct pt_regs { | 14 | struct pt_regs { |
15 | union uml_pt_regs regs; | 15 | struct uml_pt_regs regs; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | #define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS } | 18 | #define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS } |
@@ -44,7 +44,7 @@ extern int set_fpxregs(unsigned long buf, struct task_struct *tsk); | |||
44 | 44 | ||
45 | extern void show_regs(struct pt_regs *regs); | 45 | extern void show_regs(struct pt_regs *regs); |
46 | 46 | ||
47 | extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, | 47 | extern void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs, |
48 | int error_code); | 48 | int error_code); |
49 | 49 | ||
50 | extern int arch_copy_tls(struct task_struct *new); | 50 | extern int arch_copy_tls(struct task_struct *new); |
diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h index 4928a31aca7d..b733fa32b618 100644 --- a/include/asm-um/ptrace-i386.h +++ b/include/asm-um/ptrace-i386.h | |||
@@ -46,21 +46,4 @@ extern int ptrace_get_thread_area(struct task_struct *child, int idx, | |||
46 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, | 46 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, |
47 | struct user_desc __user *user_desc); | 47 | struct user_desc __user *user_desc); |
48 | 48 | ||
49 | extern int do_set_thread_area_skas(struct user_desc *info); | ||
50 | extern int do_get_thread_area_skas(struct user_desc *info); | ||
51 | |||
52 | extern int do_set_thread_area_tt(struct user_desc *info); | ||
53 | extern int do_get_thread_area_tt(struct user_desc *info); | ||
54 | |||
55 | extern int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to); | ||
56 | extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to); | ||
57 | |||
58 | extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to); | ||
59 | extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to); | ||
60 | |||
61 | extern int do_get_thread_area_skas(struct user_desc *info); | ||
62 | extern int do_set_thread_area_skas(struct user_desc *info); | ||
63 | |||
64 | struct task_struct; | ||
65 | |||
66 | #endif | 49 | #endif |
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h index bf61d17de3f7..4c475350dcf0 100644 --- a/include/asm-um/ptrace-x86_64.h +++ b/include/asm-um/ptrace-x86_64.h | |||
@@ -76,15 +76,6 @@ static inline int ptrace_set_thread_area(struct task_struct *child, int idx, | |||
76 | return -ENOSYS; | 76 | return -ENOSYS; |
77 | } | 77 | } |
78 | 78 | ||
79 | static inline void arch_switch_to_tt(struct task_struct *from, | 79 | extern long arch_prctl(struct task_struct *task, int code, |
80 | struct task_struct *to) | 80 | unsigned long __user *addr); |
81 | { | ||
82 | } | ||
83 | |||
84 | extern void arch_switch_to_skas(struct task_struct *from, | ||
85 | struct task_struct *to); | ||
86 | |||
87 | extern long arch_prctl_skas(struct task_struct *task, int code, | ||
88 | unsigned long __user *addr); | ||
89 | |||
90 | #endif | 81 | #endif |
diff --git a/include/asm-um/tlbflush.h b/include/asm-um/tlbflush.h index 1520b083e9db..9d647c55350b 100644 --- a/include/asm-um/tlbflush.h +++ b/include/asm-um/tlbflush.h | |||
@@ -24,18 +24,7 @@ extern void flush_tlb_all(void); | |||
24 | extern void flush_tlb_mm(struct mm_struct *mm); | 24 | extern void flush_tlb_mm(struct mm_struct *mm); |
25 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | 25 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, |
26 | unsigned long end); | 26 | unsigned long end); |
27 | extern void flush_tlb_page_skas(struct vm_area_struct *vma, | 27 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long address); |
28 | unsigned long address); | ||
29 | |||
30 | static inline void flush_tlb_page(struct vm_area_struct *vma, | ||
31 | unsigned long address) | ||
32 | { | ||
33 | address &= PAGE_MASK; | ||
34 | |||
35 | flush_tlb_page_skas(vma, address); | ||
36 | } | ||
37 | |||
38 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); | ||
39 | extern void flush_tlb_kernel_vm(void); | 28 | extern void flush_tlb_kernel_vm(void); |
40 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | 29 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); |
41 | extern void __flush_tlb_one(unsigned long addr); | 30 | extern void __flush_tlb_one(unsigned long addr); |