Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASMARM_UCONTEXT_H
0003 #define _ASMARM_UCONTEXT_H
0004 
0005 #include <asm/fpstate.h>
0006 #include <asm/user.h>
0007 
0008 /*
0009  * struct sigcontext only has room for the basic registers, but struct
0010  * ucontext now has room for all registers which need to be saved and
0011  * restored.  Coprocessor registers are stored in uc_regspace.  Each
0012  * coprocessor's saved state should start with a documented 32-bit magic
0013  * number, followed by a 32-bit word giving the coproccesor's saved size.
0014  * uc_regspace may be expanded if necessary, although this takes some
0015  * coordination with glibc.
0016  */
0017 
0018 struct ucontext {
0019     unsigned long     uc_flags;
0020     struct ucontext  *uc_link;
0021     stack_t       uc_stack;
0022     struct sigcontext uc_mcontext;
0023     sigset_t      uc_sigmask;
0024     /* Allow for uc_sigmask growth.  Glibc uses a 1024-bit sigset_t.  */
0025     int       __unused[32 - (sizeof (sigset_t) / sizeof (int))];
0026     /* Last for extensibility.  Eight byte aligned because some
0027        coprocessors require eight byte alignment.  */
0028     unsigned long     uc_regspace[128] __attribute__((__aligned__(8)));
0029 };
0030 
0031 #ifdef __KERNEL__
0032 
0033 /*
0034  * Coprocessor save state.  The magic values and specific
0035  * coprocessor's layouts are part of the userspace ABI.  Each one of
0036  * these should be a multiple of eight bytes and aligned to eight
0037  * bytes, to prevent unpredictable padding in the signal frame.
0038  */
0039 
0040 /*
0041  * Dummy padding block: if this magic is encountered, the block should
0042  * be skipped using the corresponding size field.
0043  */
0044 #define DUMMY_MAGIC     0xb0d9ed01
0045 
0046 #ifdef CONFIG_IWMMXT
0047 /* iwmmxt_area is 0x98 bytes long, preceded by 8 bytes of signature */
0048 #define IWMMXT_MAGIC        0x12ef842a
0049 #define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8)
0050 
0051 struct iwmmxt_sigframe {
0052     unsigned long   magic;
0053     unsigned long   size;
0054     struct iwmmxt_struct storage;
0055 } __attribute__((__aligned__(8)));
0056 #endif /* CONFIG_IWMMXT */
0057 
0058 #ifdef CONFIG_VFP
0059 #define VFP_MAGIC       0x56465001
0060 
0061 struct vfp_sigframe
0062 {
0063     unsigned long       magic;
0064     unsigned long       size;
0065     struct user_vfp     ufp;
0066     struct user_vfp_exc ufp_exc;
0067 } __attribute__((__aligned__(8)));
0068 
0069 /*
0070  *  8 byte for magic and size, 264 byte for ufp, 12 bytes for ufp_exc,
0071  *  4 bytes padding.
0072  */
0073 #define VFP_STORAGE_SIZE    sizeof(struct vfp_sigframe)
0074 
0075 #endif /* CONFIG_VFP */
0076 
0077 /*
0078  * Auxiliary signal frame.  This saves stuff like FP state.
0079  * The layout of this structure is not part of the user ABI,
0080  * because the config options aren't.  uc_regspace is really
0081  * one of these.
0082  */
0083 struct aux_sigframe {
0084 #ifdef CONFIG_IWMMXT
0085     struct iwmmxt_sigframe  iwmmxt;
0086 #endif
0087 #ifdef CONFIG_VFP
0088     struct vfp_sigframe vfp;
0089 #endif
0090     /* Something that isn't a valid magic number for any coprocessor.  */
0091     unsigned long       end_magic;
0092 } __attribute__((__aligned__(8)));
0093 
0094 #endif
0095 
0096 #endif /* !_ASMARM_UCONTEXT_H */