162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASMARM_UCONTEXT_H 362306a36Sopenharmony_ci#define _ASMARM_UCONTEXT_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <asm/fpstate.h> 662306a36Sopenharmony_ci#include <asm/user.h> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci/* 962306a36Sopenharmony_ci * struct sigcontext only has room for the basic registers, but struct 1062306a36Sopenharmony_ci * ucontext now has room for all registers which need to be saved and 1162306a36Sopenharmony_ci * restored. Coprocessor registers are stored in uc_regspace. Each 1262306a36Sopenharmony_ci * coprocessor's saved state should start with a documented 32-bit magic 1362306a36Sopenharmony_ci * number, followed by a 32-bit word giving the coproccesor's saved size. 1462306a36Sopenharmony_ci * uc_regspace may be expanded if necessary, although this takes some 1562306a36Sopenharmony_ci * coordination with glibc. 1662306a36Sopenharmony_ci */ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_cistruct ucontext { 1962306a36Sopenharmony_ci unsigned long uc_flags; 2062306a36Sopenharmony_ci struct ucontext *uc_link; 2162306a36Sopenharmony_ci stack_t uc_stack; 2262306a36Sopenharmony_ci struct sigcontext uc_mcontext; 2362306a36Sopenharmony_ci sigset_t uc_sigmask; 2462306a36Sopenharmony_ci /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ 2562306a36Sopenharmony_ci int __unused[32 - (sizeof (sigset_t) / sizeof (int))]; 2662306a36Sopenharmony_ci /* Last for extensibility. Eight byte aligned because some 2762306a36Sopenharmony_ci coprocessors require eight byte alignment. */ 2862306a36Sopenharmony_ci unsigned long uc_regspace[128] __attribute__((__aligned__(8))); 2962306a36Sopenharmony_ci}; 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#ifdef __KERNEL__ 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci/* 3462306a36Sopenharmony_ci * Coprocessor save state. The magic values and specific 3562306a36Sopenharmony_ci * coprocessor's layouts are part of the userspace ABI. Each one of 3662306a36Sopenharmony_ci * these should be a multiple of eight bytes and aligned to eight 3762306a36Sopenharmony_ci * bytes, to prevent unpredictable padding in the signal frame. 3862306a36Sopenharmony_ci */ 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci/* 4162306a36Sopenharmony_ci * Dummy padding block: if this magic is encountered, the block should 4262306a36Sopenharmony_ci * be skipped using the corresponding size field. 4362306a36Sopenharmony_ci */ 4462306a36Sopenharmony_ci#define DUMMY_MAGIC 0xb0d9ed01 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#ifdef CONFIG_IWMMXT 4762306a36Sopenharmony_ci/* iwmmxt_area is 0x98 bytes long, preceded by 8 bytes of signature */ 4862306a36Sopenharmony_ci#define IWMMXT_MAGIC 0x12ef842a 4962306a36Sopenharmony_ci#define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8) 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_cistruct iwmmxt_sigframe { 5262306a36Sopenharmony_ci unsigned long magic; 5362306a36Sopenharmony_ci unsigned long size; 5462306a36Sopenharmony_ci struct iwmmxt_struct storage; 5562306a36Sopenharmony_ci} __attribute__((__aligned__(8))); 5662306a36Sopenharmony_ci#endif /* CONFIG_IWMMXT */ 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#ifdef CONFIG_VFP 5962306a36Sopenharmony_ci#define VFP_MAGIC 0x56465001 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_cistruct vfp_sigframe 6262306a36Sopenharmony_ci{ 6362306a36Sopenharmony_ci unsigned long magic; 6462306a36Sopenharmony_ci unsigned long size; 6562306a36Sopenharmony_ci struct user_vfp ufp; 6662306a36Sopenharmony_ci struct user_vfp_exc ufp_exc; 6762306a36Sopenharmony_ci} __attribute__((__aligned__(8))); 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci/* 7062306a36Sopenharmony_ci * 8 byte for magic and size, 264 byte for ufp, 12 bytes for ufp_exc, 7162306a36Sopenharmony_ci * 4 bytes padding. 7262306a36Sopenharmony_ci */ 7362306a36Sopenharmony_ci#define VFP_STORAGE_SIZE sizeof(struct vfp_sigframe) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#endif /* CONFIG_VFP */ 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci/* 7862306a36Sopenharmony_ci * Auxiliary signal frame. This saves stuff like FP state. 7962306a36Sopenharmony_ci * The layout of this structure is not part of the user ABI, 8062306a36Sopenharmony_ci * because the config options aren't. uc_regspace is really 8162306a36Sopenharmony_ci * one of these. 8262306a36Sopenharmony_ci */ 8362306a36Sopenharmony_cistruct aux_sigframe { 8462306a36Sopenharmony_ci#ifdef CONFIG_IWMMXT 8562306a36Sopenharmony_ci struct iwmmxt_sigframe iwmmxt; 8662306a36Sopenharmony_ci#endif 8762306a36Sopenharmony_ci#ifdef CONFIG_VFP 8862306a36Sopenharmony_ci struct vfp_sigframe vfp; 8962306a36Sopenharmony_ci#endif 9062306a36Sopenharmony_ci /* Something that isn't a valid magic number for any coprocessor. */ 9162306a36Sopenharmony_ci unsigned long end_magic; 9262306a36Sopenharmony_ci} __attribute__((__aligned__(8))); 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#endif 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#endif /* !_ASMARM_UCONTEXT_H */ 97