desc->base2 = (info->base_addr & 0xff000000) >> 24; /* * Don't allow setting of the lm bit. It would confuse * user_64bit_mode and would get overridden by sysret anyway.
*/
desc->l = 0;
}
/* Provide the original GDT */ staticinlinestruct desc_struct *get_cpu_gdt_rw(unsignedint cpu)
{ return per_cpu(gdt_page, cpu).gdt;
}
/* Provide the current original GDT */ staticinlinestruct desc_struct *get_current_gdt_rw(void)
{ return this_cpu_ptr(&gdt_page)->gdt;
}
/* Provide the fixmap address of the remapped GDT */ staticinlinestruct desc_struct *get_cpu_gdt_ro(int cpu)
{ return (struct desc_struct *)&get_cpu_entry_area(cpu)->gdt;
}
/* Provide the current read-only GDT */ staticinlinestruct desc_struct *get_current_gdt_ro(void)
{ return get_cpu_gdt_ro(smp_processor_id());
}
/* Provide the physical address of the GDT page. */ staticinline phys_addr_t get_cpu_gdt_paddr(unsignedint cpu)
{ return per_cpu_ptr_to_phys(get_cpu_gdt_rw(cpu));
}
/* * The LTR instruction marks the TSS GDT entry as busy. On 64-bit, the GDT is * a read-only remapping. To prevent a page fault, the GDT is switched to the * original writeable version when needed.
*/ #ifdef CONFIG_X86_64 staticinlinevoid native_load_tr_desc(void)
{ struct desc_ptr gdt; int cpu = raw_smp_processor_id(); bool restore = 0; struct desc_struct *fixmap_gdt;
/* * If the current GDT is the read-only fixmap, swap to the original * writeable version. Swap back at the end.
*/ if (gdt.address == (unsignedlong)fixmap_gdt) {
load_direct_gdt(cpu);
restore = 1;
} asmvolatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8)); if (restore)
load_fixmap_gdt(cpu);
} #else staticinlinevoid native_load_tr_desc(void)
{ asmvolatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8));
} #endif
/* * LTR requires an available TSS, and the TSS is currently * busy. Make it be available so that LTR will work.
*/
tss.type = DESC_TSS;
write_gdt_entry(d, GDT_ENTRY_TSS, &tss, DESC_TSS);
/* * Call this if you need the TSS limit to be correct, which should be the case * if and only if you have TIF_IO_BITMAP set or you're switching to a task * with TIF_IO_BITMAP set.
*/ staticinlinevoid refresh_tss_limit(void)
{
DEBUG_LOCKS_WARN_ON(preemptible());
if (unlikely(this_cpu_read(__tss_limit_invalid)))
force_reload_TR();
}
/* * If you do something evil that corrupts the cached TSS limit (I'm looking * at you, VMX exits), call this function. * * The optimization here is that the TSS limit only matters for Linux if the * IO bitmap is in use. If the TSS limit gets forced to its minimum value, * everything works except that IO bitmap will be ignored and all CPL 3 IO * instructions will #GP, which is exactly what we want for normal tasks.
*/ staticinlinevoid invalidate_tss_limit(void)
{
DEBUG_LOCKS_WARN_ON(preemptible());
if (unlikely(test_thread_flag(TIF_IO_BITMAP)))
force_reload_TR(); else
this_cpu_write(__tss_limit_invalid, true);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.