Print this page
104 Bring back lx brand

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/ia32/os/archdep.c
          +++ new/usr/src/uts/intel/ia32/os/archdep.c
↓ open down ↓ 620 lines elided ↑ open up ↑
 621  621  #error  "IS_CS and IS_NOT_CS already defined"
 622  622  #endif
 623  623  
 624  624  #define IS_CS           1
 625  625  #define IS_NOT_CS       0
 626  626  
 627  627  /*ARGSUSED*/
 628  628  static greg_t
 629  629  fix_segreg(greg_t sr, int iscs, model_t datamodel)
 630  630  {
      631 +        kthread_t *t = curthread;
      632 +
 631  633          switch (sr &= 0xffff) {
 632  634  
 633  635          case 0:
 634  636                  if (iscs == IS_CS)
 635  637                          return (0 | SEL_UPL);
 636  638                  else
 637  639                          return (0);
 638  640  
 639  641  #if defined(__amd64)
 640  642          /*
↓ open down ↓ 15 lines elided ↑ open up ↑
 656  658          /*FALLTHROUGH*/
 657  659          case UDS_SEL:
 658  660          case LWPFS_SEL:
 659  661          case LWPGS_SEL:
 660  662          case SEL_UPL:
 661  663                  return (sr);
 662  664          default:
 663  665                  break;
 664  666          }
 665  667  
      668 +        /*
      669 +         * Allow this process's brand to do any necessary segment register
      670 +         * manipulation.
      671 +         */
      672 +        if (PROC_IS_BRANDED(t->t_procp) && BRMOP(t->t_procp)->b_fixsegreg) {
      673 +                greg_t bsr = BRMOP(t->t_procp)->b_fixsegreg(sr, datamodel);
      674 +
      675 +                if (bsr == 0 && iscs == IS_CS)
      676 +                        return (0 | SEL_UPL);
      677 +                else
      678 +                        return (bsr);
      679 +        }
      680 +
 666  681          /*
 667  682           * Force it into the LDT in ring 3 for 32-bit processes, which by
 668  683           * default do not have an LDT, so that any attempt to use an invalid
 669  684           * selector will reference the (non-existant) LDT, and cause a #gp
 670  685           * fault for the process.
 671  686           *
 672  687           * 64-bit processes get the null gdt selector since they
 673  688           * are not allowed to have a private LDT.
 674  689           */
 675  690  #if defined(__amd64)
↓ open down ↓ 833 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX