Path: blob/master/arch/powerpc/include/uapi/asm/ptrace.h
26516 views
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */1/*2* Copyright (C) 2001 PPC64 Team, IBM Corp3*4* This struct defines the way the registers are stored on the5* kernel stack during a system call or other kernel entry.6*7* this should only contain volatile regs8* since we can keep non-volatile in the thread_struct9* should set this up when only volatiles are saved10* by intr code.11*12* Since this is going on the stack, *CARE MUST BE TAKEN* to insure13* that the overall structure is a multiple of 16 bytes in length.14*15* Note that the offsets of the fields in this struct correspond with16* the PT_* values below. This simplifies arch/powerpc/kernel/ptrace.c.17*18* This program is free software; you can redistribute it and/or19* modify it under the terms of the GNU General Public License20* as published by the Free Software Foundation; either version21* 2 of the License, or (at your option) any later version.22*/23#ifndef _UAPI_ASM_POWERPC_PTRACE_H24#define _UAPI_ASM_POWERPC_PTRACE_H252627#include <linux/types.h>2829#ifndef __ASSEMBLY__3031#ifdef __KERNEL__32struct user_pt_regs33#else34struct pt_regs35#endif36{37unsigned long gpr[32];38unsigned long nip;39unsigned long msr;40unsigned long orig_gpr3; /* Used for restarting system calls */41unsigned long ctr;42unsigned long link;43unsigned long xer;44unsigned long ccr;45#ifdef __powerpc64__46unsigned long softe; /* Soft enabled/disabled */47#else48unsigned long mq; /* 601 only (not used at present) */49/* Used on APUS to hold IPL value. */50#endif51unsigned long trap; /* Reason for being here */52/* N.B. for critical exceptions on 4xx, the dar and dsisr53fields are overloaded to hold srr0 and srr1. */54unsigned long dar; /* Fault registers */55unsigned long dsisr; /* on 4xx/Book-E used for ESR */56unsigned long result; /* Result of a system call */57};5859#endif /* __ASSEMBLY__ */606162/*63* Offsets used by 'ptrace' system call interface.64* These can't be changed without breaking binary compatibility65* with MkLinux, etc.66*/67#define PT_R0 068#define PT_R1 169#define PT_R2 270#define PT_R3 371#define PT_R4 472#define PT_R5 573#define PT_R6 674#define PT_R7 775#define PT_R8 876#define PT_R9 977#define PT_R10 1078#define PT_R11 1179#define PT_R12 1280#define PT_R13 1381#define PT_R14 1482#define PT_R15 1583#define PT_R16 1684#define PT_R17 1785#define PT_R18 1886#define PT_R19 1987#define PT_R20 2088#define PT_R21 2189#define PT_R22 2290#define PT_R23 2391#define PT_R24 2492#define PT_R25 2593#define PT_R26 2694#define PT_R27 2795#define PT_R28 2896#define PT_R29 2997#define PT_R30 3098#define PT_R31 3199100#define PT_NIP 32101#define PT_MSR 33102#define PT_ORIG_R3 34103#define PT_CTR 35104#define PT_LNK 36105#define PT_XER 37106#define PT_CCR 38107#ifndef __powerpc64__108#define PT_MQ 39109#else110#define PT_SOFTE 39111#endif112#define PT_TRAP 40113#define PT_DAR 41114#define PT_DSISR 42115#define PT_RESULT 43116#define PT_DSCR 44117#define PT_REGS_COUNT 44118119#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */120121#ifndef __powerpc64__122123#define PT_FPR31 (PT_FPR0 + 2*31)124#define PT_FPSCR (PT_FPR0 + 2*32 + 1)125126#else /* __powerpc64__ */127128#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */129130131#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */132#define PT_VSCR (PT_VR0 + 32*2 + 1)133#define PT_VRSAVE (PT_VR0 + 33*2)134135136/*137* Only store first 32 VSRs here. The second 32 VSRs in VR0-31138*/139#define PT_VSR0 150 /* each VSR reg occupies 2 slots in 64-bit */140#define PT_VSR31 (PT_VSR0 + 2*31)141#endif /* __powerpc64__ */142143/*144* Get/set all the altivec registers v0..v31, vscr, vrsave, in one go.145* The transfer totals 34 quadword. Quadwords 0-31 contain the146* corresponding vector registers. Quadword 32 contains the vscr as the147* last word (offset 12) within that quadword. Quadword 33 contains the148* vrsave as the first word (offset 0) within the quadword.149*150* This definition of the VMX state is compatible with the current PPC32151* ptrace interface. This allows signal handling and ptrace to use the same152* structures. This also simplifies the implementation of a bi-arch153* (combined (32- and 64-bit) gdb.154*/155#define PTRACE_GETVRREGS 0x12156#define PTRACE_SETVRREGS 0x13157158/* Get/set all the upper 32-bits of the SPE registers, accumulator, and159* spefscr, in one go */160#define PTRACE_GETEVRREGS 0x14161#define PTRACE_SETEVRREGS 0x15162163/* Get the first 32 128bit VSX registers */164#define PTRACE_GETVSRREGS 0x1b165#define PTRACE_SETVSRREGS 0x1c166167/* Syscall emulation defines */168#define PTRACE_SYSEMU 0x1d169#define PTRACE_SYSEMU_SINGLESTEP 0x1e170171/*172* Get or set a debug register. The first 16 are DABR registers and the173* second 16 are IABR registers.174*/175#define PTRACE_GET_DEBUGREG 0x19176#define PTRACE_SET_DEBUGREG 0x1a177178/* (new) PTRACE requests using the same numbers as x86 and the same179* argument ordering. Additionally, they support more registers too180*/181#define PTRACE_GETREGS 0xc182#define PTRACE_SETREGS 0xd183#define PTRACE_GETFPREGS 0xe184#define PTRACE_SETFPREGS 0xf185#define PTRACE_GETREGS64 0x16186#define PTRACE_SETREGS64 0x17187188/* Calls to trace a 64bit program from a 32bit program */189#define PPC_PTRACE_PEEKTEXT_3264 0x95190#define PPC_PTRACE_PEEKDATA_3264 0x94191#define PPC_PTRACE_POKETEXT_3264 0x93192#define PPC_PTRACE_POKEDATA_3264 0x92193#define PPC_PTRACE_PEEKUSR_3264 0x91194#define PPC_PTRACE_POKEUSR_3264 0x90195196#define PTRACE_SINGLEBLOCK 0x100 /* resume execution until next branch */197198#define PPC_PTRACE_GETHWDBGINFO 0x89199#define PPC_PTRACE_SETHWDEBUG 0x88200#define PPC_PTRACE_DELHWDEBUG 0x87201202#ifndef __ASSEMBLY__203204struct ppc_debug_info {205__u32 version; /* Only version 1 exists to date */206__u32 num_instruction_bps;207__u32 num_data_bps;208__u32 num_condition_regs;209__u32 data_bp_alignment;210__u32 sizeof_condition; /* size of the DVC register */211__u64 features;212};213214#endif /* __ASSEMBLY__ */215216/*217* features will have bits indication whether there is support for:218*/219#define PPC_DEBUG_FEATURE_INSN_BP_RANGE 0x0000000000000001220#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x0000000000000002221#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x0000000000000004222#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x0000000000000008223#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x0000000000000010224#define PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 0x0000000000000020225226#ifndef __ASSEMBLY__227228struct ppc_hw_breakpoint {229__u32 version; /* currently, version must be 1 */230__u32 trigger_type; /* only some combinations allowed */231__u32 addr_mode; /* address match mode */232__u32 condition_mode; /* break/watchpoint condition flags */233__u64 addr; /* break/watchpoint address */234__u64 addr2; /* range end or mask */235__u64 condition_value; /* contents of the DVC register */236};237238#endif /* __ASSEMBLY__ */239240/*241* Trigger Type242*/243#define PPC_BREAKPOINT_TRIGGER_EXECUTE 0x00000001244#define PPC_BREAKPOINT_TRIGGER_READ 0x00000002245#define PPC_BREAKPOINT_TRIGGER_WRITE 0x00000004246#define PPC_BREAKPOINT_TRIGGER_RW \247(PPC_BREAKPOINT_TRIGGER_READ | PPC_BREAKPOINT_TRIGGER_WRITE)248249/*250* Address Mode251*/252#define PPC_BREAKPOINT_MODE_EXACT 0x00000000253#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE 0x00000001254#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE 0x00000002255#define PPC_BREAKPOINT_MODE_MASK 0x00000003256257/*258* Condition Mode259*/260#define PPC_BREAKPOINT_CONDITION_MODE 0x00000003261#define PPC_BREAKPOINT_CONDITION_NONE 0x00000000262#define PPC_BREAKPOINT_CONDITION_AND 0x00000001263#define PPC_BREAKPOINT_CONDITION_EXACT PPC_BREAKPOINT_CONDITION_AND264#define PPC_BREAKPOINT_CONDITION_OR 0x00000002265#define PPC_BREAKPOINT_CONDITION_AND_OR 0x00000003266#define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000267#define PPC_BREAKPOINT_CONDITION_BE_SHIFT 16268#define PPC_BREAKPOINT_CONDITION_BE(n) \269(1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))270271#endif /* _UAPI_ASM_POWERPC_PTRACE_H */272273274