| 1 | /* |
| 2 | * ARM AArch64 specific signal definitions for bsd-user |
| 3 | * |
| 4 | * Copyright (c) 2015 Stacey D. Son |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | */ |
| 8 | #ifndef TARGET_ARCH_SIGNAL_H |
| 9 | #define TARGET_ARCH_SIGNAL_H |
| 10 | |
| 11 | #include "cpu.h" |
| 12 | |
| 13 | #define TARGET_REG_X0 0 |
| 14 | #define TARGET_REG_X30 30 |
| 15 | #define TARGET_REG_X31 31 |
| 16 | #define TARGET_REG_LR TARGET_REG_X30 |
| 17 | #define TARGET_REG_SP TARGET_REG_X31 |
| 18 | |
| 19 | #define TARGET_INSN_SIZE 4 /* arm64 instruction size */ |
| 20 | |
| 21 | /* Size of the signal trampolin code. See _sigtramp(). */ |
| 22 | #define TARGET_SZSIGCODE ((abi_ulong)(9 * TARGET_INSN_SIZE)) |
| 23 | |
| 24 | /* compare to sys/arm64/include/_limits.h */ |
| 25 | #define TARGET_MINSIGSTKSZ (1024 * 4) /* min sig stack size */ |
| 26 | #define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768) /* recommended size */ |
| 27 | |
| 28 | /* struct __mcontext in sys/arm64/include/ucontext.h */ |
| 29 | |
| 30 | struct target_gpregs { |
| 31 | uint64_t gp_x[30]; |
| 32 | uint64_t gp_lr; |
| 33 | uint64_t gp_sp; |
| 34 | uint64_t gp_elr; |
| 35 | uint32_t gp_spsr; |
| 36 | uint32_t gp_pad; |
| 37 | }; |
| 38 | |
| 39 | struct target_fpregs { |
| 40 | Int128 fp_q[32]; |
| 41 | uint32_t fp_sr; |
| 42 | uint32_t fp_cr; |
| 43 | uint32_t fp_flags; |
| 44 | uint32_t fp_pad; |
| 45 | }; |
| 46 | |
| 47 | struct target__mcontext { |
| 48 | struct target_gpregs mc_gpregs; |
| 49 | struct target_fpregs mc_fpregs; |
| 50 | uint32_t mc_flags; |
| 51 | #define TARGET_MC_FP_VALID 0x1 |
| 52 | uint32_t mc_pad; |
| 53 | uint64_t mc_spare[8]; |
| 54 | }; |
| 55 | |
| 56 | typedef struct target__mcontext target_mcontext_t; |
| 57 | |
| 58 | #define TARGET_MCONTEXT_SIZE 880 |
| 59 | #define TARGET_UCONTEXT_SIZE 960 |
| 60 | |
| 61 | #include "target_os_ucontext.h" |
| 62 | |
| 63 | struct target_sigframe { |
| 64 | target_siginfo_t sf_si; /* saved siginfo */ |
| 65 | target_ucontext_t sf_uc; /* saved ucontext */ |
| 66 | }; |
| 67 | |
| 68 | #define TARGET_SIGSTACK_ALIGN 16 |
| 69 | |
| 70 | #endif /* TARGET_ARCH_SIGNAL_H */ |