From 77bf4400319db9d2a8af6b00c2be6faa0f3d07cb Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Tue, 16 Oct 2007 01:26:58 -0700 Subject: uml: remove code made redundant by CHOOSE_MODE removal This patch makes a number of simplifications enabled by the removal of CHOOSE_MODE. There were lots of functions that looked like int foo(args){ foo_skas(args); } The bodies of foo_skas are now folded into foo, and their declarations (and sometimes entire header files) are deleted. In addition, the union uml_pt_regs, which was a union between the tt and skas register formats, is now a struct, with the tt-mode arm of the union being removed. It turns out that usr2_handler was unused, so it is gone. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/include/arch.h | 4 +- arch/um/include/as-layout.h | 2 +- arch/um/include/irq_user.h | 2 +- arch/um/include/kern_util.h | 22 ++++----- arch/um/include/mconsole.h | 2 +- arch/um/include/mode.h | 11 ----- arch/um/include/mode_kern.h | 11 ----- arch/um/include/os.h | 6 +-- arch/um/include/registers.h | 6 +-- arch/um/include/skas/mmu-skas.h | 2 +- arch/um/include/skas/mode_kern_skas.h | 42 ---------------- arch/um/include/skas/skas.h | 2 +- arch/um/include/sysdep-i386/ptrace.h | 59 +++++++++++------------ arch/um/include/sysdep-x86_64/ptrace.h | 88 ++++++++++++++++------------------ arch/um/include/task.h | 2 +- 15 files changed, 93 insertions(+), 168 deletions(-) delete mode 100644 arch/um/include/mode.h delete mode 100644 arch/um/include/mode_kern.h delete mode 100644 arch/um/include/skas/mode_kern_skas.h (limited to 'arch/um/include') diff --git a/arch/um/include/arch.h b/arch/um/include/arch.h index 10ad52daa8c..49c601ff2ba 100644 --- a/arch/um/include/arch.h +++ b/arch/um/include/arch.h @@ -9,7 +9,7 @@ #include "sysdep/ptrace.h" extern void arch_check_bugs(void); -extern int arch_fixup(unsigned long address, union uml_pt_regs *regs); -extern int arch_handle_signal(int sig, union uml_pt_regs *regs); +extern int arch_fixup(unsigned long address, struct uml_pt_regs *regs); +extern int arch_handle_signal(int sig, struct uml_pt_regs *regs); #endif diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h index e44f32940f8..2f16a1c7d61 100644 --- a/arch/um/include/as-layout.h +++ b/arch/um/include/as-layout.h @@ -29,6 +29,6 @@ extern unsigned long brk_start; extern int linux_main(int argc, char **argv); -extern void (*sig_info[])(int, union uml_pt_regs *); +extern void (*sig_info[])(int, struct uml_pt_regs *); #endif diff --git a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h index 741cb7d6f85..e16ebce1290 100644 --- a/arch/um/include/irq_user.h +++ b/arch/um/include/irq_user.h @@ -21,7 +21,7 @@ struct irq_fd { enum { IRQ_READ, IRQ_WRITE }; -extern void sigio_handler(int sig, union uml_pt_regs *regs); +extern void sigio_handler(int sig, struct uml_pt_regs *regs); extern int activate_fd(int irq, int fd, int type, void *dev_id); extern void free_irq_by_irq_and_dev(unsigned int irq, void *dev_id); 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 578156db303..9d3110f41dd 100644 --- a/arch/um/include/kern_util.h +++ b/arch/um/include/kern_util.h @@ -10,7 +10,7 @@ #include "sysdep/faultinfo.h" #include "uml-config.h" -typedef void (*kern_hndl)(int, union uml_pt_regs *); +typedef void (*kern_hndl)(int, struct uml_pt_regs *); struct kern_handlers { kern_hndl relay_signal; @@ -41,7 +41,7 @@ extern unsigned long alloc_stack(int order, int atomic); extern int do_signal(void); extern int is_stack_fault(unsigned long sp); extern unsigned long segv(struct faultinfo fi, unsigned long ip, - int is_user, union uml_pt_regs *regs); + int is_user, struct uml_pt_regs *regs); extern int handle_page_fault(unsigned long address, unsigned long ip, int is_write, int is_user, int *code_out); extern void syscall_ready(void); @@ -54,7 +54,7 @@ extern int need_finish_fork(void); extern void free_stack(unsigned long stack, int order); extern void add_input_request(int op, void (*proc)(int), void *arg); extern char *current_cmd(void); -extern void timer_handler(int sig, union uml_pt_regs *regs); +extern void timer_handler(int sig, struct uml_pt_regs *regs); extern int set_signals(int enable); extern int pid_to_processor_id(int pid); extern void deliver_signals(void *t); @@ -64,9 +64,9 @@ extern void finish_fork(void); extern void paging_init(void); extern void init_flush_vm(void); extern void *syscall_sp(void *t); -extern void syscall_trace(union uml_pt_regs *regs, int entryexit); +extern void syscall_trace(struct uml_pt_regs *regs, int entryexit); extern int hz(void); -extern unsigned int do_IRQ(int irq, union uml_pt_regs *regs); +extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs); extern void interrupt_end(void); extern void initial_thread_cb(void (*proc)(void *), void *arg); extern int debugger_signal(int status, int pid); @@ -76,9 +76,9 @@ extern int init_ptrace_proxy(int idle_pid, int startup, int stop); extern int init_parent_proxy(int pid); extern int singlestepping(void *t); extern void check_stack_overflow(void *ptr); -extern void relay_signal(int sig, union uml_pt_regs *regs); +extern void relay_signal(int sig, struct uml_pt_regs *regs); extern int user_context(unsigned long sp); -extern void timer_irq(union uml_pt_regs *regs); +extern void timer_irq(struct uml_pt_regs *regs); extern void do_uml_exitcalls(void); extern int attach_debugger(int idle_pid, int pid, int stop); extern int config_gdb(char *str); @@ -109,11 +109,9 @@ extern void time_init_kern(void); /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */ extern int __cant_sleep(void); -extern void sigio_handler(int sig, union uml_pt_regs *regs); - -extern void copy_sc(union uml_pt_regs *regs, void *from); - +extern void sigio_handler(int sig, struct uml_pt_regs *regs); +extern void copy_sc(struct uml_pt_regs *regs, void *from); extern unsigned long to_irq_stack(unsigned long *mask_out); unsigned long from_irq_stack(int nested); - +extern int start_uml(void); #endif diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h index b282839c162..a2c35fecd1f 100644 --- a/arch/um/include/mconsole.h +++ b/arch/um/include/mconsole.h @@ -63,7 +63,7 @@ struct mc_request struct mconsole_request request; struct mconsole_command *cmd; - union uml_pt_regs regs; + struct uml_pt_regs regs; }; extern char mconsole_socket_name[]; diff --git a/arch/um/include/mode.h b/arch/um/include/mode.h deleted file mode 100644 index fcce95cbc16..00000000000 --- a/arch/um/include/mode.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) - * Licensed under the GPL - */ - -#ifndef __MODE_H__ -#define __MODE_H__ - -#include "mode-skas.h" - -#endif diff --git a/arch/um/include/mode_kern.h b/arch/um/include/mode_kern.h deleted file mode 100644 index b2a44c0dcd0..00000000000 --- a/arch/um/include/mode_kern.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) - * Licensed under the GPL - */ - -#ifndef __MODE_KERN_H__ -#define __MODE_KERN_H__ - -#include "mode_kern_skas.h" - -#endif diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 208d9b91fc9..daf188843a9 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, extern int is_skas_winch(int pid, int fd, void *data); extern int start_userspace(unsigned long stub_stack); extern int copy_context_skas0(unsigned long stack, int pid); -extern void save_registers(int pid, union uml_pt_regs *regs); -extern void restore_registers(int pid, union uml_pt_regs *regs); -extern void userspace(union uml_pt_regs *regs); +extern void save_registers(int pid, struct uml_pt_regs *regs); +extern void restore_registers(int pid, struct uml_pt_regs *regs); +extern void userspace(struct uml_pt_regs *regs); extern void map_stub_pages(int fd, unsigned long code, unsigned long data, unsigned long stack); 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 b7d2c4e2c61..8e8ea965118 100644 --- a/arch/um/include/registers.h +++ b/arch/um/include/registers.h @@ -9,11 +9,11 @@ #include "sysdep/ptrace.h" #include "sysdep/archsetjmp.h" -extern void init_thread_registers(union uml_pt_regs *to); +extern void init_thread_registers(struct uml_pt_regs *to); extern int save_fp_registers(int pid, unsigned long *fp_regs); extern int restore_fp_registers(int pid, unsigned long *fp_regs); -extern void save_registers(int pid, union uml_pt_regs *regs); -extern void restore_registers(int pid, union uml_pt_regs *regs); +extern void save_registers(int pid, struct uml_pt_regs *regs); +extern void restore_registers(int pid, struct uml_pt_regs *regs); extern void init_registers(int pid); extern void get_safe_registers(unsigned long *regs); 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 b26986c0c3d..838dfd75e2a 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 { uml_ldt_t ldt; }; -extern void switch_mm_skas(struct mm_id * mm_idp); +extern void __switch_mm(struct mm_id * mm_idp); #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 c29485109a9..00000000000 --- a/arch/um/include/skas/mode_kern_skas.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) - * Licensed under the GPL - */ - -#ifndef __SKAS_MODE_KERN_H__ -#define __SKAS_MODE_KERN_H__ - -#include "linux/sched.h" -#include "asm/page.h" -#include "asm/ptrace.h" -#include "mem_user.h" - -extern void flush_thread_skas(void); -extern void switch_to_skas(void *prev, void *next); -extern void start_thread_skas(struct pt_regs *regs, unsigned long eip, - unsigned long esp); -extern int copy_thread_skas(int nr, unsigned long clone_flags, - unsigned long sp, unsigned long stack_top, - struct task_struct *p, struct pt_regs *regs); -extern void release_thread_skas(struct task_struct *task); -extern void init_idle_skas(void); -extern void flush_tlb_kernel_range_skas(unsigned long start, - unsigned long end); -extern void flush_tlb_kernel_vm_skas(void); -extern void __flush_tlb_one_skas(unsigned long addr); -extern void flush_tlb_range_skas(struct vm_area_struct *vma, - unsigned long start, unsigned long end); -extern void flush_tlb_mm_skas(struct mm_struct *mm); -extern void force_flush_all_skas(void); -extern long execute_syscall_skas(void *r); -extern void before_mem_skas(unsigned long unused); -extern unsigned long set_task_sizes_skas(unsigned long *task_size_out); -extern int start_uml_skas(void); -extern int external_pid_skas(struct task_struct *task); -extern int thread_pid_skas(struct task_struct *task); -extern void flush_tlb_page_skas(struct vm_area_struct *vma, - unsigned long address); - -#define kmem_end_skas (host_task_size - 1024 * 1024) - -#endif diff --git a/arch/um/include/skas/skas.h b/arch/um/include/skas/skas.h index e88926b1607..b4a95e48592 100644 --- a/arch/um/include/skas/skas.h +++ b/arch/um/include/skas/skas.h @@ -15,7 +15,7 @@ extern int skas_needs_stub; extern int user_thread(unsigned long stack, int flags); extern void new_thread_handler(void); -extern void handle_syscall(union uml_pt_regs *regs); +extern void handle_syscall(struct uml_pt_regs *regs); extern int new_mm(unsigned long stack); extern void get_skas_faultinfo(int pid, struct faultinfo * fi); 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 45573088864..d765175d42b 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; #define PTRACE_SYSEMU_SINGLESTEP 32 #endif -union uml_pt_regs { - struct skas_regs { - unsigned long regs[MAX_REG_NR]; - unsigned long fp[HOST_FP_SIZE]; - unsigned long xfp[HOST_XFP_SIZE]; - struct faultinfo faultinfo; - long syscall; - int is_user; - } skas; +struct uml_pt_regs { + unsigned long regs[MAX_REG_NR]; + unsigned long fp[HOST_FP_SIZE]; + unsigned long xfp[HOST_XFP_SIZE]; + struct faultinfo faultinfo; + long syscall; + int is_user; }; #define EMPTY_UML_PT_REGS { } -#define UPT_SC(r) ((r)->tt.sc) -#define UPT_IP(r) REGS_IP((r)->skas.regs) -#define UPT_SP(r) REGS_SP((r)->skas.regs) -#define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs) -#define UPT_EAX(r) REGS_EAX((r)->skas.regs) -#define UPT_EBX(r) REGS_EBX((r)->skas.regs) -#define UPT_ECX(r) REGS_ECX((r)->skas.regs) -#define UPT_EDX(r) REGS_EDX((r)->skas.regs) -#define UPT_ESI(r) REGS_ESI((r)->skas.regs) -#define UPT_EDI(r) REGS_EDI((r)->skas.regs) -#define UPT_EBP(r) REGS_EBP((r)->skas.regs) -#define UPT_ORIG_EAX(r) ((r)->skas.syscall) -#define UPT_CS(r) REGS_CS((r)->skas.regs) -#define UPT_SS(r) REGS_SS((r)->skas.regs) -#define UPT_DS(r) REGS_DS((r)->skas.regs) -#define UPT_ES(r) REGS_ES((r)->skas.regs) -#define UPT_FS(r) REGS_FS((r)->skas.regs) -#define UPT_GS(r) REGS_GS((r)->skas.regs) +#define UPT_IP(r) REGS_IP((r)->regs) +#define UPT_SP(r) REGS_SP((r)->regs) +#define UPT_EFLAGS(r) REGS_EFLAGS((r)->regs) +#define UPT_EAX(r) REGS_EAX((r)->regs) +#define UPT_EBX(r) REGS_EBX((r)->regs) +#define UPT_ECX(r) REGS_ECX((r)->regs) +#define UPT_EDX(r) REGS_EDX((r)->regs) +#define UPT_ESI(r) REGS_ESI((r)->regs) +#define UPT_EDI(r) REGS_EDI((r)->regs) +#define UPT_EBP(r) REGS_EBP((r)->regs) +#define UPT_ORIG_EAX(r) ((r)->syscall) +#define UPT_CS(r) REGS_CS((r)->regs) +#define UPT_SS(r) REGS_SS((r)->regs) +#define UPT_DS(r) REGS_DS((r)->regs) +#define UPT_ES(r) REGS_ES((r)->regs) +#define UPT_FS(r) REGS_FS((r)->regs) +#define UPT_GS(r) REGS_GS((r)->regs) #define UPT_SYSCALL_ARG1(r) UPT_EBX(r) #define UPT_SYSCALL_ARG2(r) UPT_ECX(r) @@ -93,7 +90,7 @@ union uml_pt_regs { extern int user_context(unsigned long sp); -#define UPT_IS_USER(r) ((r)->skas.is_user) +#define UPT_IS_USER(r) ((r)->is_user) struct syscall_args { unsigned long args[6]; @@ -162,14 +159,14 @@ struct syscall_args { } while (0) #define UPT_SET_SYSCALL_RETURN(r, res) \ - REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)) + REGS_SET_SYSCALL_RETURN((r)->regs, (res)) -#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs) +#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->regs) #define UPT_ORIG_SYSCALL(r) UPT_EAX(r) #define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r) #define UPT_SYSCALL_RET(r) UPT_EAX(r) -#define UPT_FAULTINFO(r) (&(r)->skas.faultinfo) +#define UPT_FAULTINFO(r) (&(r)->faultinfo) #endif diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h index b3412b64cbe..ea4afdce59c 100644 --- a/arch/um/include/sysdep-x86_64/ptrace.h +++ b/arch/um/include/sysdep-x86_64/ptrace.h @@ -84,58 +84,52 @@ #define REGS_ERR(r) ((r)->fault_type) -/* XXX */ -union uml_pt_regs { - struct skas_regs { - unsigned long regs[MAX_REG_NR]; - unsigned long fp[HOST_FP_SIZE]; - struct faultinfo faultinfo; - long syscall; - int is_user; - } skas; +struct uml_pt_regs { + unsigned long regs[MAX_REG_NR]; + unsigned long fp[HOST_FP_SIZE]; + struct faultinfo faultinfo; + long syscall; + int is_user; }; #define EMPTY_UML_PT_REGS { } -#define UPT_RBX(r) REGS_RBX((r)->skas.regs) -#define UPT_RCX(r) REGS_RCX((r)->skas.regs) -#define UPT_RDX(r) REGS_RDX((r)->skas.regs) -#define UPT_RSI(r) REGS_RSI((r)->skas.regs) -#define UPT_RDI(r) REGS_RDI((r)->skas.regs) -#define UPT_RBP(r) REGS_RBP((r)->skas.regs) -#define UPT_RAX(r) REGS_RAX((r)->skas.regs) -#define UPT_R8(r) REGS_R8((r)->skas.regs) -#define UPT_R9(r) REGS_R9((r)->skas.regs) -#define UPT_R10(r) REGS_R10((r)->skas.regs) -#define UPT_R11(r) REGS_R11((r)->skas.regs) -#define UPT_R12(r) REGS_R12((r)->skas.regs) -#define UPT_R13(r) REGS_R13((r)->skas.regs) -#define UPT_R14(r) REGS_R14((r)->skas.regs) -#define UPT_R15(r) REGS_R15((r)->skas.regs) -#define UPT_CS(r) REGS_CS((r)->skas.regs) -#define UPT_FS_BASE(r) \ - REGS_FS_BASE((r)->skas.regs) -#define UPT_FS(r) REGS_FS((r)->skas.regs) -#define UPT_GS_BASE(r) \ - REGS_GS_BASE((r)->skas.regs) -#define UPT_GS(r) REGS_GS((r)->skas.regs) -#define UPT_DS(r) REGS_DS((r)->skas.regs) -#define UPT_ES(r) REGS_ES((r)->skas.regs) -#define UPT_CS(r) REGS_CS((r)->skas.regs) -#define UPT_SS(r) REGS_SS((r)->skas.regs) -#define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->skas.regs) - -#define UPT_IP(r) REGS_IP((r)->skas.regs) -#define UPT_SP(r) REGS_SP((r)->skas.regs) - -#define UPT_EFLAGS(r) REGS_EFLAGS((r)->skas.regs) -#define UPT_SC(r) ((r)->tt.sc) -#define UPT_SYSCALL_NR(r) ((r)->skas.syscall) +#define UPT_RBX(r) REGS_RBX((r)->regs) +#define UPT_RCX(r) REGS_RCX((r)->regs) +#define UPT_RDX(r) REGS_RDX((r)->regs) +#define UPT_RSI(r) REGS_RSI((r)->regs) +#define UPT_RDI(r) REGS_RDI((r)->regs) +#define UPT_RBP(r) REGS_RBP((r)->regs) +#define UPT_RAX(r) REGS_RAX((r)->regs) +#define UPT_R8(r) REGS_R8((r)->regs) +#define UPT_R9(r) REGS_R9((r)->regs) +#define UPT_R10(r) REGS_R10((r)->regs) +#define UPT_R11(r) REGS_R11((r)->regs) +#define UPT_R12(r) REGS_R12((r)->regs) +#define UPT_R13(r) REGS_R13((r)->regs) +#define UPT_R14(r) REGS_R14((r)->regs) +#define UPT_R15(r) REGS_R15((r)->regs) +#define UPT_CS(r) REGS_CS((r)->regs) +#define UPT_FS_BASE(r) REGS_FS_BASE((r)->regs) +#define UPT_FS(r) REGS_FS((r)->regs) +#define UPT_GS_BASE(r) REGS_GS_BASE((r)->regs) +#define UPT_GS(r) REGS_GS((r)->regs) +#define UPT_DS(r) REGS_DS((r)->regs) +#define UPT_ES(r) REGS_ES((r)->regs) +#define UPT_CS(r) REGS_CS((r)->regs) +#define UPT_SS(r) REGS_SS((r)->regs) +#define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->regs) + +#define UPT_IP(r) REGS_IP((r)->regs) +#define UPT_SP(r) REGS_SP((r)->regs) + +#define UPT_EFLAGS(r) REGS_EFLAGS((r)->regs) +#define UPT_SYSCALL_NR(r) ((r)->syscall) #define UPT_SYSCALL_RET(r) UPT_RAX(r) extern int user_context(unsigned long sp); -#define UPT_IS_USER(r) ((r)->skas.is_user) +#define UPT_IS_USER(r) ((r)->is_user) #define UPT_SYSCALL_ARG1(r) UPT_RDI(r) #define UPT_SYSCALL_ARG2(r) UPT_RSI(r) @@ -232,12 +226,12 @@ struct syscall_args { }) #define UPT_SET_SYSCALL_RETURN(r, res) \ - REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)) + REGS_SET_SYSCALL_RETURN((r)->regs, (res)) -#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->skas.regs) +#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->regs) #define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas) -#define UPT_FAULTINFO(r) (&(r)->skas.faultinfo) +#define UPT_FAULTINFO(r) (&(r)->faultinfo) #endif diff --git a/arch/um/include/task.h b/arch/um/include/task.h index 6375ba7203c..3fe726b3cf4 100644 --- a/arch/um/include/task.h +++ b/arch/um/include/task.h @@ -3,7 +3,7 @@ #include -#define TASK_REGS(task) ((union uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) +#define TASK_REGS(task) ((struct uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) #define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID])) #endif -- cgit v1.2.3