Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263815
b: refs/heads/master
c: fbfe9c8
h: refs/heads/master
i:
  263813: 9920dff
  263811: 09a5ebd
  263807: 8031f3f
v: v3
  • Loading branch information
Ingo van Lil authored and Linus Torvalds committed Sep 15, 2011
1 parent 190e690 commit 0942c89
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b40997b872cdb70140f127af6069f00a86b6cf81
refs/heads/master: fbfe9c847edf57ac8232aeafb290f272289893a3
2 changes: 1 addition & 1 deletion trunk/arch/um/include/shared/registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern int restore_fpx_registers(int pid, unsigned long *fp_regs);
extern int save_registers(int pid, struct uml_pt_regs *regs);
extern int restore_registers(int pid, struct uml_pt_regs *regs);
extern int init_registers(int pid);
extern void get_safe_registers(unsigned long *regs);
extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs);
extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
extern int get_fp_registers(int pid, unsigned long *regs);
extern int put_fp_registers(int pid, unsigned long *regs);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/um/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
arch_copy_thread(&current->thread.arch, &p->thread.arch);
}
else {
get_safe_registers(p->thread.regs.regs.gp);
get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp);
p->thread.request.u.thread = current->thread.request.u.thread;
handler = new_thread_handler;
}
Expand Down
9 changes: 8 additions & 1 deletion trunk/arch/um/os-Linux/registers.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <string.h>
#include <sys/ptrace.h>
#include "sysdep/ptrace.h"
#include "sysdep/ptrace_user.h"
#include "registers.h"

int save_registers(int pid, struct uml_pt_regs *regs)
{
Expand All @@ -32,6 +34,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs)
/* This is set once at boot time and not changed thereafter */

static unsigned long exec_regs[MAX_REG_NR];
static unsigned long exec_fp_regs[FP_SIZE];

int init_registers(int pid)
{
Expand All @@ -42,10 +45,14 @@ int init_registers(int pid)
return -errno;

arch_init_registers(pid);
get_fp_registers(pid, exec_fp_regs);
return 0;
}

void get_safe_registers(unsigned long *regs)
void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
{
memcpy(regs, exec_regs, sizeof(exec_regs));

if (fp_regs)
memcpy(fp_regs, exec_fp_regs, sizeof(exec_fp_regs));
}
2 changes: 1 addition & 1 deletion trunk/arch/um/os-Linux/skas/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static unsigned long syscall_regs[MAX_REG_NR];

static int __init init_syscall_regs(void)
{
get_safe_registers(syscall_regs);
get_safe_registers(syscall_regs, NULL);
syscall_regs[REGS_IP_INDEX] = STUB_CODE +
((unsigned long) &batch_syscall_stub -
(unsigned long) &__syscall_stub_start);
Expand Down
19 changes: 18 additions & 1 deletion trunk/arch/um/os-Linux/skas/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ void userspace(struct uml_pt_regs *regs)
if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
fatal_sigsegv();

if (put_fp_registers(pid, regs->fp))
fatal_sigsegv();

/* Now we set local_using_sysemu to be used for one loop */
local_using_sysemu = get_using_sysemu();

Expand All @@ -399,6 +402,12 @@ void userspace(struct uml_pt_regs *regs)
fatal_sigsegv();
}

if (get_fp_registers(pid, regs->fp)) {
printk(UM_KERN_ERR "userspace - get_fp_registers failed, "
"errno = %d\n", errno);
fatal_sigsegv();
}

UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */

if (WIFSTOPPED(status)) {
Expand Down Expand Up @@ -457,10 +466,11 @@ void userspace(struct uml_pt_regs *regs)
}

static unsigned long thread_regs[MAX_REG_NR];
static unsigned long thread_fp_regs[FP_SIZE];

static int __init init_thread_regs(void)
{
get_safe_registers(thread_regs);
get_safe_registers(thread_regs, thread_fp_regs);
/* Set parent's instruction pointer to start of clone-stub */
thread_regs[REGS_IP_INDEX] = STUB_CODE +
(unsigned long) stub_clone_handler -
Expand Down Expand Up @@ -503,6 +513,13 @@ int copy_context_skas0(unsigned long new_stack, int pid)
return err;
}

err = put_fp_registers(pid, thread_fp_regs);
if (err < 0) {
printk(UM_KERN_ERR "copy_context_skas0 : put_fp_registers "
"failed, pid = %d, err = %d\n", pid, err);
return err;
}

/* set a well known return code for detection of child write failure */
child_data->err = 12345678;

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/sys-i386/shared/sysdep/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ extern int sysemu_supported;

struct uml_pt_regs {
unsigned long gp[MAX_REG_NR];
unsigned long fp[HOST_FPX_SIZE];
struct faultinfo faultinfo;
long syscall;
int is_user;
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/um/sys-x86_64/shared/sysdep/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

struct uml_pt_regs {
unsigned long gp[MAX_REG_NR];
unsigned long fp[HOST_FP_SIZE];
struct faultinfo faultinfo;
long syscall;
int is_user;
Expand Down

0 comments on commit 0942c89

Please sign in to comment.