xref: /qemu/bsd-user/aarch64/target_arch_signal.h (revision 029e13a8a56a2931e7c24c0db52ae7256b932cb0)
17dba5e10SStacey Son /*
27dba5e10SStacey Son  * ARM AArch64 specific signal definitions for bsd-user
37dba5e10SStacey Son  *
47dba5e10SStacey Son  * Copyright (c) 2015 Stacey D. Son <sson at FreeBSD>
57dba5e10SStacey Son  *
67dba5e10SStacey Son  * This library is free software; you can redistribute it and/or
77dba5e10SStacey Son  * modify it under the terms of the GNU Lesser General Public
87dba5e10SStacey Son  * License as published by the Free Software Foundation; either
97dba5e10SStacey Son  * version 2 of the License, or (at your option) any later version.
107dba5e10SStacey Son  *
117dba5e10SStacey Son  * This library is distributed in the hope that it will be useful,
127dba5e10SStacey Son  * but WITHOUT ANY WARRANTY; without even the implied warranty of
137dba5e10SStacey Son  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147dba5e10SStacey Son  * Lesser General Public License for more details.
157dba5e10SStacey Son  *
167dba5e10SStacey Son  * You should have received a copy of the GNU Lesser General Public
177dba5e10SStacey Son  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
187dba5e10SStacey Son  */
197dba5e10SStacey Son 
207dba5e10SStacey Son #ifndef TARGET_ARCH_SIGNAL_H
217dba5e10SStacey Son #define TARGET_ARCH_SIGNAL_H
227dba5e10SStacey Son 
237dba5e10SStacey Son #include "cpu.h"
247dba5e10SStacey Son 
257dba5e10SStacey Son #define TARGET_REG_X0   0
267dba5e10SStacey Son #define TARGET_REG_X30  30
277dba5e10SStacey Son #define TARGET_REG_X31  31
287dba5e10SStacey Son #define TARGET_REG_LR   TARGET_REG_X30
297dba5e10SStacey Son #define TARGET_REG_SP   TARGET_REG_X31
307dba5e10SStacey Son 
317dba5e10SStacey Son #define TARGET_INSN_SIZE    4       /* arm64 instruction size */
327dba5e10SStacey Son 
337dba5e10SStacey Son /* Size of the signal trampolin code. See _sigtramp(). */
347dba5e10SStacey Son #define TARGET_SZSIGCODE    ((abi_ulong)(9 * TARGET_INSN_SIZE))
357dba5e10SStacey Son 
367dba5e10SStacey Son /* compare to sys/arm64/include/_limits.h */
377dba5e10SStacey Son #define TARGET_MINSIGSTKSZ  (1024 * 4)                  /* min sig stack size */
387dba5e10SStacey Son #define TARGET_SIGSTKSZ     (TARGET_MINSIGSTKSZ + 32768)  /* recommended size */
397dba5e10SStacey Son 
407dba5e10SStacey Son /* struct __mcontext in sys/arm64/include/ucontext.h */
417dba5e10SStacey Son 
427dba5e10SStacey Son struct target_gpregs {
437dba5e10SStacey Son     uint64_t    gp_x[30];
447dba5e10SStacey Son     uint64_t    gp_lr;
457dba5e10SStacey Son     uint64_t    gp_sp;
467dba5e10SStacey Son     uint64_t    gp_elr;
477dba5e10SStacey Son     uint32_t    gp_spsr;
487dba5e10SStacey Son     uint32_t    gp_pad;
497dba5e10SStacey Son };
507dba5e10SStacey Son 
517dba5e10SStacey Son struct target_fpregs {
52ce6c541dSStacey Son     Int128      fp_q[32];
537dba5e10SStacey Son     uint32_t    fp_sr;
547dba5e10SStacey Son     uint32_t    fp_cr;
557dba5e10SStacey Son     uint32_t    fp_flags;
567dba5e10SStacey Son     uint32_t    fp_pad;
577dba5e10SStacey Son };
587dba5e10SStacey Son 
597dba5e10SStacey Son struct target__mcontext {
607dba5e10SStacey Son     struct target_gpregs mc_gpregs;
617dba5e10SStacey Son     struct target_fpregs mc_fpregs;
627dba5e10SStacey Son     uint32_t    mc_flags;
637dba5e10SStacey Son #define TARGET_MC_FP_VALID  0x1
647dba5e10SStacey Son     uint32_t    mc_pad;
657dba5e10SStacey Son     uint64_t    mc_spare[8];
667dba5e10SStacey Son };
677dba5e10SStacey Son 
687dba5e10SStacey Son typedef struct target__mcontext target_mcontext_t;
697dba5e10SStacey Son 
707dba5e10SStacey Son #define TARGET_MCONTEXT_SIZE 880
717dba5e10SStacey Son #define TARGET_UCONTEXT_SIZE 960
727dba5e10SStacey Son 
737dba5e10SStacey Son #include "target_os_ucontext.h"
747dba5e10SStacey Son 
757dba5e10SStacey Son struct target_sigframe {
767dba5e10SStacey Son     target_siginfo_t    sf_si;  /* saved siginfo */
777dba5e10SStacey Son     target_ucontext_t   sf_uc;  /* saved ucontext */
787dba5e10SStacey Son };
797dba5e10SStacey Son 
80*5fa2a10bSWarner Losh #define TARGET_SIGSTACK_ALIGN 16
81*5fa2a10bSWarner Losh 
827dba5e10SStacey Son #endif /* TARGET_ARCH_SIGNAL_H */
83