diff options
Diffstat (limited to 'arch/um/os-Linux/sys-x86_64')
| -rw-r--r-- | arch/um/os-Linux/sys-x86_64/Makefile | 10 | ||||
| -rw-r--r-- | arch/um/os-Linux/sys-x86_64/prctl.c | 12 | ||||
| -rw-r--r-- | arch/um/os-Linux/sys-x86_64/registers.c | 52 | ||||
| -rw-r--r-- | arch/um/os-Linux/sys-x86_64/signal.c | 16 | ||||
| -rw-r--r-- | arch/um/os-Linux/sys-x86_64/task_size.c | 5 |
5 files changed, 95 insertions, 0 deletions
diff --git a/arch/um/os-Linux/sys-x86_64/Makefile b/arch/um/os-Linux/sys-x86_64/Makefile new file mode 100644 index 00000000000..a44a47f8f57 --- /dev/null +++ b/arch/um/os-Linux/sys-x86_64/Makefile | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # | ||
| 2 | # Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
| 3 | # Licensed under the GPL | ||
| 4 | # | ||
| 5 | |||
| 6 | obj-y = registers.o prctl.o signal.o task_size.o | ||
| 7 | |||
| 8 | USER_OBJS := $(obj-y) | ||
| 9 | |||
| 10 | include arch/um/scripts/Makefile.rules | ||
diff --git a/arch/um/os-Linux/sys-x86_64/prctl.c b/arch/um/os-Linux/sys-x86_64/prctl.c new file mode 100644 index 00000000000..9d34eddb517 --- /dev/null +++ b/arch/um/os-Linux/sys-x86_64/prctl.c | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit.com,linux.intel.com}) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <sys/ptrace.h> | ||
| 7 | #include <linux/ptrace.h> | ||
| 8 | |||
| 9 | int os_arch_prctl(int pid, int code, unsigned long *addr) | ||
| 10 | { | ||
| 11 | return ptrace(PTRACE_ARCH_PRCTL, pid, (unsigned long) addr, code); | ||
| 12 | } | ||
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c new file mode 100644 index 00000000000..594d97ad02b --- /dev/null +++ b/arch/um/os-Linux/sys-x86_64/registers.c | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2006 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <errno.h> | ||
| 7 | #include <sys/ptrace.h> | ||
| 8 | #define __FRAME_OFFSETS | ||
| 9 | #include <asm/ptrace.h> | ||
| 10 | #include "kern_constants.h" | ||
| 11 | #include "longjmp.h" | ||
| 12 | #include "user.h" | ||
| 13 | |||
| 14 | int save_fp_registers(int pid, unsigned long *fp_regs) | ||
| 15 | { | ||
| 16 | if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) | ||
| 17 | return -errno; | ||
| 18 | return 0; | ||
| 19 | } | ||
| 20 | |||
| 21 | int restore_fp_registers(int pid, unsigned long *fp_regs) | ||
| 22 | { | ||
| 23 | if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) | ||
| 24 | return -errno; | ||
| 25 | return 0; | ||
| 26 | } | ||
| 27 | |||
| 28 | unsigned long get_thread_reg(int reg, jmp_buf *buf) | ||
| 29 | { | ||
| 30 | switch (reg) { | ||
| 31 | case RIP: | ||
| 32 | return buf[0]->__rip; | ||
| 33 | case RSP: | ||
| 34 | return buf[0]->__rsp; | ||
| 35 | case RBP: | ||
| 36 | return buf[0]->__rbp; | ||
| 37 | default: | ||
| 38 | printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n", | ||
| 39 | reg); | ||
| 40 | return 0; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | int get_fp_registers(int pid, unsigned long *regs) | ||
| 45 | { | ||
| 46 | return save_fp_registers(pid, regs); | ||
| 47 | } | ||
| 48 | |||
| 49 | int put_fp_registers(int pid, unsigned long *regs) | ||
| 50 | { | ||
| 51 | return restore_fp_registers(pid, regs); | ||
| 52 | } | ||
diff --git a/arch/um/os-Linux/sys-x86_64/signal.c b/arch/um/os-Linux/sys-x86_64/signal.c new file mode 100644 index 00000000000..82a388822cd --- /dev/null +++ b/arch/um/os-Linux/sys-x86_64/signal.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <signal.h> | ||
| 7 | |||
| 8 | extern void handle_signal(int sig, struct sigcontext *sc); | ||
| 9 | |||
| 10 | void hard_handler(int sig) | ||
| 11 | { | ||
| 12 | struct ucontext *uc; | ||
| 13 | asm("movq %%rdx, %0" : "=r" (uc)); | ||
| 14 | |||
| 15 | handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext); | ||
| 16 | } | ||
diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c b/arch/um/os-Linux/sys-x86_64/task_size.c new file mode 100644 index 00000000000..26a0dd1f349 --- /dev/null +++ b/arch/um/os-Linux/sys-x86_64/task_size.c | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | unsigned long os_get_top_address(unsigned long shift) | ||
| 2 | { | ||
| 3 | /* The old value of CONFIG_TOP_ADDR */ | ||
| 4 | return 0x7fc0000000; | ||
| 5 | } | ||
