/* * Caller must have pmap locked for both of these functions. */ void ldt_alloc(struct pmap *pmap, union descriptor *ldt, size_t len) { int slot; slot = gdt_get_slot1(1); cpu_info_primary.ci_gdt[slot].ld.ld_base = (u_int32_t)ldt; cpu_info_primary.ci_gdt[slot].ld.ld_entries = len / sizeof(union descriptor); pmap->pm_ldt_sel = GSEL(slot, SEL_KPL); }
/* * Caller must have pmap locked for both of these functions. */ int ldt_alloc(union descriptor *ldtp, size_t len) { int slot; #ifndef XEN slot = gdt_get_slot(); setgdt(slot, ldtp, len - 1, SDT_SYSLDT, SEL_KPL, 0, 0); #else slot = gdt_get_slot1(1); cpu_info_primary.ci_gdt[slot].ld.ld_base = (uint32_t)ldtp; cpu_info_primary.ci_gdt[slot].ld.ld_entries = len / sizeof(union descriptor); #endif return GSEL(slot, SEL_KPL); }
int gdt_get_slot() { return gdt_get_slot1(0); }
int gdt_get_slot(void) { return gdt_get_slot1(0); }