/* * Disable all interrupts at the legacy PIC.
*/ staticvoid mask_all_interrupts(void)
{
outb(0xff, 0xa1); /* Mask all interrupts on the secondary PIC */
io_delay();
outb(0xfb, 0x21); /* Mask all but cascade on the primary PIC */
io_delay();
}
/* * Reset IGNNE# if asserted in the FPU.
*/ staticvoid reset_coprocessor(void)
{
outb(0, 0xf0);
io_delay();
outb(0, 0xf1);
io_delay();
}
staticvoid setup_gdt(void)
{ /* There are machines which are known to not boot with the GDT
being 8-byte unaligned. Intel recommends 16 byte alignment. */ staticconst u64 boot_gdt[] __attribute__((aligned(16))) = { /* CS: code, read/execute, 4 GB, base 0 */
[GDT_ENTRY_BOOT_CS] = GDT_ENTRY(DESC_CODE32, 0, 0xfffff), /* DS: data, read/write, 4 GB, base 0 */
[GDT_ENTRY_BOOT_DS] = GDT_ENTRY(DESC_DATA32, 0, 0xfffff), /* TSS: 32-bit tss, 104 bytes, base 4096 */ /* We only have a TSS here to keep Intel VT happy;
we don't actually use it for anything. */
[GDT_ENTRY_BOOT_TSS] = GDT_ENTRY(DESC_TSS32, 4096, 103),
}; /* Xen HVM incorrectly stores a pointer to the gdt_ptr, instead of the gdt_ptr contents. Thus, make it static so it will stay in memory, at least long enough that we switch to the
proper kernel GDT. */ staticstruct gdt_ptr gdt;
/* * Set up the IDT
*/ staticvoid setup_idt(void)
{ staticconststruct gdt_ptr null_idt = {0, 0}; asmvolatile("lidtl %0" : : "m" (null_idt));
}
/* * Actual invocation sequence
*/ void go_to_protected_mode(void)
{ /* Hook before leaving real mode, also disables interrupts */
realmode_switch_hook();
/* Enable the A20 gate */ if (enable_a20()) {
puts("A20 gate not responding, unable to boot...\n");
die();
}
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.