um: remove auxiliary FP registers
PATCH 1/1 um: remove auxiliary FP registers
From: Benjamin Berg <[email protected]>
We do not need the extra save/restore of the FP registers when getting the fault information. This was originally added in commit 2f56debd77a8 ("uml: fix FP register corruption") but at that time the code was not saving/restoring the FP registers when switching to userspace. This was fixed in commit fbfe9c847edf ("um: Save FPU registers between task switches") and since then the auxiliary registers have not been useful.
Signed-off-by Benjamin Berg <[email protected]>
--- arch/um/include/asm/thread_info.h | 2 -- arch/um/include/shared/os.h | 2 +- arch/um/kernel/process.c | 4 ++-- arch/um/os-Linux/skas/process.c | 25 ++++++------------------- 4 files changed, 9 insertions(+), 24 deletions(-)
arch/um/include/asm/thread_info.h +0 -2
@@ -23,8 +23,6 @@ struct thread_info {int preempt_count;/* 0 => preemptable, <0 => BUG */ struct thread_info *real_thread;/* Points to non-IRQ stack */ -unsigned long aux_fp_regs[FP_SIZE ];/* auxiliary fp_regs to save/restore -them out-of-band */ };#define INIT_THREAD_INFO (tsk) \
arch/um/include/shared/os.h +1 -1
@@ -285,7 +285,7 @@ int protect(struct mm_id *mm_idp, unsigned long addr,/* skas/process.c */ extern int is_skas_winch (int pid,int fd,void *data);extern int start_userspace (unsigned long stub_stack); -extern void userspace (struct uml_pt_regs *regs,unsigned long *aux_fp_regs); +extern void userspace (struct uml_pt_regs *regs);extern void new_thread (void *stack,jmp_buf *buf,void (*handler)(void ));extern void switch_threads (jmp_buf *me,jmp_buf *you);extern int start_idle_thread (void *stack,jmp_buf *switch_buf);
arch/um/kernel/process.c +2 -2
@@ -116,7 +116,7 @@ void new_thread_handler(void)* callback returns only if the kernel thread execs a process */ fn (arg); -userspace (¤t->thread.regs.regs,current_thread_info ()->aux_fp_regs); +userspace (¤t->thread.regs.regs); }/* Called magically, see new_thread_handler above */
@@ -133,7 +133,7 @@ static void fork_handler(void) current->thread.prev_sched =NULL ; -userspace (¤t->thread.regs.regs,current_thread_info ()->aux_fp_regs); +userspace (¤t->thread.regs.regs); }int copy_thread (struct task_struct * p,const struct kernel_clone_args *args)
arch/um/os-Linux/skas/process.c +6 -19
@@ -144,16 +144,10 @@ void wait_stub_done(int pid)extern unsigned long current_stub_stack (void ); -static void get_skas_faultinfo (int pid,struct faultinfo *fi,unsigned long *aux_fp_regs) +static void get_skas_faultinfo (int pid,struct faultinfo *fi) {int err; - err =get_fp_registers (pid, aux_fp_regs); -if (err <0 ) { -printk (UM_KERN_ERR "save_fp_registers returned %d\n" , - err); -fatal_sigsegv (); - } err =ptrace (PTRACE_CONT , pid,0 ,SIGSEGV );if (err) { printk(UM_KERN_ERR "Failed to continue stub, pid = %d, "
@@ -167,18 +161,11 @@ static void get_skas_faultinfo(int pid, struct faultinfo *fi, unsigned long *aux* the stub stack page. We just have to copy it. */ memcpy (fi, (void *)current_stub_stack (),sizeof (*fi)); - - err =put_fp_registers (pid, aux_fp_regs); -if (err <0 ) { -printk (UM_KERN_ERR "put_fp_registers returned %d\n" , - err); -fatal_sigsegv (); - } } -static void handle_segv (int pid,struct uml_pt_regs *regs,unsigned long *aux_fp_regs) +static void handle_segv (int pid,struct uml_pt_regs *regs) { -get_skas_faultinfo (pid, ®s->faultinfo, aux_fp_regs); +get_skas_faultinfo (pid, ®s->faultinfo);segv (regs->faultinfo,0 ,1 ,NULL ); }
@@ -408,7 +395,7 @@ int start_userspace(unsigned long stub_stack)int unscheduled_userspace_iterations;extern unsigned long tt_extra_sched_jiffies; -void userspace (struct uml_pt_regs *regs,unsigned long *aux_fp_regs) +void userspace (struct uml_pt_regs *regs) {int err, status, op, pid = userspace_pid[0 ];siginfo_t si;
@@ -527,11 +514,11 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs)case SIGSEGV :if (PTRACE_FULL_FAULTINFO ) {get_skas_faultinfo (pid, - ®s->faultinfo, aux_fp_regs); + ®s->faultinfo); (*sig_info[SIGSEGV ])(SIGSEGV , (struct siginfo *)&si, regs); } -else handle_segv (pid, regs, aux_fp_regs); +else handle_segv (pid, regs);break ;case SIGTRAP +0x80 :handle_trap (pid, regs);
Signature · 1 line
2.46.2