Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/os/archdep.c
          +++ new/usr/src/uts/intel/os/archdep.c
↓ open down ↓ 407 lines elided ↑ open up ↑
 408  408          dmc->gregs[REG_SS] = (greg_t)(uint32_t)smc->gregs[SS];
 409  409  
 410  410          /*
 411  411           * A valid fpregs is only copied in if uc.uc_flags has UC_FPU set
 412  412           * otherwise there is no guarantee that anything in fpregs is valid.
 413  413           */
 414  414          if (src->uc_flags & UC_FPU)
 415  415                  fpregset_32ton(&src->uc_mcontext.fpregs,
 416  416                      &dst->uc_mcontext.fpregs);
 417  417  
      418 +        /*
      419 +         * Copy the brand-private data:
      420 +         */
      421 +        dst->uc_brand_data[0] = (void *)(uintptr_t)src->uc_brand_data[0];
      422 +        dst->uc_brand_data[1] = (void *)(uintptr_t)src->uc_brand_data[1];
      423 +        dst->uc_brand_data[2] = (void *)(uintptr_t)src->uc_brand_data[2];
      424 +
 418  425          if (src->uc_flags & UC_XSAVE) {
 419  426                  dst->uc_xsave = (long)(uint32_t)src->uc_xsave;
 420  427          } else {
 421  428                  dst->uc_xsave = 0;
 422  429          }
 423  430  }
 424  431  
 425  432  #endif  /* _SYSCALL32_IMPL */
 426  433  
 427  434  /*
↓ open down ↓ 39 lines elided ↑ open up ↑
 467  474   */
 468  475  
 469  476  #if defined(IS_CS) || defined(IS_NOT_CS)
 470  477  #error  "IS_CS and IS_NOT_CS already defined"
 471  478  #endif
 472  479  
 473  480  #define IS_CS           1
 474  481  #define IS_NOT_CS       0
 475  482  
 476  483  /*ARGSUSED*/
 477      -static greg_t
      484 +greg_t
 478  485  fix_segreg(greg_t sr, int iscs, model_t datamodel)
 479  486  {
      487 +        kthread_t *t = curthread;
      488 +
 480  489          switch (sr &= 0xffff) {
 481  490  
 482  491          case 0:
 483  492                  if (iscs == IS_CS)
 484  493                          return (0 | SEL_UPL);
 485  494                  else
 486  495                          return (0);
 487  496  
 488  497          /*
 489  498           * If lwp attempts to switch data model then force their
↓ open down ↓ 11 lines elided ↑ open up ↑
 501  510          /*FALLTHROUGH*/
 502  511          case UDS_SEL:
 503  512          case LWPFS_SEL:
 504  513          case LWPGS_SEL:
 505  514          case SEL_UPL:
 506  515                  return (sr);
 507  516          default:
 508  517                  break;
 509  518          }
 510  519  
      520 +        /*
      521 +         * Allow this process's brand to do any necessary segment register
      522 +         * manipulation.
      523 +         */
      524 +        if (PROC_IS_BRANDED(t->t_procp) && BRMOP(t->t_procp)->b_fixsegreg) {
      525 +                greg_t bsr = BRMOP(t->t_procp)->b_fixsegreg(sr, datamodel);
      526 +
      527 +                if (bsr == 0 && iscs == IS_CS)
      528 +                        return (0 | SEL_UPL);
      529 +                else
      530 +                        return (bsr);
      531 +        }
      532 +
 511  533          /*
 512  534           * Force it into the LDT in ring 3 for 32-bit processes, which by
 513  535           * default do not have an LDT, so that any attempt to use an invalid
 514  536           * selector will reference the (non-existant) LDT, and cause a #gp
 515  537           * fault for the process.
 516  538           *
 517  539           * 64-bit processes get the null gdt selector since they
 518  540           * are not allowed to have a private LDT.
 519  541           */
 520  542          if (datamodel == DATAMODEL_ILP32) {
↓ open down ↓ 627 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX