1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000 by Ralf Baechle 7 * 8 * Machine dependent structs and defines to help the user use 9 * the ptrace system call. 10 */ 11#ifndef _ASM_PTRACE_H 12#define _ASM_PTRACE_H 13 14#include <asm/isadep.h> 15 16/* 0 - 31 are integer registers, 32 - 63 are fp registers. */ 17#define FPR_BASE 32 18#define PC 64 19#define CAUSE 65 20#define BADVADDR 66 21#define MMHI 67 22#define MMLO 68 23#define FPC_CSR 69 24#define FPC_EIR 70 25 26#ifndef __ASSEMBLY__ 27/* 28 * This struct defines the way the registers are stored on the stack during a 29 * system call/exception. As usual the registers k0/k1 aren't being saved. 30 */ 31struct pt_regs { 32 /* Pad bytes for argument save space on the stack. */ 33 unsigned long pad0[6]; 34 35 /* Saved main processor registers. */ 36 unsigned long regs[32]; 37 38 /* Other saved registers. */ 39 unsigned long lo; 40 unsigned long hi; 41 42 /* 43 * saved cp0 registers 44 */ 45 unsigned long cp0_epc; 46 unsigned long cp0_badvaddr; 47 unsigned long cp0_status; 48 unsigned long cp0_cause; 49}; 50 51#define __str2(x) #x 52#define __str(x) __str2(x) 53 54#define save_static_function(symbol) \ 55__asm__ ( \ 56 ".globl\t" #symbol "\n\t" \ 57 ".align\t2\n\t" \ 58 ".type\t" #symbol ", @function\n\t" \ 59 ".ent\t" #symbol ", 0\n" \ 60 #symbol":\n\t" \ 61 ".frame\t$29, 0, $31\n\t" \ 62 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \ 63 "sw\t$17,"__str(PT_R17)"($29)\n\t" \ 64 "sw\t$18,"__str(PT_R18)"($29)\n\t" \ 65 "sw\t$19,"__str(PT_R19)"($29)\n\t" \ 66 "sw\t$20,"__str(PT_R20)"($29)\n\t" \ 67 "sw\t$21,"__str(PT_R21)"($29)\n\t" \ 68 "sw\t$22,"__str(PT_R22)"($29)\n\t" \ 69 "sw\t$23,"__str(PT_R23)"($29)\n\t" \ 70 "sw\t$30,"__str(PT_R30)"($29)\n\t" \ 71 ".end\t" #symbol "\n\t" \ 72 ".size\t" #symbol",. - " #symbol) 73 74/* Used in declaration of save_static functions. */ 75#define static_unused static __attribute__((unused)) 76 77#endif /* !__ASSEMBLY__ */ 78 79/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ 80/* #define PTRACE_GETREGS 12 */ 81/* #define PTRACE_SETREGS 13 */ 82/* #define PTRACE_GETFPREGS 14 */ 83/* #define PTRACE_SETFPREGS 15 */ 84/* #define PTRACE_GETFPXREGS 18 */ 85/* #define PTRACE_SETFPXREGS 19 */ 86 87#define PTRACE_SETOPTIONS 21 88 89/* options set using PTRACE_SETOPTIONS */ 90#define PTRACE_O_TRACESYSGOOD 0x00000001 91 92#ifdef __ASSEMBLY__ 93#include <asm/offset.h> 94#endif 95 96#ifdef __KERNEL__ 97 98#ifndef __ASSEMBLY__ 99/* 100 * Does the process account for user or for system time? 101 */ 102#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER) 103 104#define instruction_pointer(regs) ((regs)->cp0_epc) 105 106extern void show_regs(struct pt_regs *); 107#endif /* !__ASSEMBLY__ */ 108 109#endif 110 111#endif /* _ASM_PTRACE_H */ 112