15c48b108SAl Viro /* 25c48b108SAl Viro * Copyright 2003 PathScale, Inc. 35c48b108SAl Viro * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 45c48b108SAl Viro * 55c48b108SAl Viro * Licensed under the GPL 65c48b108SAl Viro */ 75c48b108SAl Viro 85c48b108SAl Viro #ifndef __SYSDEP_X86_64_PTRACE_H 95c48b108SAl Viro #define __SYSDEP_X86_64_PTRACE_H 105c48b108SAl Viro 11243412beSAl Viro #define MAX_FP_NR HOST_FP_SIZE 125c48b108SAl Viro 135c48b108SAl Viro #define REGS_R8(r) ((r)[HOST_R8]) 145c48b108SAl Viro #define REGS_R9(r) ((r)[HOST_R9]) 155c48b108SAl Viro #define REGS_R10(r) ((r)[HOST_R10]) 165c48b108SAl Viro #define REGS_R11(r) ((r)[HOST_R11]) 175c48b108SAl Viro #define REGS_R12(r) ((r)[HOST_R12]) 185c48b108SAl Viro #define REGS_R13(r) ((r)[HOST_R13]) 195c48b108SAl Viro #define REGS_R14(r) ((r)[HOST_R14]) 205c48b108SAl Viro #define REGS_R15(r) ((r)[HOST_R15]) 215c48b108SAl Viro 225c48b108SAl Viro #define HOST_FS_BASE 21 235c48b108SAl Viro #define HOST_GS_BASE 22 245c48b108SAl Viro #define HOST_DS 23 255c48b108SAl Viro #define HOST_ES 24 265c48b108SAl Viro #define HOST_FS 25 275c48b108SAl Viro #define HOST_GS 26 285c48b108SAl Viro 295c48b108SAl Viro /* Also defined in asm/ptrace-x86_64.h, but not in libc headers. So, these 305c48b108SAl Viro * are already defined for kernel code, but not for userspace code. 315c48b108SAl Viro */ 325c48b108SAl Viro #ifndef FS_BASE 335c48b108SAl Viro /* These aren't defined in ptrace.h, but exist in struct user_regs_struct, 345c48b108SAl Viro * which is what x86_64 ptrace actually uses. 355c48b108SAl Viro */ 365c48b108SAl Viro #define FS_BASE (HOST_FS_BASE * sizeof(long)) 375c48b108SAl Viro #define GS_BASE (HOST_GS_BASE * sizeof(long)) 385c48b108SAl Viro #define DS (HOST_DS * sizeof(long)) 395c48b108SAl Viro #define ES (HOST_ES * sizeof(long)) 405c48b108SAl Viro #define FS (HOST_FS * sizeof(long)) 415c48b108SAl Viro #define GS (HOST_GS * sizeof(long)) 425c48b108SAl Viro #endif 435c48b108SAl Viro 445c48b108SAl Viro #define UPT_R8(r) REGS_R8((r)->gp) 455c48b108SAl Viro #define UPT_R9(r) REGS_R9((r)->gp) 465c48b108SAl Viro #define UPT_R10(r) REGS_R10((r)->gp) 475c48b108SAl Viro #define UPT_R11(r) REGS_R11((r)->gp) 485c48b108SAl Viro #define UPT_R12(r) REGS_R12((r)->gp) 495c48b108SAl Viro #define UPT_R13(r) REGS_R13((r)->gp) 505c48b108SAl Viro #define UPT_R14(r) REGS_R14((r)->gp) 515c48b108SAl Viro #define UPT_R15(r) REGS_R15((r)->gp) 525c48b108SAl Viro 53243412beSAl Viro #define UPT_SYSCALL_ARG1(r) UPT_DI(r) 54243412beSAl Viro #define UPT_SYSCALL_ARG2(r) UPT_SI(r) 55243412beSAl Viro #define UPT_SYSCALL_ARG3(r) UPT_DX(r) 565c48b108SAl Viro #define UPT_SYSCALL_ARG4(r) UPT_R10(r) 575c48b108SAl Viro #define UPT_SYSCALL_ARG5(r) UPT_R8(r) 585c48b108SAl Viro #define UPT_SYSCALL_ARG6(r) UPT_R9(r) 595c48b108SAl Viro 60*a78ff111SEli Cooper extern void arch_init_registers(int pid); 615c48b108SAl Viro 625c48b108SAl Viro #endif 63