Print this page
OS-8347 Update SmartOS to support illumos 13917

*** 22,32 **** * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* ! * Copyright 2019 Joyent, Inc. */ #include <sys/errno.h> #include <sys/systm.h> #include <sys/archsystm.h> --- 22,32 ---- * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* ! * Copyright 2022 Joyent, Inc. */ #include <sys/errno.h> #include <sys/systm.h> #include <sys/archsystm.h>
*** 55,67 **** #include <sys/sunddi.h> #include <sys/dlpi.h> #include <sys/sysmacros.h> /* Linux specific functions and definitions */ ! static void lx_save(klwp_t *); ! static void lx_restore(klwp_t *); /* * Set the return code for the forked child, always zero */ /*ARGSUSED*/ void --- 55,75 ---- #include <sys/sunddi.h> #include <sys/dlpi.h> #include <sys/sysmacros.h> /* Linux specific functions and definitions */ ! static void lx_save(void *); ! static void lx_restore(void *); + /* Context op template. */ + static const struct ctxop_template lx_ctxop_template = { + .ct_rev = CTXOP_TPL_REV, + .ct_save = lx_save, + .ct_restore = lx_restore, + .ct_exit = lx_save, + }; + /* * Set the return code for the forked child, always zero */ /*ARGSUSED*/ void
*** 118,129 **** */ lwpd->br_stack_mode = LX_STACK_MODE_PREINIT; lwpd->br_ntv_stack = 0; lwpd->br_ntv_stack_current = 0; ! installctx(lwptot(lwp), lwp, lx_save, lx_restore, NULL, NULL, lx_save, ! NULL, NULL); /* * clear out the tls array */ bzero(lwpd->br_tls, sizeof (lwpd->br_tls)); --- 126,136 ---- */ lwpd->br_stack_mode = LX_STACK_MODE_PREINIT; lwpd->br_ntv_stack = 0; lwpd->br_ntv_stack_current = 0; ! ctxop_install(lwptot(lwp), &lx_ctxop_template, lwp); /* * clear out the tls array */ bzero(lwpd->br_tls, sizeof (lwpd->br_tls));
*** 344,355 **** /* * Remove our system call interposer. */ lwp->lwp_brand_syscall = NULL; ! (void) removectx(lwptot(lwp), lwp, lx_save, lx_restore, NULL, NULL, ! lx_save, NULL); if (lwpd->br_pid != 0) { lx_pid_rele(lwptoproc(lwp)->p_pid, lwptot(lwp)->t_tid); } /* --- 351,366 ---- /* * Remove our system call interposer. */ lwp->lwp_brand_syscall = NULL; ! /* ! * If this process is being de-branded during an exec(), ! * the LX ctxops may have already been removed, so the result ! * from ctxop_remove is irrelevant. ! */ ! (void) ctxop_remove(lwptot(lwp), &lx_ctxop_template, lwp); if (lwpd->br_pid != 0) { lx_pid_rele(lwptoproc(lwp)->p_pid, lwptot(lwp)->t_tid); } /*
*** 496,507 **** * Having performed the lx pid assignement, the lpid reference is no * longer needed. The underlying data will be freed during lx_freelwp. */ lwpd->br_lpid = NULL; ! installctx(lwptot(lwp), lwp, lx_save, lx_restore, NULL, NULL, ! lx_save, NULL, NULL); /* * Install branded system call hooks for this LWP: */ lwp->lwp_brand_syscall = lx_syscall_enter; --- 507,517 ---- * Having performed the lx pid assignement, the lpid reference is no * longer needed. The underlying data will be freed during lx_freelwp. */ lwpd->br_lpid = NULL; ! ctxop_install(lwptot(lwp), &lx_ctxop_template, lwp); /* * Install branded system call hooks for this LWP: */ lwp->lwp_brand_syscall = lx_syscall_enter;
*** 611,622 **** /* * When switching a Linux process off the CPU, clear its GDT entries. */ /* ARGSUSED */ static void ! lx_save(klwp_t *t) { int i; #if defined(__amd64) reset_sregs(); #endif --- 621,633 ---- /* * When switching a Linux process off the CPU, clear its GDT entries. */ /* ARGSUSED */ static void ! lx_save(void *arg) { + klwp_t *t = (klwp_t *)arg; int i; #if defined(__amd64) reset_sregs(); #endif
*** 631,642 **** * %fsbase via wrmsr(MSR_AMD_FSBASE) here. Instead, that should happen * automatically in update_sregs if we are executing in user-land. If this * is the case then pcb_rupdate should be set. */ static void ! lx_restore(klwp_t *t) { struct lx_lwp_data *lwpd = lwptolxlwp(t); user_desc_t *tls; int i; ASSERT(lwpd); --- 642,654 ---- * %fsbase via wrmsr(MSR_AMD_FSBASE) here. Instead, that should happen * automatically in update_sregs if we are executing in user-land. If this * is the case then pcb_rupdate should be set. */ static void ! lx_restore(void *arg) { + klwp_t *t = (klwp_t *)arg; struct lx_lwp_data *lwpd = lwptolxlwp(t); user_desc_t *tls; int i; ASSERT(lwpd);