Print this page
XXX AVX procfs


  42 #include <sys/systm.h>
  43 #include <sys/vfs.h>
  44 #include <sys/vnode.h>
  45 #include <sys/signal.h>
  46 #include <sys/auxv.h>
  47 #include <sys/user.h>
  48 #include <sys/class.h>
  49 #include <sys/fault.h>
  50 #include <sys/syscall.h>
  51 #include <sys/procfs.h>
  52 #include <sys/zone.h>
  53 #include <sys/copyops.h>
  54 #include <sys/schedctl.h>
  55 #include <vm/as.h>
  56 #include <vm/seg.h>
  57 #include <fs/proc/prdata.h>
  58 #include <sys/contract/process_impl.h>
  59 
  60 static  void    pr_settrace(proc_t *, sigset_t *);
  61 static  int     pr_setfpregs(prnode_t *, prfpregset_t *);
  62 #if defined(__sparc)
  63 static  int     pr_setxregs(prnode_t *, prxregset_t *);

  64 static  int     pr_setasrs(prnode_t *, asrset_t);
  65 #endif
  66 static  int     pr_setvaddr(prnode_t *, caddr_t);
  67 static  int     pr_clearsig(prnode_t *);
  68 static  int     pr_clearflt(prnode_t *);
  69 static  int     pr_watch(prnode_t *, prwatch_t *, int *);
  70 static  int     pr_agent(prnode_t *, prgregset_t, int *);
  71 static  int     pr_rdwr(proc_t *, enum uio_rw, priovec_t *);
  72 static  int     pr_scred(proc_t *, prcred_t *, cred_t *, boolean_t);
  73 static  int     pr_spriv(proc_t *, prpriv_t *, cred_t *);
  74 static  int     pr_szoneid(proc_t *, zoneid_t, cred_t *);
  75 static  void    pauselwps(proc_t *);
  76 static  void    unpauselwps(proc_t *);
  77 
  78 typedef union {
  79         long            sig;            /* PCKILL, PCUNKILL */
  80         long            nice;           /* PCNICE */
  81         long            timeo;          /* PCTWSTOP */
  82         ulong_t         flags;          /* PCRUN, PCSET, PCUNSET */
  83         caddr_t         vaddr;          /* PCSVADDR */
  84         siginfo_t       siginfo;        /* PCSSIG */
  85         sigset_t        sigset;         /* PCSTRACE, PCSHOLD */
  86         fltset_t        fltset;         /* PCSFAULT */
  87         sysset_t        sysset;         /* PCSENTRY, PCSEXIT */
  88         prgregset_t     prgregset;      /* PCSREG, PCAGENT */
  89         prfpregset_t    prfpregset;     /* PCSFPREG */
  90 #if defined(__sparc)
  91         prxregset_t     prxregset;      /* PCSXREG */

  92         asrset_t        asrset;         /* PCSASRS */
  93 #endif
  94         prwatch_t       prwatch;        /* PCWATCH */
  95         priovec_t       priovec;        /* PCREAD, PCWRITE */
  96         prcred_t        prcred;         /* PCSCRED */
  97         prpriv_t        prpriv;         /* PCSPRIV */
  98         long            przoneid;       /* PCSZONE */
  99 } arg_t;
 100 
 101 static  int     pr_control(long, arg_t *, prnode_t *, cred_t *);
 102 
 103 static size_t
 104 ctlsize(long cmd, size_t resid, arg_t *argp)
 105 {
 106         size_t size = sizeof (long);
 107         size_t rnd;
 108         int ngrp;
 109 
 110         switch (cmd) {
 111         case PCNULL:


 135                 size += sizeof (caddr_t);
 136                 break;
 137         case PCSTRACE:
 138         case PCSHOLD:
 139                 size += sizeof (sigset_t);
 140                 break;
 141         case PCSFAULT:
 142                 size += sizeof (fltset_t);
 143                 break;
 144         case PCSENTRY:
 145         case PCSEXIT:
 146                 size += sizeof (sysset_t);
 147                 break;
 148         case PCSREG:
 149         case PCAGENT:
 150                 size += sizeof (prgregset_t);
 151                 break;
 152         case PCSFPREG:
 153                 size += sizeof (prfpregset_t);
 154                 break;
 155 #if defined(__sparc)
 156         case PCSXREG:
 157                 size += sizeof (prxregset_t);
 158                 break;

 159         case PCSASRS:
 160                 size += sizeof (asrset_t);
 161                 break;
 162 #endif
 163         case PCWATCH:
 164                 size += sizeof (prwatch_t);
 165                 break;
 166         case PCREAD:
 167         case PCWRITE:
 168                 size += sizeof (priovec_t);
 169                 break;
 170         case PCSCRED:
 171                 size += sizeof (prcred_t);
 172                 break;
 173         case PCSCREDX:
 174                 /*
 175                  * We cannot derefence the pr_ngroups fields if it
 176                  * we don't have enough data.
 177                  */
 178                 if (resid < size + sizeof (prcred_t) - sizeof (gid_t))


 401                 {
 402                         kthread_t *t = pr_thread(pnp);
 403 
 404                         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
 405                                 thread_unlock(t);
 406                                 error = EBUSY;
 407                         } else {
 408                                 thread_unlock(t);
 409                                 mutex_exit(&p->p_lock);
 410                                 prsetprregs(ttolwp(t), argp->prgregset, 0);
 411                                 mutex_enter(&p->p_lock);
 412                         }
 413                         break;
 414                 }
 415 
 416         case PCSFPREG:  /* set floating-point registers */
 417                 error = pr_setfpregs(pnp, &argp->prfpregset);
 418                 break;
 419 
 420         case PCSXREG:   /* set extra registers */
 421 #if defined(__sparc)
 422                 error = pr_setxregs(pnp, &argp->prxregset);
 423 #else
 424                 error = EINVAL;
 425 #endif
 426                 break;
 427 
 428 #if defined(__sparc)
 429         case PCSASRS:   /* set ancillary state registers */
 430                 error = pr_setasrs(pnp, argp->asrset);
 431                 break;
 432 #endif
 433 
 434         case PCSVADDR:  /* set virtual address at which to resume */
 435                 error = pr_setvaddr(pnp, argp->vaddr);
 436                 break;
 437 
 438         case PCSHOLD:   /* set signal-hold mask */
 439                 pr_sethold(pnp, &argp->sigset);
 440                 break;
 441 
 442         case PCSFAULT:  /* set mask of traced faults */
 443                 pr_setfault(p, &argp->fltset);
 444                 break;
 445 


 486 
 487         if (error)
 488                 prunlock(pnp);
 489         return (error);
 490 }
 491 
 492 #ifdef _SYSCALL32_IMPL
 493 
 494 typedef union {
 495         int32_t         sig;            /* PCKILL, PCUNKILL */
 496         int32_t         nice;           /* PCNICE */
 497         int32_t         timeo;          /* PCTWSTOP */
 498         uint32_t        flags;          /* PCRUN, PCSET, PCUNSET */
 499         caddr32_t       vaddr;          /* PCSVADDR */
 500         siginfo32_t     siginfo;        /* PCSSIG */
 501         sigset_t        sigset;         /* PCSTRACE, PCSHOLD */
 502         fltset_t        fltset;         /* PCSFAULT */
 503         sysset_t        sysset;         /* PCSENTRY, PCSEXIT */
 504         prgregset32_t   prgregset;      /* PCSREG, PCAGENT */
 505         prfpregset32_t  prfpregset;     /* PCSFPREG */
 506 #if defined(__sparc)
 507         prxregset_t     prxregset;      /* PCSXREG */
 508 #endif
 509         prwatch32_t     prwatch;        /* PCWATCH */
 510         priovec32_t     priovec;        /* PCREAD, PCWRITE */
 511         prcred32_t      prcred;         /* PCSCRED */
 512         prpriv_t        prpriv;         /* PCSPRIV */
 513         int32_t         przoneid;       /* PCSZONE */
 514 } arg32_t;
 515 
 516 static  int     pr_control32(int32_t, arg32_t *, prnode_t *, cred_t *);
 517 static  int     pr_setfpregs32(prnode_t *, prfpregset32_t *);
 518 
 519 /*
 520  * Note that while ctlsize32() can use argp, it must do so only in a way
 521  * that assumes 32-bit rather than 64-bit alignment as argp is a pointer
 522  * to an array of 32-bit values and only 32-bit alignment is ensured.
 523  */
 524 static size_t
 525 ctlsize32(int32_t cmd, size_t resid, arg32_t *argp)
 526 {
 527         size_t size = sizeof (int32_t);
 528         size_t rnd;


 556                 size += sizeof (caddr32_t);
 557                 break;
 558         case PCSTRACE:
 559         case PCSHOLD:
 560                 size += sizeof (sigset_t);
 561                 break;
 562         case PCSFAULT:
 563                 size += sizeof (fltset_t);
 564                 break;
 565         case PCSENTRY:
 566         case PCSEXIT:
 567                 size += sizeof (sysset_t);
 568                 break;
 569         case PCSREG:
 570         case PCAGENT:
 571                 size += sizeof (prgregset32_t);
 572                 break;
 573         case PCSFPREG:
 574                 size += sizeof (prfpregset32_t);
 575                 break;
 576 #if defined(__sparc)
 577         case PCSXREG:
 578                 size += sizeof (prxregset_t);
 579                 break;
 580 #endif
 581         case PCWATCH:
 582                 size += sizeof (prwatch32_t);
 583                 break;
 584         case PCREAD:
 585         case PCWRITE:
 586                 size += sizeof (priovec32_t);
 587                 break;
 588         case PCSCRED:
 589                 size += sizeof (prcred32_t);
 590                 break;
 591         case PCSCREDX:
 592                 /*
 593                  * We cannot derefence the pr_ngroups fields if it
 594                  * we don't have enough data.
 595                  */
 596                 if (resid < size + sizeof (prcred32_t) - sizeof (gid32_t))
 597                         return (0);
 598                 ngrp = argp->prcred.pr_ngroups;
 599                 if (ngrp < 0 || ngrp > ngroups_max)
 600                         return (0);


 849                                 klwp_t *lwp = ttolwp(t);
 850 
 851                                 thread_unlock(t);
 852                                 mutex_exit(&p->p_lock);
 853                                 prgregset_32ton(lwp, argp->prgregset,
 854                                     prgregset);
 855                                 prsetprregs(lwp, prgregset, 0);
 856                                 mutex_enter(&p->p_lock);
 857                         }
 858                 }
 859                 break;
 860 
 861         case PCSFPREG:  /* set floating-point registers */
 862                 if (PROCESS_NOT_32BIT(p))
 863                         error = EOVERFLOW;
 864                 else
 865                         error = pr_setfpregs32(pnp, &argp->prfpregset);
 866                 break;
 867 
 868         case PCSXREG:   /* set extra registers */
 869 #if defined(__sparc)
 870                 if (PROCESS_NOT_32BIT(p))
 871                         error = EOVERFLOW;
 872                 else
 873                         error = pr_setxregs(pnp, &argp->prxregset);
 874 #else
 875                 error = EINVAL;
 876 #endif
 877                 break;
 878 
 879         case PCSVADDR:  /* set virtual address at which to resume */
 880                 if (PROCESS_NOT_32BIT(p))
 881                         error = EOVERFLOW;
 882                 else
 883                         error = pr_setvaddr(pnp,
 884                             (caddr_t)(uintptr_t)argp->vaddr);
 885                 break;
 886 
 887         case PCSHOLD:   /* set signal-hold mask */
 888                 pr_sethold(pnp, &argp->sigset);
 889                 break;
 890 
 891         case PCSFAULT:  /* set mask of traced faults */
 892                 pr_setfault(p, &argp->fltset);
 893                 break;
 894 
 895         case PCCSIG:    /* clear current signal */
 896                 error = pr_clearsig(pnp);


