18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/include/asm/ptrace.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 1996-2003 Russell King 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 88c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License version 2 as 98c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci#ifndef _UAPI__ASM_ARM_PTRACE_H 128c2ecf20Sopenharmony_ci#define _UAPI__ASM_ARM_PTRACE_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <asm/hwcap.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define PTRACE_GETREGS 12 178c2ecf20Sopenharmony_ci#define PTRACE_SETREGS 13 188c2ecf20Sopenharmony_ci#define PTRACE_GETFPREGS 14 198c2ecf20Sopenharmony_ci#define PTRACE_SETFPREGS 15 208c2ecf20Sopenharmony_ci/* PTRACE_ATTACH is 16 */ 218c2ecf20Sopenharmony_ci/* PTRACE_DETACH is 17 */ 228c2ecf20Sopenharmony_ci#define PTRACE_GETWMMXREGS 18 238c2ecf20Sopenharmony_ci#define PTRACE_SETWMMXREGS 19 248c2ecf20Sopenharmony_ci/* 20 is unused */ 258c2ecf20Sopenharmony_ci#define PTRACE_OLDSETOPTIONS 21 268c2ecf20Sopenharmony_ci#define PTRACE_GET_THREAD_AREA 22 278c2ecf20Sopenharmony_ci#define PTRACE_SET_SYSCALL 23 288c2ecf20Sopenharmony_ci/* PTRACE_SYSCALL is 24 */ 298c2ecf20Sopenharmony_ci#define PTRACE_GETCRUNCHREGS 25 308c2ecf20Sopenharmony_ci#define PTRACE_SETCRUNCHREGS 26 318c2ecf20Sopenharmony_ci#define PTRACE_GETVFPREGS 27 328c2ecf20Sopenharmony_ci#define PTRACE_SETVFPREGS 28 338c2ecf20Sopenharmony_ci#define PTRACE_GETHBPREGS 29 348c2ecf20Sopenharmony_ci#define PTRACE_SETHBPREGS 30 358c2ecf20Sopenharmony_ci#define PTRACE_GETFDPIC 31 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define PTRACE_GETFDPIC_EXEC 0 388c2ecf20Sopenharmony_ci#define PTRACE_GETFDPIC_INTERP 1 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/* 418c2ecf20Sopenharmony_ci * PSR bits 428c2ecf20Sopenharmony_ci * Note on V7M there is no mode contained in the PSR 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci#define USR26_MODE 0x00000000 458c2ecf20Sopenharmony_ci#define FIQ26_MODE 0x00000001 468c2ecf20Sopenharmony_ci#define IRQ26_MODE 0x00000002 478c2ecf20Sopenharmony_ci#define SVC26_MODE 0x00000003 488c2ecf20Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_CPU_V7M) 498c2ecf20Sopenharmony_ci/* 508c2ecf20Sopenharmony_ci * Use 0 here to get code right that creates a userspace 518c2ecf20Sopenharmony_ci * or kernel space thread. 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci#define USR_MODE 0x00000000 548c2ecf20Sopenharmony_ci#define SVC_MODE 0x00000000 558c2ecf20Sopenharmony_ci#else 568c2ecf20Sopenharmony_ci#define USR_MODE 0x00000010 578c2ecf20Sopenharmony_ci#define SVC_MODE 0x00000013 588c2ecf20Sopenharmony_ci#endif 598c2ecf20Sopenharmony_ci#define FIQ_MODE 0x00000011 608c2ecf20Sopenharmony_ci#define IRQ_MODE 0x00000012 618c2ecf20Sopenharmony_ci#define MON_MODE 0x00000016 628c2ecf20Sopenharmony_ci#define ABT_MODE 0x00000017 638c2ecf20Sopenharmony_ci#define HYP_MODE 0x0000001a 648c2ecf20Sopenharmony_ci#define UND_MODE 0x0000001b 658c2ecf20Sopenharmony_ci#define SYSTEM_MODE 0x0000001f 668c2ecf20Sopenharmony_ci#define MODE32_BIT 0x00000010 678c2ecf20Sopenharmony_ci#define MODE_MASK 0x0000001f 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define V4_PSR_T_BIT 0x00000020 /* >= V4T, but not V7M */ 708c2ecf20Sopenharmony_ci#define V7M_PSR_T_BIT 0x01000000 718c2ecf20Sopenharmony_ci#if defined(__KERNEL__) && defined(CONFIG_CPU_V7M) 728c2ecf20Sopenharmony_ci#define PSR_T_BIT V7M_PSR_T_BIT 738c2ecf20Sopenharmony_ci#else 748c2ecf20Sopenharmony_ci/* for compatibility */ 758c2ecf20Sopenharmony_ci#define PSR_T_BIT V4_PSR_T_BIT 768c2ecf20Sopenharmony_ci#endif 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define PSR_F_BIT 0x00000040 /* >= V4, but not V7M */ 798c2ecf20Sopenharmony_ci#define PSR_I_BIT 0x00000080 /* >= V4, but not V7M */ 808c2ecf20Sopenharmony_ci#define PSR_A_BIT 0x00000100 /* >= V6, but not V7M */ 818c2ecf20Sopenharmony_ci#define PSR_E_BIT 0x00000200 /* >= V6, but not V7M */ 828c2ecf20Sopenharmony_ci#define PSR_J_BIT 0x01000000 /* >= V5J, but not V7M */ 838c2ecf20Sopenharmony_ci#define PSR_Q_BIT 0x08000000 /* >= V5E, including V7M */ 848c2ecf20Sopenharmony_ci#define PSR_V_BIT 0x10000000 858c2ecf20Sopenharmony_ci#define PSR_C_BIT 0x20000000 868c2ecf20Sopenharmony_ci#define PSR_Z_BIT 0x40000000 878c2ecf20Sopenharmony_ci#define PSR_N_BIT 0x80000000 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/* 908c2ecf20Sopenharmony_ci * Groups of PSR bits 918c2ecf20Sopenharmony_ci */ 928c2ecf20Sopenharmony_ci#define PSR_f 0xff000000 /* Flags */ 938c2ecf20Sopenharmony_ci#define PSR_s 0x00ff0000 /* Status */ 948c2ecf20Sopenharmony_ci#define PSR_x 0x0000ff00 /* Extension */ 958c2ecf20Sopenharmony_ci#define PSR_c 0x000000ff /* Control */ 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* 988c2ecf20Sopenharmony_ci * ARMv7 groups of PSR bits 998c2ecf20Sopenharmony_ci */ 1008c2ecf20Sopenharmony_ci#define APSR_MASK 0xf80f0000 /* N, Z, C, V, Q and GE flags */ 1018c2ecf20Sopenharmony_ci#define PSR_ISET_MASK 0x01000010 /* ISA state (J, T) mask */ 1028c2ecf20Sopenharmony_ci#define PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */ 1038c2ecf20Sopenharmony_ci#define PSR_ENDIAN_MASK 0x00000200 /* Endianness state mask */ 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci/* 1068c2ecf20Sopenharmony_ci * Default endianness state 1078c2ecf20Sopenharmony_ci */ 1088c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_ENDIAN_BE8 1098c2ecf20Sopenharmony_ci#define PSR_ENDSTATE PSR_E_BIT 1108c2ecf20Sopenharmony_ci#else 1118c2ecf20Sopenharmony_ci#define PSR_ENDSTATE 0 1128c2ecf20Sopenharmony_ci#endif 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* 1158c2ecf20Sopenharmony_ci * These are 'magic' values for PTRACE_PEEKUSR that return info about where a 1168c2ecf20Sopenharmony_ci * process is located in memory. 1178c2ecf20Sopenharmony_ci */ 1188c2ecf20Sopenharmony_ci#define PT_TEXT_ADDR 0x10000 1198c2ecf20Sopenharmony_ci#define PT_DATA_ADDR 0x10004 1208c2ecf20Sopenharmony_ci#define PT_TEXT_END_ADDR 0x10008 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci/* 1258c2ecf20Sopenharmony_ci * This struct defines the way the registers are stored on the 1268c2ecf20Sopenharmony_ci * stack during a system call. Note that sizeof(struct pt_regs) 1278c2ecf20Sopenharmony_ci * has to be a multiple of 8. 1288c2ecf20Sopenharmony_ci */ 1298c2ecf20Sopenharmony_ci#ifndef __KERNEL__ 1308c2ecf20Sopenharmony_cistruct pt_regs { 1318c2ecf20Sopenharmony_ci long uregs[18]; 1328c2ecf20Sopenharmony_ci}; 1338c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */ 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci#define ARM_cpsr uregs[16] 1368c2ecf20Sopenharmony_ci#define ARM_pc uregs[15] 1378c2ecf20Sopenharmony_ci#define ARM_lr uregs[14] 1388c2ecf20Sopenharmony_ci#define ARM_sp uregs[13] 1398c2ecf20Sopenharmony_ci#define ARM_ip uregs[12] 1408c2ecf20Sopenharmony_ci#define ARM_fp uregs[11] 1418c2ecf20Sopenharmony_ci#define ARM_r10 uregs[10] 1428c2ecf20Sopenharmony_ci#define ARM_r9 uregs[9] 1438c2ecf20Sopenharmony_ci#define ARM_r8 uregs[8] 1448c2ecf20Sopenharmony_ci#define ARM_r7 uregs[7] 1458c2ecf20Sopenharmony_ci#define ARM_r6 uregs[6] 1468c2ecf20Sopenharmony_ci#define ARM_r5 uregs[5] 1478c2ecf20Sopenharmony_ci#define ARM_r4 uregs[4] 1488c2ecf20Sopenharmony_ci#define ARM_r3 uregs[3] 1498c2ecf20Sopenharmony_ci#define ARM_r2 uregs[2] 1508c2ecf20Sopenharmony_ci#define ARM_r1 uregs[1] 1518c2ecf20Sopenharmony_ci#define ARM_r0 uregs[0] 1528c2ecf20Sopenharmony_ci#define ARM_ORIG_r0 uregs[17] 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci/* 1558c2ecf20Sopenharmony_ci * The size of the user-visible VFP state as seen by PTRACE_GET/SETVFPREGS 1568c2ecf20Sopenharmony_ci * and core dumps. 1578c2ecf20Sopenharmony_ci */ 1588c2ecf20Sopenharmony_ci#define ARM_VFPREGS_SIZE ( 32 * 8 /*fpregs*/ + 4 /*fpscr*/ ) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci#endif /* _UAPI__ASM_ARM_PTRACE_H */ 164