2 * Copyright (C) 2004 PathScale, Inc
3 * Licensed under the GPL
8 #include "ptrace_user.h"
9 #include "uml-config.h"
10 #include "skas_ptregs.h"
11 #include "registers.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)
31 if(ptrace(fp_op
, pid
, 0, regs
->skas
.fp
) < 0)
37 void save_registers(int pid
, union uml_pt_regs
*regs
)
41 err
= move_registers(pid
, PTRACE_GETREGS
, PTRACE_GETFPREGS
, regs
);
43 panic("save_registers - saving registers failed, errno = %d\n",
47 void restore_registers(int pid
, union uml_pt_regs
*regs
)
51 err
= move_registers(pid
, PTRACE_SETREGS
, PTRACE_SETFPREGS
, regs
);
53 panic("restore_registers - saving registers failed, "
54 "errno = %d\n", -err
);
57 void init_registers(int pid
)
61 err
= ptrace(PTRACE_GETREGS
, pid
, 0, exec_regs
);
63 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
66 err
= ptrace(PTRACE_GETFPREGS
, pid
, 0, exec_fp_regs
);
68 panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
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
77 * ---------------------------------------------------------------------------
79 * c-file-style: "linux"