2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #ifndef __SYSDEP_I386_PTRACE_USER_H__
7 #define __SYSDEP_I386_PTRACE_USER_H__
9 #include <sys/ptrace.h>
10 #include <linux/ptrace.h>
11 #include <asm/ptrace.h>
12 #include "user_constants.h"
14 #define PT_OFFSET(r) ((r) * sizeof(long))
16 #define PT_SYSCALL_NR(regs) ((regs)[ORIG_EAX])
17 #define PT_SYSCALL_NR_OFFSET PT_OFFSET(ORIG_EAX)
19 #define PT_SYSCALL_ARG1_OFFSET PT_OFFSET(EBX)
20 #define PT_SYSCALL_ARG2_OFFSET PT_OFFSET(ECX)
21 #define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX)
22 #define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI)
23 #define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI)
24 #define PT_SYSCALL_ARG6_OFFSET PT_OFFSET(EBP)
26 #define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX)
28 #define REGS_SYSCALL_NR EAX /* This is used before a system call */
29 #define REGS_SYSCALL_ARG1 EBX
30 #define REGS_SYSCALL_ARG2 ECX
31 #define REGS_SYSCALL_ARG3 EDX
32 #define REGS_SYSCALL_ARG4 ESI
33 #define REGS_SYSCALL_ARG5 EDI
34 #define REGS_SYSCALL_ARG6 EBP
36 #define REGS_IP_INDEX EIP
37 #define REGS_SP_INDEX UESP
39 #define PT_IP_OFFSET PT_OFFSET(EIP)
40 #define PT_IP(regs) ((regs)[EIP])
41 #define PT_SP_OFFSET PT_OFFSET(UESP)
42 #define PT_SP(regs) ((regs)[UESP])
44 #define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
47 #define FRAME_SIZE (17)