Stacey Son | 7dba5e1 | 2024-07-08 00:41:24 +0530 | [diff] [blame] | 1 | /* |
| 2 | * ARM AArch64 specific signal definitions for bsd-user |
| 3 | * |
| 4 | * Copyright (c) 2015 Stacey D. Son <sson at FreeBSD> |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef TARGET_ARCH_SIGNAL_H |
| 21 | #define TARGET_ARCH_SIGNAL_H |
| 22 | |
| 23 | #include "cpu.h" |
| 24 | |
| 25 | #define TARGET_REG_X0 0 |
| 26 | #define TARGET_REG_X30 30 |
| 27 | #define TARGET_REG_X31 31 |
| 28 | #define TARGET_REG_LR TARGET_REG_X30 |
| 29 | #define TARGET_REG_SP TARGET_REG_X31 |
| 30 | |
| 31 | #define TARGET_INSN_SIZE 4 /* arm64 instruction size */ |
| 32 | |
| 33 | /* Size of the signal trampolin code. See _sigtramp(). */ |
| 34 | #define TARGET_SZSIGCODE ((abi_ulong)(9 * TARGET_INSN_SIZE)) |
| 35 | |
| 36 | /* compare to sys/arm64/include/_limits.h */ |
| 37 | #define TARGET_MINSIGSTKSZ (1024 * 4) /* min sig stack size */ |
| 38 | #define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768) /* recommended size */ |
| 39 | |
| 40 | /* struct __mcontext in sys/arm64/include/ucontext.h */ |
| 41 | |
| 42 | struct target_gpregs { |
| 43 | uint64_t gp_x[30]; |
| 44 | uint64_t gp_lr; |
| 45 | uint64_t gp_sp; |
| 46 | uint64_t gp_elr; |
| 47 | uint32_t gp_spsr; |
| 48 | uint32_t gp_pad; |
| 49 | }; |
| 50 | |
| 51 | struct target_fpregs { |
Stacey Son | ce6c541 | 2024-07-08 00:41:28 +0530 | [diff] [blame] | 52 | Int128 fp_q[32]; |
Stacey Son | 7dba5e1 | 2024-07-08 00:41:24 +0530 | [diff] [blame] | 53 | uint32_t fp_sr; |
| 54 | uint32_t fp_cr; |
| 55 | uint32_t fp_flags; |
| 56 | uint32_t fp_pad; |
| 57 | }; |
| 58 | |
| 59 | struct target__mcontext { |
| 60 | struct target_gpregs mc_gpregs; |
| 61 | struct target_fpregs mc_fpregs; |
| 62 | uint32_t mc_flags; |
| 63 | #define TARGET_MC_FP_VALID 0x1 |
| 64 | uint32_t mc_pad; |
| 65 | uint64_t mc_spare[8]; |
| 66 | }; |
| 67 | |
| 68 | typedef struct target__mcontext target_mcontext_t; |
| 69 | |
| 70 | #define TARGET_MCONTEXT_SIZE 880 |
| 71 | #define TARGET_UCONTEXT_SIZE 960 |
| 72 | |
| 73 | #include "target_os_ucontext.h" |
| 74 | |
| 75 | struct target_sigframe { |
| 76 | target_siginfo_t sf_si; /* saved siginfo */ |
| 77 | target_ucontext_t sf_uc; /* saved ucontext */ |
| 78 | }; |
| 79 | |
Warner Losh | 5fa2a10 | 2024-06-23 15:29:42 -0600 | [diff] [blame] | 80 | #define TARGET_SIGSTACK_ALIGN 16 |
| 81 | |
Stacey Son | 7dba5e1 | 2024-07-08 00:41:24 +0530 | [diff] [blame] | 82 | #endif /* TARGET_ARCH_SIGNAL_H */ |