1689 
1690         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
1691                 thread_unlock(t);
1692                 return (EBUSY);
1693         }
1694         if (!prhasfp()) {
1695                 thread_unlock(t);
1696                 return (EINVAL);        /* No FP support */
1697         }
1698 
1699         /* drop p_lock while touching the lwp's stack */
1700         thread_unlock(t);
1701         mutex_exit(&p->p_lock);
1702         prsetprfpregs32(ttolwp(t), prfpregset);
1703         mutex_enter(&p->p_lock);
1704 
1705         return (0);
1706 }
1707 #endif  /* _SYSCALL32_IMPL */
1708 
1709 #if defined(__sparc)
1710 /* ARGSUSED */
1711 static int
1712 pr_setxregs(prnode_t *pnp, prxregset_t *prxregset)
1713 {
1714         proc_t *p = pnp->pr_common->prc_proc;
1715         kthread_t *t = pr_thread(pnp);  /* returns locked thread */
1716 
1717         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
1718                 thread_unlock(t);
1719                 return (EBUSY);
1720         }
1721         thread_unlock(t);
1722 
1723         if (!prhasx(p))
1724                 return (EINVAL);        /* No extra register support */
1725 
1726         /* drop p_lock while touching the lwp's stack */
1727         mutex_exit(&p->p_lock);
1728         prsetprxregs(ttolwp(t), (caddr_t)prxregset);
1729         mutex_enter(&p->p_lock);
1730 
1731         return (0);
1732 }
1733 

