[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / um / os-Linux / sys-x86_64 / registers.c
blob6286c974bbeb0a44fc235aa3d47a88898bff37a0
1 /*
2 * Copyright (C) 2004 PathScale, Inc
3 * Licensed under the GPL
4 */
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"
14 /* These are set once at boot time and not changed thereafter */
16 static unsigned long exec_regs[HOST_FRAME_SIZE];
17 static unsigned long exec_fp_regs[HOST_FP_SIZE];
19 void init_thread_registers(union uml_pt_regs *to)
21 memcpy(to->skas.regs, exec_regs, sizeof(to->skas.regs));
22 memcpy(to->skas.fp, exec_fp_regs, sizeof(to->skas.fp));
25 static int move_registers(int pid, int int_op, int fp_op,
26 union uml_pt_regs *regs)
28 if(ptrace(int_op, pid, 0, regs->skas.regs) < 0)
29 return(-errno);
31 if(ptrace(fp_op, pid, 0, regs->skas.fp) < 0)
32 return(-errno);
34 return(0);
37 void save_registers(int pid, union uml_pt_regs *regs)
39 int err;
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);
47 void restore_registers(int pid, union uml_pt_regs *regs)
49 int err;
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);
57 void init_registers(int pid)
59 int err;
61 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
62 if(err)
63 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
64 err);
66 err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
67 if(err)
68 panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
69 err);
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: