Print this page




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*

  23  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright 2023 Oxide Computer Company
  25  *
  26  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  31 /*        All Rights Reserved   */
  32 
  33 #ifndef _SYS_UCONTEXT_H
  34 #define _SYS_UCONTEXT_H
  35 
  36 #include <sys/feature_tests.h>
  37 
  38 #include <sys/types.h>
  39 #include <sys/mcontext.h>
  40 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  41 #include <sys/signal.h>
  42 #endif


  72 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  73 typedef struct ucontext ucontext_t;
  74 #else
  75 typedef struct __ucontext ucontext_t;
  76 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
  77 
  78 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  79 struct  ucontext {
  80 #else
  81 struct  __ucontext {
  82 #endif
  83         unsigned long   uc_flags;
  84         ucontext_t      *uc_link;
  85         sigset_t        uc_sigmask;
  86         stack_t         uc_stack;
  87         mcontext_t      uc_mcontext;
  88         /*
  89          * The first three entries have been borrowed by the lx brand right now.
  90          * That should be consolidated into a single uc_brand entry with a
  91          * UC_BRAND flag. Until such time, we leave them as is.


  92          */
  93         long            uc_filler[3];
  94         long            uc_xsave;
  95         long            uc_filler1;
  96 };
  97 
  98 #if defined(_SYSCALL32)
  99 
 100 /* Kernel view of user ILP32 ucontext structure */
 101 
 102 typedef struct ucontext32 {
 103         uint32_t        uc_flags;
 104         caddr32_t       uc_link;
 105         sigset_t        uc_sigmask;
 106         stack32_t       uc_stack;
 107         mcontext32_t    uc_mcontext;
 108         int32_t         uc_filler[3];
 109         int32_t         uc_xsave;
 110         int32_t         uc_filler1;
 111 } ucontext32_t;
 112 
 113 #if defined(_KERNEL)
 114 extern void ucontext_nto32(const ucontext_t *src, ucontext32_t *dest);
 115 extern void ucontext_32ton(const ucontext32_t *src, ucontext_t *dest);
 116 #endif
 117 
 118 #endif  /* _SYSCALL32 */
 119 
 120 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 121 #define GETCONTEXT      0
 122 #define SETCONTEXT      1
 123 #define GETUSTACK       2
 124 #define SETUSTACK       3
 125 #define GETCONTEXT_EXTD 4
 126 
 127 /*
 128  * values for uc_flags




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2015 Joyent, Inc.
  24  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  25  * Copyright 2023 Oxide Computer Company
  26  *
  27  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  28  * Use is subject to license terms.
  29  */
  30 
  31 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  32 /*        All Rights Reserved   */
  33 
  34 #ifndef _SYS_UCONTEXT_H
  35 #define _SYS_UCONTEXT_H
  36 
  37 #include <sys/feature_tests.h>
  38 
  39 #include <sys/types.h>
  40 #include <sys/mcontext.h>
  41 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  42 #include <sys/signal.h>
  43 #endif


  73 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  74 typedef struct ucontext ucontext_t;
  75 #else
  76 typedef struct __ucontext ucontext_t;
  77 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
  78 
  79 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  80 struct  ucontext {
  81 #else
  82 struct  __ucontext {
  83 #endif
  84         unsigned long   uc_flags;
  85         ucontext_t      *uc_link;
  86         sigset_t        uc_sigmask;
  87         stack_t         uc_stack;
  88         mcontext_t      uc_mcontext;
  89         /*
  90          * The first three entries have been borrowed by the lx brand right now.
  91          * That should be consolidated into a single uc_brand entry with a
  92          * UC_BRAND flag. Until such time, we leave them as is.
  93          *
  94          * We rename those first three entries here for SmartOS.
  95          */
  96         void            *uc_brand_data[3];
  97         long            uc_xsave;
  98         long            uc_filler1;
  99 };

 100 #if defined(_SYSCALL32)
 101 
 102 /* Kernel view of user ILP32 ucontext structure */
 103 
 104 typedef struct ucontext32 {
 105         uint32_t        uc_flags;
 106         caddr32_t       uc_link;
 107         sigset_t        uc_sigmask;
 108         stack32_t       uc_stack;
 109         mcontext32_t    uc_mcontext;
 110         caddr32_t       uc_brand_data[3];
 111         int32_t         uc_xsave;
 112         int32_t         uc_filler1;
 113 } ucontext32_t;
 114 
 115 #if defined(_KERNEL)
 116 extern void ucontext_nto32(const ucontext_t *src, ucontext32_t *dest);
 117 extern void ucontext_32ton(const ucontext32_t *src, ucontext_t *dest);
 118 #endif
 119 
 120 #endif  /* _SYSCALL32 */
 121 
 122 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 123 #define GETCONTEXT      0
 124 #define SETCONTEXT      1
 125 #define GETUSTACK       2
 126 #define SETUSTACK       3
 127 #define GETCONTEXT_EXTD 4
 128 
 129 /*
 130  * values for uc_flags