um: merge arch/um/os-Linux/sys-{i386,x86_64}

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Al Viro 2011-08-18 20:03:49 +01:00 committed by Richard Weinberger
parent 7eb122555c
commit 51d3474905
9 changed files with 57 additions and 85 deletions

View File

@ -5,7 +5,7 @@
obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
registers.o sigio.o signal.o start_up.o time.o tty.o \
umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/
umid.o tls.o user_syms.o util.o drivers/ sys-$(HEADER_ARCH)/ skas/
obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o

View File

@ -3,7 +3,10 @@
# Licensed under the GPL
#
obj-y = registers.o task_size.o tls.o
obj-y = registers.o task_size.o
obj-$(CONFIG_X86_32) += tls.o
obj-$(CONFIG_64BIT) += prctl.o
USER_OBJS := $(obj-y)

View File

@ -24,6 +24,8 @@ int restore_fp_registers(int pid, unsigned long *fp_regs)
return 0;
}
#ifdef __i386__
int have_fpx_regs = 1;
int save_fpx_registers(int pid, unsigned long *fp_regs)
{
if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0)
@ -38,24 +40,6 @@ int restore_fpx_registers(int pid, unsigned long *fp_regs)
return 0;
}
unsigned long get_thread_reg(int reg, jmp_buf *buf)
{
switch (reg) {
case EIP:
return buf[0]->__eip;
case UESP:
return buf[0]->__esp;
case EBP:
return buf[0]->__ebp;
default:
printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
reg);
return 0;
}
}
int have_fpx_regs = 1;
int get_fp_registers(int pid, unsigned long *regs)
{
if (have_fpx_regs)
@ -87,3 +71,41 @@ void arch_init_registers(int pid)
have_fpx_regs = 0;
}
#else
int get_fp_registers(int pid, unsigned long *regs)
{
return save_fp_registers(pid, regs);
}
int put_fp_registers(int pid, unsigned long *regs)
{
return restore_fp_registers(pid, regs);
}
#endif
unsigned long get_thread_reg(int reg, jmp_buf *buf)
{
switch (reg) {
#ifdef __i386__
case EIP:
return buf[0]->__eip;
case UESP:
return buf[0]->__esp;
case EBP:
return buf[0]->__ebp;
#else
case RIP:
return buf[0]->__rip;
case RSP:
return buf[0]->__rsp;
case RBP:
return buf[0]->__rbp;
#endif
default:
printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
reg);
return 0;
}
}

View File

@ -4,6 +4,8 @@
#include <sys/mman.h>
#include "longjmp.h"
#ifdef __i386__
static jmp_buf buf;
static void segfault(int sig)
@ -136,3 +138,13 @@ unsigned long os_get_top_address(void)
return top;
}
#else
unsigned long os_get_top_address(void)
{
/* The old value of CONFIG_TOP_ADDR */
return 0x7fc0000000;
}
#endif

View File

@ -1,10 +0,0 @@
#
# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
# Licensed under the GPL
#
obj-y = registers.o prctl.o task_size.o
USER_OBJS := $(obj-y)
include arch/um/scripts/Makefile.rules

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2006 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#include <errno.h>
#include <sys/ptrace.h>
#define __FRAME_OFFSETS
#include <asm/ptrace.h>
#include "longjmp.h"
int save_fp_registers(int pid, unsigned long *fp_regs)
{
if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
return -errno;
return 0;
}
int restore_fp_registers(int pid, unsigned long *fp_regs)
{
if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
return -errno;
return 0;
}
unsigned long get_thread_reg(int reg, jmp_buf *buf)
{
switch (reg) {
case RIP:
return buf[0]->__rip;
case RSP:
return buf[0]->__rsp;
case RBP:
return buf[0]->__rbp;
default:
printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
reg);
return 0;
}
}
int get_fp_registers(int pid, unsigned long *regs)
{
return save_fp_registers(pid, regs);
}
int put_fp_registers(int pid, unsigned long *regs)
{
return restore_fp_registers(pid, regs);
}

View File

@ -1,5 +0,0 @@
unsigned long os_get_top_address(unsigned long shift)
{
/* The old value of CONFIG_TOP_ADDR */
return 0x7fc0000000;
}