Print this page
11909 THREAD_KPRI_RELEASE does nothing of the sort
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sparc/os/syscall.c
          +++ new/usr/src/uts/sparc/os/syscall.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2019 Joyent, Inc.
  24   25   */
  25   26  
  26   27  #include <sys/param.h>
  27   28  #include <sys/vmparam.h>
  28   29  #include <sys/types.h>
  29   30  #include <sys/sysmacros.h>
  30   31  #include <sys/systm.h>
  31   32  #include <sys/cmn_err.h>
  32   33  #include <sys/signal.h>
  33   34  #include <sys/stack.h>
↓ open down ↓ 150 lines elided ↑ open up ↑
 184  185          uint_t i, code;
 185  186  
 186  187          code = get_syscall_args(lwp, args, nargsp);
 187  188          for (i = 0; i != *nargsp; i++)
 188  189                  *argp++ = (int)args[i];
 189  190          return (code);
 190  191  }
 191  192  #endif
 192  193  
 193  194  /*
 194      - *      Save the system call arguments in a safe place.
      195 + *      Save the system call arguments in a safe place.
 195  196   *      lwp->lwp_ap normally points to the out regs in the reg structure.
 196  197   *      If the user is going to change the out registers, g1, or the stack,
 197  198   *      and might want to get the args (for /proc tracing), it must copy
 198  199   *      the args elsewhere via save_syscall_args().
 199  200   *
 200  201   *      This may be called from stop() even when we're not in a system call.
 201  202   *      Since there's no easy way to tell, this must be safe (not panic).
 202  203   *      If the copyins get data faults, return non-zero.
 203  204   */
 204  205  int
↓ open down ↓ 792 lines elided ↑ open up ↑
 997  998  
 998  999          if (id != -1)
 999 1000                  mutex_exit(&mod_lock);
1000 1001  
1001 1002          return (module_lock);
1002 1003  }
1003 1004  
1004 1005  /*
1005 1006   * Loadable syscall support.
1006 1007   *      If needed, load the module, then reserve it by holding a read
1007      - *      lock for the duration of the call.
     1008 + *      lock for the duration of the call.
1008 1009   *      Later, if the syscall is not unloadable, it could patch the vector.
1009 1010   */
1010 1011  /*ARGSUSED*/
1011 1012  int64_t
1012 1013  loadable_syscall(
1013 1014      long a0, long a1, long a2, long a3,
1014 1015      long a4, long a5, long a6, long a7)
1015 1016  {
1016 1017          int64_t         rval;
1017 1018          struct sysent   *callp;
↓ open down ↓ 1 lines elided ↑ open up ↑
1019 1020          krwlock_t       *module_lock;
1020 1021          int             code;
1021 1022  
1022 1023          code = curthread->t_sysnum;
1023 1024          callp = se + code;
1024 1025  
1025 1026          /*
1026 1027           * Try to autoload the system call if necessary.
1027 1028           */
1028 1029          module_lock = lock_syscall(se, code);
1029      -        THREAD_KPRI_RELEASE();  /* drop priority given by rw_enter */
1030 1030  
1031 1031          /*
1032 1032           * we've locked either the loaded syscall or nosys
1033 1033           */
1034 1034          if (callp->sy_flags & SE_ARGC) {
1035 1035                  int64_t (*sy_call)();
1036 1036  
1037 1037                  sy_call = (int64_t (*)())callp->sy_call;
1038 1038                  rval = (*sy_call)(a0, a1, a2, a3, a4, a5);
1039 1039          } else {
1040 1040                  rval = syscall_ap();
1041 1041          }
1042 1042  
1043      -        THREAD_KPRI_REQUEST();  /* regain priority from read lock */
1044 1043          rw_exit(module_lock);
1045 1044          return (rval);
1046 1045  }
1047 1046  
1048 1047  /*
1049 1048   * Handle indirect system calls.
1050 1049   *      This interface should be deprecated.  The library can handle
1051 1050   *      this more efficiently, but keep this implementation for old binaries.
1052 1051   *
1053 1052   * XX64 Needs some work.
↓ open down ↓ 9 lines elided ↑ open up ↑
1063 1062  
1064 1063          ASSERT(lwp->lwp_ap != NULL);
1065 1064  
1066 1065          curthread->t_sysnum = code;
1067 1066          callp = LWP_GETSYSENT(lwp) + code;
1068 1067  
1069 1068          /*
1070 1069           * Handle argument setup, unless already done in pre_syscall().
1071 1070           */
1072 1071          if (callp->sy_narg > 5) {
1073      -                if (save_syscall_args())        /* move args to LWP array */
     1072 +                if (save_syscall_args())        /* move args to LWP array */
1074 1073                          return ((int64_t)set_errno(EFAULT));
1075 1074          } else if (!lwp->lwp_argsaved) {
1076 1075                  long *ap;
1077 1076  
1078 1077                  ap = lwp->lwp_ap;               /* args haven't been saved */
1079 1078                  lwp->lwp_ap = ap + 1;           /* advance arg pointer */
1080 1079                  curthread->t_post_sys = 1;      /* so lwp_ap will be reset */
1081 1080          }
1082 1081          return ((*callp->sy_callc)(a0, a1, a2, a3, a4, lwp->lwp_arg[5]));
1083 1082  }
↓ open down ↓ 150 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX