aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/sys-x86_64
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/os-Linux/sys-x86_64
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/os-Linux/sys-x86_64')
-rw-r--r--arch/um/os-Linux/sys-x86_64/Makefile10
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c81
2 files changed, 91 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 000000000000..340ef26f5944
--- /dev/null
+++ b/arch/um/os-Linux/sys-x86_64/Makefile
@@ -0,0 +1,10 @@
1#
2# Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3# Licensed under the GPL
4#
5
6obj-$(CONFIG_MODE_SKAS) = registers.o
7
8USER_OBJS := $(obj-y)
9
10include arch/um/scripts/Makefile.rules
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 000000000000..6286c974bbeb
--- /dev/null
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) 2004 PathScale, Inc
3 * Licensed under the GPL
4 */
5
6#include <errno.h>
7#include <string.h>
8#include "ptrace_user.h"
9#include "uml-config.h"
10#include "skas_ptregs.h"
11#include "registers.h"
12#include "user.h"
13
14/* These are set once at boot time and not changed thereafter */
15
16static unsigned long exec_regs[HOST_FRAME_SIZE];
17static unsigned long exec_fp_regs[HOST_FP_SIZE];
18
19void init_thread_registers(union uml_pt_regs *to)
20{
21 memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs));
22 memcpy(to->skas.fp, exec_fp_regs, sizeof(to->skas.fp));
23}
24
25static int move_registers(int pid, int int_op, int fp_op,
26 union uml_pt_regs *regs)
27{
28 if(ptrace(int_op, pid, 0, regs->skas.regs) < 0)
29 return(-errno);
30
31 if(ptrace(fp_op, pid, 0, regs->skas.fp) < 0)
32 return(-errno);
33
34 return(0);
35}
36
37void save_registers(int pid, union uml_pt_regs *regs)
38{
39 int err;
40
41 err = move_registers(pid, PTRACE_GETREGS, PTRACE_GETFPREGS, regs);
42 if(err)
43 panic("save_registers - saving registers failed, errno = %d\n",
44 -err);
45}
46
47void restore_registers(int pid, union uml_pt_regs *regs)
48{
49 int err;
50
51 err = move_registers(pid, PTRACE_SETREGS, PTRACE_SETFPREGS, regs);
52 if(err)
53 panic("restore_registers - saving registers failed, "
54 "errno = %d\n", -err);
55}
56
57void init_registers(int pid)
58{
59 int err;
60
61 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
62 if(err)
63 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
64 err);
65
66 err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
67 if(err)
68 panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
69 err);
70}
71
72/*
73 * Overrides for Emacs so that we follow Linus's tabbing style.
74 * Emacs will notice this stuff at the end of the file and automatically
75 * adjust the settings for this buffer only. This must remain at the end
76 * of the file.
77 * ---------------------------------------------------------------------------
78 * Local variables:
79 * c-file-style: "linux"
80 * End:
81 */