1734 static int
1735 pr_setasrs(prnode_t *pnp, asrset_t asrset)
1736 {
1737         proc_t *p = pnp->pr_common->prc_proc;
1738         kthread_t *t = pr_thread(pnp);  /* returns locked thread */
1739 
1740         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
1741                 thread_unlock(t);
1742                 return (EBUSY);
1743         }
1744         thread_unlock(t);
1745 
1746         /* drop p_lock while touching the lwp's stack */
1747         mutex_exit(&p->p_lock);
1748         prsetasregs(ttolwp(t), asrset);
1749         mutex_enter(&p->p_lock);
1750 
1751         return (0);
1752 }
1753 #endif




  42 #include <sys/systm.h>
  43 #include <sys/vfs.h>
  44 #include <sys/vnode.h>
  45 #include <sys/signal.h>
  46 #include <sys/auxv.h>
  47 #include <sys/user.h>
  48 #include <sys/class.h>
  49 #include <sys/fault.h>
  50 #include <sys/syscall.h>
  51 #include <sys/procfs.h>
  52 #include <sys/zone.h>
  53 #include <sys/copyops.h>
  54 #include <sys/schedctl.h>
  55 #include <vm/as.h>
  56 #include <vm/seg.h>
  57 #include <fs/proc/prdata.h>
  58 #include <sys/contract/process_impl.h>
  59 
  60 static  void    pr_settrace(proc_t *, sigset_t *);
  61 static  int     pr_setfpregs(prnode_t *, prfpregset_t *);

  62 static  int     pr_setxregs(prnode_t *, prxregset_t *);
  63 #if defined(__sparc)
  64 static  int     pr_setasrs(prnode_t *, asrset_t);
  65 #endif
  66 static  int     pr_setvaddr(prnode_t *, caddr_t);
  67 static  int     pr_clearsig(prnode_t *);
  68 static  int     pr_clearflt(prnode_t *);
  69 static  int     pr_watch(prnode_t *, prwatch_t *, int *);
  70 static  int     pr_agent(prnode_t *, prgregset_t, int *);
  71 static  int     pr_rdwr(proc_t *, enum uio_rw, priovec_t *);
  72 static  int     pr_scred(proc_t *, prcred_t *, cred_t *, boolean_t);
  73 static  int     pr_spriv(proc_t *, prpriv_t *, cred_t *);
  74 static  int     pr_szoneid(proc_t *, zoneid_t, cred_t *);
  75 static  void    pauselwps(proc_t *);
  76 static  void    unpauselwps(proc_t *);
  77 
  78 typedef union {
  79         long            sig;            /* PCKILL, PCUNKILL */
  80         long            nice;           /* PCNICE */
  81         long            timeo;          /* PCTWSTOP */
  82         ulong_t         flags;          /* PCRUN, PCSET, PCUNSET */
  83         caddr_t         vaddr;          /* PCSVADDR */
  84         siginfo_t       siginfo;        /* PCSSIG */
  85         sigset_t        sigset;         /* PCSTRACE, PCSHOLD */
  86         fltset_t        fltset;         /* PCSFAULT */
  87         sysset_t        sysset;         /* PCSENTRY, PCSEXIT */
  88         prgregset_t     prgregset;      /* PCSREG, PCAGENT */
  89         prfpregset_t    prfpregset;     /* PCSFPREG */

  90         prxregset_t     prxregset;      /* PCSXREG */
  91 #if defined(__sparc)
  92         asrset_t        asrset;         /* PCSASRS */
  93 #endif
  94         prwatch_t       prwatch;        /* PCWATCH */
  95         priovec_t       priovec;        /* PCREAD, PCWRITE */
  96         prcred_t        prcred;         /* PCSCRED */
  97         prpriv_t        prpriv;         /* PCSPRIV */
  98         long            przoneid;       /* PCSZONE */
  99 } arg_t;
 100 
 101 static  int     pr_control(long, arg_t *, prnode_t *, cred_t *);
 102 
 103 static size_t
 104 ctlsize(long cmd, size_t resid, arg_t *argp)
 105 {
 106         size_t size = sizeof (long);
 107         size_t rnd;
 108         int ngrp;
 109 
 110         switch (cmd) {
 111         case PCNULL:


 135                 size += sizeof (caddr_t);
 136                 break;
 137         case PCSTRACE:
 138         case PCSHOLD:
 139                 size += sizeof (sigset_t);
 140                 break;
 141         case PCSFAULT:
 142                 size += sizeof (fltset_t);
 143                 break;
 144         case PCSENTRY:
 145         case PCSEXIT:
 146                 size += sizeof (sysset_t);
 147                 break;
 148         case PCSREG:
 149         case PCAGENT:
 150                 size += sizeof (prgregset_t);
 151                 break;
 152         case PCSFPREG:
 153                 size += sizeof (prfpregset_t);
 154                 break;

 155         case PCSXREG:
 156                 size += sizeof (prxregset_t);
 157                 break;
 158 #if defined(__sparc)
 159         case PCSASRS:
 160                 size += sizeof (asrset_t);
 161                 break;
 162 #endif
 163         case PCWATCH:
 164                 size += sizeof (prwatch_t);
 165                 break;
 166         case PCREAD:
 167         case PCWRITE:
 168                 size += sizeof (priovec_t);
 169                 break;
 170         case PCSCRED:
 171                 size += sizeof (prcred_t);
 172                 break;
 173         case PCSCREDX:
 174                 /*
 175                  * We cannot derefence the pr_ngroups fields if it
 176                  * we don't have enough data.
 177                  */
 178                 if (resid < size + sizeof (prcred_t) - sizeof (gid_t))


 401                 {
 402                         kthread_t *t = pr_thread(pnp);
 403 
 404                         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
 405                                 thread_unlock(t);
 406                                 error = EBUSY;
 407                         } else {
 408                                 thread_unlock(t);
 409                                 mutex_exit(&p->p_lock);
 410                                 prsetprregs(ttolwp(t), argp->prgregset, 0);
 411                                 mutex_enter(&p->p_lock);
 412                         }
 413                         break;
 414                 }
 415 
 416         case PCSFPREG:  /* set floating-point registers */
 417                 error = pr_setfpregs(pnp, &argp->prfpregset);
 418                 break;
 419 
 420         case PCSXREG:   /* set extra registers */

 421                 error = pr_setxregs(pnp, &argp->prxregset);



 422                 break;
 423 
 424 #if defined(__sparc)
 425         case PCSASRS:   /* set ancillary state registers */
 426                 error = pr_setasrs(pnp, argp->asrset);
 427                 break;
 428 #endif
 429 
 430         case PCSVADDR:  /* set virtual address at which to resume */
 431                 error = pr_setvaddr(pnp, argp->vaddr);
 432                 break;
 433 
 434         case PCSHOLD:   /* set signal-hold mask */
 435                 pr_sethold(pnp, &argp->sigset);
 436                 break;
 437 
 438         case PCSFAULT:  /* set mask of traced faults */
 439                 pr_setfault(p, &argp->fltset);
 440                 break;
 441 


 482 
 483         if (error)
 484                 prunlock(pnp);
 485         return (error);
 486 }
 487 
 488 #ifdef _SYSCALL32_IMPL
 489 
 490 typedef union {
 491         int32_t         sig;            /* PCKILL, PCUNKILL */
 492         int32_t         nice;           /* PCNICE */
 493         int32_t         timeo;          /* PCTWSTOP */
 494         uint32_t        flags;          /* PCRUN, PCSET, PCUNSET */
 495         caddr32_t       vaddr;          /* PCSVADDR */
 496         siginfo32_t     siginfo;        /* PCSSIG */
 497         sigset_t        sigset;         /* PCSTRACE, PCSHOLD */
 498         fltset_t        fltset;         /* PCSFAULT */
 499         sysset_t        sysset;         /* PCSENTRY, PCSEXIT */
 500         prgregset32_t   prgregset;      /* PCSREG, PCAGENT */
 501         prfpregset32_t  prfpregset;     /* PCSFPREG */

 502         prxregset_t     prxregset;      /* PCSXREG */

 503         prwatch32_t     prwatch;        /* PCWATCH */
 504         priovec32_t     priovec;        /* PCREAD, PCWRITE */
 505         prcred32_t      prcred;         /* PCSCRED */
 506         prpriv_t        prpriv;         /* PCSPRIV */
 507         int32_t         przoneid;       /* PCSZONE */
 508 } arg32_t;
 509 
 510 static  int     pr_control32(int32_t, arg32_t *, prnode_t *, cred_t *);
 511 static  int     pr_setfpregs32(prnode_t *, prfpregset32_t *);
 512 
 513 /*
 514  * Note that while ctlsize32() can use argp, it must do so only in a way
 515  * that assumes 32-bit rather than 64-bit alignment as argp is a pointer
 516  * to an array of 32-bit values and only 32-bit alignment is ensured.
 517  */
 518 static size_t
 519 ctlsize32(int32_t cmd, size_t resid, arg32_t *argp)
 520 {
 521         size_t size = sizeof (int32_t);
 522         size_t rnd;


 550                 size += sizeof (caddr32_t);
 551                 break;
 552         case PCSTRACE:
 553         case PCSHOLD:
 554                 size += sizeof (sigset_t);
 555                 break;
 556         case PCSFAULT:
 557                 size += sizeof (fltset_t);
 558                 break;
 559         case PCSENTRY:
 560         case PCSEXIT:
 561                 size += sizeof (sysset_t);
 562                 break;
 563         case PCSREG:
 564         case PCAGENT:
 565                 size += sizeof (prgregset32_t);
 566                 break;
 567         case PCSFPREG:
 568                 size += sizeof (prfpregset32_t);
 569                 break;

 570         case PCSXREG:
 571                 size += sizeof (prxregset_t);
 572                 break;

 573         case PCWATCH:
 574                 size += sizeof (prwatch32_t);
 575                 break;
 576         case PCREAD:
 577         case PCWRITE:
 578                 size += sizeof (priovec32_t);
 579                 break;
 580         case PCSCRED:
 581                 size += sizeof (prcred32_t);
 582                 break;
 583         case PCSCREDX:
 584                 /*
 585                  * We cannot derefence the pr_ngroups fields if it
 586                  * we don't have enough data.
 587                  */
 588                 if (resid < size + sizeof (prcred32_t) - sizeof (gid32_t))
 589                         return (0);
 590                 ngrp = argp->prcred.pr_ngroups;
 591                 if (ngrp < 0 || ngrp > ngroups_max)
 592                         return (0);


 841                                 klwp_t *lwp = ttolwp(t);
 842 
 843                                 thread_unlock(t);
 844                                 mutex_exit(&p->p_lock);
 845                                 prgregset_32ton(lwp, argp->prgregset,
 846                                     prgregset);
 847                                 prsetprregs(lwp, prgregset, 0);
 848                                 mutex_enter(&p->p_lock);
 849                         }
 850                 }
 851                 break;
 852 
 853         case PCSFPREG:  /* set floating-point registers */
 854                 if (PROCESS_NOT_32BIT(p))
 855                         error = EOVERFLOW;
 856                 else
 857                         error = pr_setfpregs32(pnp, &argp->prfpregset);
 858                 break;
 859 
 860         case PCSXREG:   /* set extra registers */

 861                 if (PROCESS_NOT_32BIT(p))
 862                         error = EOVERFLOW;
 863                 else
 864                         error = pr_setxregs(pnp, &argp->prxregset);



 865                 break;
 866 
 867         case PCSVADDR:  /* set virtual address at which to resume */
 868                 if (PROCESS_NOT_32BIT(p))
 869                         error = EOVERFLOW;
 870                 else
 871                         error = pr_setvaddr(pnp,
 872                             (caddr_t)(uintptr_t)argp->vaddr);
 873                 break;
 874 
 875         case PCSHOLD:   /* set signal-hold mask */
 876                 pr_sethold(pnp, &argp->sigset);
 877                 break;
 878 
 879         case PCSFAULT:  /* set mask of traced faults */
 880                 pr_setfault(p, &argp->fltset);
 881                 break;
 882 
 883         case PCCSIG:    /* clear current signal */
 884                 error = pr_clearsig(pnp);


