Lines Matching defs:ldt

45  * In skas mode, we hold our own ldt data in UML.
48 * for arch/i386/kernel/ldt.c
60 uml_ldt_t *ldt = &current->mm->context.arch.ldt;
62 if (!ldt->entry_count)
68 mutex_lock(&ldt->lock);
69 if (ldt->entry_count <= LDT_DIRECT_ENTRIES) {
73 if (copy_to_user(ptr, ldt->u.entries, size))
79 for (i=0; i<ldt->entry_count/LDT_ENTRIES_PER_PAGE && bytecount;
84 if (copy_to_user(ptr, ldt->u.pages[i], size)) {
92 mutex_unlock(&ldt->lock);
114 * So, we don't really have a default ldt, but emulate
115 * an empty ldt of common host default ldt size.
125 uml_ldt_t *ldt = &current->mm->context.arch.ldt;
149 mutex_lock(&ldt->lock);
155 if (ldt_info.entry_number >= ldt->entry_count &&
157 for (i=ldt->entry_count/LDT_ENTRIES_PER_PAGE;
161 memcpy(&entry0, ldt->u.entries,
163 ldt->u.pages[i] = (struct ldt_entry *)
165 if (!ldt->u.pages[i]) {
173 memcpy(ldt->u.pages[0], &entry0,
175 memcpy(ldt->u.pages[0]+1, ldt->u.entries+1,
178 ldt->entry_count = (i + 1) * LDT_ENTRIES_PER_PAGE;
181 if (ldt->entry_count <= ldt_info.entry_number)
182 ldt->entry_count = ldt_info.entry_number + 1;
184 if (ldt->entry_count <= LDT_DIRECT_ENTRIES)
185 ldt_p = ldt->u.entries + ldt_info.entry_number;
187 ldt_p = ldt->u.pages[ldt_info.entry_number/LDT_ENTRIES_PER_PAGE] +
204 mutex_unlock(&ldt->lock);
236 struct ldt_entry * ldt;
253 ldt = (struct ldt_entry *)
255 if (ldt == NULL) {
257 "for host ldt\n");
261 ret = modify_ldt(0, ldt, (1<<order)*PAGE_SIZE);
263 printk(KERN_ERR "ldt_get_host_info: couldn't read host ldt\n");
273 if (ldt[i].a != 0 || ldt[i].b != 0)
284 "host ldt list\n");
291 if (ldt[i].a != 0 || ldt[i].b != 0)
297 free_pages((unsigned long)ldt, order);
309 mutex_init(&new_mm->arch.ldt.lock);
314 * Now we try to retrieve info about the ldt, we
315 * inherited from the host. All ldt-entries found
326 new_mm->arch.ldt.entry_count = 0;
337 mutex_lock(&from_mm->arch.ldt.lock);
338 if (from_mm->arch.ldt.entry_count <= LDT_DIRECT_ENTRIES)
339 memcpy(new_mm->arch.ldt.u.entries, from_mm->arch.ldt.u.entries,
340 sizeof(new_mm->arch.ldt.u.entries));
342 i = from_mm->arch.ldt.entry_count / LDT_ENTRIES_PER_PAGE;
349 new_mm->arch.ldt.u.pages[i] =
351 memcpy(new_mm->arch.ldt.u.pages[i],
352 from_mm->arch.ldt.u.pages[i], PAGE_SIZE);
355 new_mm->arch.ldt.entry_count = from_mm->arch.ldt.entry_count;
356 mutex_unlock(&from_mm->arch.ldt.lock);
367 if (mm->arch.ldt.entry_count > LDT_DIRECT_ENTRIES) {
368 i = mm->arch.ldt.entry_count / LDT_ENTRIES_PER_PAGE;
370 free_page((long) mm->arch.ldt.u.pages[i]);
372 mm->arch.ldt.entry_count = 0;