Print this page
Bring back LX zones.

@@ -630,10 +630,12 @@
 
 /*ARGSUSED*/
 static greg_t
 fix_segreg(greg_t sr, int iscs, model_t datamodel)
 {
+        kthread_t *t = curthread;
+        
         switch (sr &= 0xffff) {
 
         case 0:
                 if (iscs == IS_CS)
                         return (0 | SEL_UPL);

@@ -666,10 +668,23 @@
         default:
                 break;
         }
 
         /*
+         * Allow this process's brand to do any necessary segment register
+         * manipulation.
+         */
+        if (PROC_IS_BRANDED(t->t_procp) && BRMOP(t->t_procp)->b_fixsegreg) {
+                greg_t bsr = BRMOP(t->t_procp)->b_fixsegreg(sr, datamodel);
+
+                if (bsr == 0 && iscs == IS_CS)
+                        return (0 | SEL_UPL);
+                else
+                        return (bsr);
+        }
+
+        /*
          * Force it into the LDT in ring 3 for 32-bit processes, which by
          * default do not have an LDT, so that any attempt to use an invalid
          * selector will reference the (non-existant) LDT, and cause a #gp
          * fault for the process.
          *