Print this page
OS-3561 lxbrand emulation library should execute on alternate stack
OS-3558 lxbrand add support for full in-kernel syscall handling
OS-3545 lx_syscall_regs should not walk stack
OS-3868 many LTP testcases now hang
OS-3901 lxbrand lx_recvmsg fails to translate control messages when 64-bit
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>


   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  *
  25  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  30 /*        All Rights Reserved   */
  31 
  32 #ifndef _SYS_UCONTEXT_H
  33 #define _SYS_UCONTEXT_H
  34 
  35 #include <sys/feature_tests.h>
  36 
  37 #include <sys/types.h>
  38 #include <sys/mcontext.h>
  39 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  40 #include <sys/signal.h>
  41 #endif
  42 
  43 #ifdef  __cplusplus
  44 extern "C" {


  67 } stack_t;
  68 #endif /* _STACK_T */
  69 #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
  70 
  71 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  72 typedef struct ucontext ucontext_t;
  73 #else
  74 typedef struct __ucontext ucontext_t;
  75 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
  76 
  77 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  78 struct  ucontext {
  79 #else
  80 struct  __ucontext {
  81 #endif
  82         unsigned long   uc_flags;
  83         ucontext_t      *uc_link;
  84         sigset_t        uc_sigmask;
  85         stack_t         uc_stack;
  86         mcontext_t      uc_mcontext;
  87         long            uc_filler[5];   /* see ABI spec for Intel386 */








  88 };
  89 
  90 #if defined(_SYSCALL32)
  91 
  92 /* Kernel view of user ILP32 ucontext structure */
  93 
  94 typedef struct ucontext32 {
  95         uint32_t        uc_flags;
  96         caddr32_t       uc_link;
  97         sigset_t        uc_sigmask;
  98         stack32_t       uc_stack;
  99         mcontext32_t    uc_mcontext;
 100         int32_t         uc_filler[5];

 101 } ucontext32_t;
 102 
 103 #if defined(_KERNEL)
 104 extern void ucontext_nto32(const ucontext_t *src, ucontext32_t *dest);
 105 extern void ucontext_32ton(const ucontext32_t *src, ucontext_t *dest);
 106 #endif
 107 
 108 #endif  /* _SYSCALL32 */
 109 
 110 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 111 #define GETCONTEXT      0
 112 #define SETCONTEXT      1
 113 #define GETUSTACK       2
 114 #define SETUSTACK       3
 115 
 116 /*
 117  * values for uc_flags
 118  * these are implementation dependent flags, that should be hidden
 119  * from the user interface, defining which elements of ucontext
 120  * are valid, and should be restored on call to setcontext




   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 2015 Joyent, Inc.
  25  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  30 /*        All Rights Reserved   */
  31 
  32 #ifndef _SYS_UCONTEXT_H
  33 #define _SYS_UCONTEXT_H
  34 
  35 #include <sys/feature_tests.h>
  36 
  37 #include <sys/types.h>
  38 #include <sys/mcontext.h>
  39 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  40 #include <sys/signal.h>
  41 #endif
  42 
  43 #ifdef  __cplusplus
  44 extern "C" {


  67 } stack_t;
  68 #endif /* _STACK_T */
  69 #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
  70 
  71 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  72 typedef struct ucontext ucontext_t;
  73 #else
  74 typedef struct __ucontext ucontext_t;
  75 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
  76 
  77 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
  78 struct  ucontext {
  79 #else
  80 struct  __ucontext {
  81 #endif
  82         unsigned long   uc_flags;
  83         ucontext_t      *uc_link;
  84         sigset_t        uc_sigmask;
  85         stack_t         uc_stack;
  86         mcontext_t      uc_mcontext;
  87         /*
  88          * The Intel386 ABI specification includes a 5-element array of longs
  89          * called "uc_filler", padding the size of the struct to 512 bytes.  To
  90          * allow zone brands to communicate extra data right the way through
  91          * the signal handling process, from sigacthandler to setcontext, we
  92          * steal the first three of these longs as a brand-private member.
  93          */
  94         void            *uc_brand_data[3];
  95         long            uc_filler[2];
  96 };

  97 #if defined(_SYSCALL32)
  98 
  99 /* Kernel view of user ILP32 ucontext structure */
 100 
 101 typedef struct ucontext32 {
 102         uint32_t        uc_flags;
 103         caddr32_t       uc_link;
 104         sigset_t        uc_sigmask;
 105         stack32_t       uc_stack;
 106         mcontext32_t    uc_mcontext;
 107         caddr32_t       uc_brand_data[3];
 108         int32_t         uc_filler[2];
 109 } ucontext32_t;
 110 
 111 #if defined(_KERNEL)
 112 extern void ucontext_nto32(const ucontext_t *src, ucontext32_t *dest);
 113 extern void ucontext_32ton(const ucontext32_t *src, ucontext_t *dest);
 114 #endif
 115 
 116 #endif  /* _SYSCALL32 */
 117 
 118 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 119 #define GETCONTEXT      0
 120 #define SETCONTEXT      1
 121 #define GETUSTACK       2
 122 #define SETUSTACK       3
 123 
 124 /*
 125  * values for uc_flags
 126  * these are implementation dependent flags, that should be hidden
 127  * from the user interface, defining which elements of ucontext
 128  * are valid, and should be restored on call to setcontext