1677 
1678         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
1679                 thread_unlock(t);
1680                 return (EBUSY);
1681         }
1682         if (!prhasfp()) {
1683                 thread_unlock(t);
1684                 return (EINVAL);        /* No FP support */
1685         }
1686 
1687         /* drop p_lock while touching the lwp's stack */
1688         thread_unlock(t);
1689         mutex_exit(&p->p_lock);
1690         prsetprfpregs32(ttolwp(t), prfpregset);
1691         mutex_enter(&p->p_lock);
1692 
1693         return (0);
1694 }
1695 #endif  /* _SYSCALL32_IMPL */
1696 

1697 /* ARGSUSED */
1698 static int
1699 pr_setxregs(prnode_t *pnp, prxregset_t *prxregset)
1700 {
1701         proc_t *p = pnp->pr_common->prc_proc;
1702         kthread_t *t = pr_thread(pnp);  /* returns locked thread */
1703 
1704         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
1705                 thread_unlock(t);
1706                 return (EBUSY);
1707         }
1708         thread_unlock(t);
1709 
1710         if (!prhasx(p))
1711                 return (EINVAL);        /* No extra register support */
1712 
1713         /* drop p_lock while touching the lwp's stack */
1714         mutex_exit(&p->p_lock);
1715         prsetprxregs(ttolwp(t), (caddr_t)prxregset);
1716         mutex_enter(&p->p_lock);
1717 
1718         return (0);
1719 }
1720 
1721 #if defined(__sparc)
1722 static int
1723 pr_setasrs(prnode_t *pnp, asrset_t asrset)
1724 {
1725         proc_t *p = pnp->pr_common->prc_proc;
1726         kthread_t *t = pr_thread(pnp);  /* returns locked thread */
1727 
1728         if (!ISTOPPED(t) && !VSTOPPED(t) && !DSTOPPED(t)) {
1729                 thread_unlock(t);
1730                 return (EBUSY);
1731         }
1732         thread_unlock(t);
1733 
1734         /* drop p_lock while touching the lwp's stack */
1735         mutex_exit(&p->p_lock);
1736         prsetasregs(ttolwp(t), asrset);
1737         mutex_enter(&p->p_lock);
1738 
1739         return (0);
1740 }
1741 #endif