Ignore:
Timestamp:
Oct 30, 2008, 1:07:55 PM (11 years ago)
Author:
gb
Message:

In Solaris x8632 version of setup_tcr_extra_segment(), loop until
we find an LDT entry that's free and that we can successfully
allocate (Solaris seems to use or disallow allocation of the first
6 entries by my count.) Mark those entries that can't be allocated
as "in use" in the bitvector.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/thread_manager.c

    r11241 r11245  
    11751175  for (i = 0; i < 8192; i++) {
    11761176    if (!ref_bit(ldt_entries_in_use,i)) {
    1177       break;
    1178     }
    1179   }
    1180   if (i == 8192) {
    1181     pthread_mutex_unlock(&ldt_lock);
    1182     fprintf(stderr, "All 8192 LDT descriptors in use\n");
    1183     _exit(1);
    1184   }
    1185 
    1186   s.sel = (i<<3)|7;
    1187   s.bo = (unsigned int)tcr;
    1188   s.ls = sizeof(TCR);
    1189   s.acc1 = 0xf2;
    1190   s.acc2 = 4;
    1191 
    1192   if (sysi86(SI86DSCR, &s) < 0) {
    1193     pthread_mutex_unlock(&ldt_lock);
    1194     perror("ldt setup");
    1195     _exit(1);
    1196   }
    1197   set_bit(ldt_entries_in_use,i);
    1198   tcr->ldt_selector = (i<<3)|7;
     1177      s.sel = (i<<3)|7;
     1178      s.bo = (unsigned int)tcr;
     1179      s.ls = sizeof(TCR);
     1180      s.acc1 = 0xf2;
     1181      s.acc2 = 4;
     1182
     1183      if (sysi86(SI86DSCR, &s) >= 0) {
     1184        set_bit(ldt_entries_in_use,i);
     1185        tcr->ldt_selector = (i<<3)|7;
     1186        pthread_mutex_unlock(&ldt_lock);
     1187        return;
     1188      }
     1189      set_bit(ldt_entries_in_use,i);
     1190    }
     1191  }
    11991192  pthread_mutex_unlock(&ldt_lock);
     1193  fprintf(stderr, "All 8192 LDT descriptors in use\n");
     1194  _exit(1);
     1195
     1196
    12001197 
    12011198}
Note: See TracChangeset for help on using the changeset viewer.