2 * Licensed under the GPL
5 #ifndef __SYS_PTRACE_PPC_H
6 #define __SYS_PTRACE_PPC_H
8 #include "linux/config.h"
9 #include "linux/types.h"
11 /* the following taken from <asm-ppc/ptrace.h> */
14 #define PPC_REG unsigned long /*long*/
16 #define PPC_REG unsigned long
18 struct sys_pt_regs_s
{
22 PPC_REG orig_gpr3
; /* Used for restarting system calls */
27 PPC_REG mq
; /* 601 only (not used at present) */
28 /* Used on APUS to hold IPL value. */
29 PPC_REG trap
; /* Reason for being here */
30 PPC_REG dar
; /* Fault registers */
32 PPC_REG result
; /* Result of a system call */
35 #define NUM_REGS (sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG))
38 PPC_REG regs
[sizeof(struct sys_pt_regs_s
) / sizeof(PPC_REG
)];
41 #define UM_MAX_REG (PT_FPR0)
42 #define UM_MAX_REG_OFFSET (UM_MAX_REG * sizeof(PPC_REG))
44 #define EMPTY_REGS { { [ 0 ... NUM_REGS - 1] = 0 } }
46 #define UM_REG(r, n) ((r)->regs[n])
48 #define UM_SYSCALL_RET(r) UM_REG(r, PT_R3)
49 #define UM_SP(r) UM_REG(r, PT_R1)
50 #define UM_IP(r) UM_REG(r, PT_NIP)
51 #define UM_ELF_ZERO(r) UM_REG(r, PT_FPSCR)
52 #define UM_SYSCALL_NR(r) UM_REG(r, PT_R0)
53 #define UM_SYSCALL_ARG1(r) UM_REG(r, PT_ORIG_R3)
54 #define UM_SYSCALL_ARG2(r) UM_REG(r, PT_R4)
55 #define UM_SYSCALL_ARG3(r) UM_REG(r, PT_R5)
56 #define UM_SYSCALL_ARG4(r) UM_REG(r, PT_R6)
57 #define UM_SYSCALL_ARG5(r) UM_REG(r, PT_R7)
58 #define UM_SYSCALL_ARG6(r) UM_REG(r, PT_R8)
60 #define UM_SYSCALL_NR_OFFSET (PT_R0 * sizeof(PPC_REG))
61 #define UM_SYSCALL_RET_OFFSET (PT_R3 * sizeof(PPC_REG))
62 #define UM_SYSCALL_ARG1_OFFSET (PT_R3 * sizeof(PPC_REG))
63 #define UM_SYSCALL_ARG2_OFFSET (PT_R4 * sizeof(PPC_REG))
64 #define UM_SYSCALL_ARG3_OFFSET (PT_R5 * sizeof(PPC_REG))
65 #define UM_SYSCALL_ARG4_OFFSET (PT_R6 * sizeof(PPC_REG))
66 #define UM_SYSCALL_ARG5_OFFSET (PT_R7 * sizeof(PPC_REG))
67 #define UM_SYSCALL_ARG6_OFFSET (PT_R8 * sizeof(PPC_REG))
68 #define UM_SP_OFFSET (PT_R1 * sizeof(PPC_REG))
69 #define UM_IP_OFFSET (PT_NIP * sizeof(PPC_REG))
70 #define UM_ELF_ZERO_OFFSET (PT_R3 * sizeof(PPC_REG))
72 #define UM_SET_SYSCALL_RETURN(_regs, result) \
75 (_regs)->regs[PT_CCR] |= 0x10000000; \
76 UM_SYSCALL_RET((_regs)) = -result; \
78 UM_SYSCALL_RET((_regs)) = result; \
82 extern void shove_aux_table(unsigned long sp
);
83 #define UM_FIX_EXEC_STACK(sp) shove_aux_table(sp);
85 /* These aren't actually defined. The undefs are just to make sure
86 * everyone's clear on the concept.
88 #undef UML_HAVE_GETREGS
89 #undef UML_HAVE_GETFPREGS
90 #undef UML_HAVE_SETREGS
91 #undef UML_HAVE_SETFPREGS
96 * Overrides for Emacs so that we follow Linus's tabbing style.
97 * Emacs will notice this stuff at the end of the file and automatically
98 * adjust the settings for this buffer only. This must remain at the end
100 * ---------------------------------------------------------------------------
102 * c-file-style: "linux"