From 495ae152e9f68a51b8746a95668c282ed190c694 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Mon, 8 Apr 2002 17:13:26 +0000 Subject: [PATCH] Works, needs more support --- src/arch/i386/lib/hardwaremain.c | 29 +++++++++++++++++------------ src/arch/i386/lib/idt.c | 25 ++++++++++++++++++++----- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/arch/i386/lib/hardwaremain.c b/src/arch/i386/lib/hardwaremain.c index 43a956930f..549cf4d99b 100644 --- a/src/arch/i386/lib/hardwaremain.c +++ b/src/arch/i386/lib/hardwaremain.c @@ -277,18 +277,6 @@ void hardwaremain(int boot_complete) pci_enable(); post_code(0x89); - // it's not clear where I should do this. We'll try here. - // Seems to be ok in practice. -#if CONFIG_REALMODE_IDT == 1 - printk_debug("INSTALL REAL-MODE IDT\n"); - setup_realmode_idt(); -#endif -#if CONFIG_VGABIOS == 1 - printk_debug("DO THE VGA BIOS\n"); - do_vgabios(); - post_code(0x90); -#endif - // generic mainboard fixup mainboard_fixup(); @@ -332,6 +320,20 @@ void hardwaremain(int boot_complete) /* make certain we are the only cpu running in linuxBIOS */ wait_for_other_cpus(); + // we do this right here because: + // - all the hardware is working, and some VGA bioses seem to need + // that + // - we need page 0 below for linuxbios tables. +#if CONFIG_REALMODE_IDT == 1 + printk_debug("INSTALL REAL-MODE IDT\n"); + setup_realmode_idt(); +#endif +#if CONFIG_VGABIOS == 1 + printk_debug("DO THE VGA BIOS\n"); + do_vgabios(); + post_code(0x93); +#endif + /* Now that we have collected all of our information * write our configuration tables. */ @@ -347,3 +349,6 @@ void hardwaremain(int boot_complete) } + + + diff --git a/src/arch/i386/lib/idt.c b/src/arch/i386/lib/idt.c index 5bc230720f..c89c5253e1 100644 --- a/src/arch/i386/lib/idt.c +++ b/src/arch/i386/lib/idt.c @@ -49,7 +49,7 @@ __asm__ __volatile__ ( "callbiosint16:\n" // clean up the int #. To save space we put it in the lower // byte. But the top 24 bits are junk. - "andl $0xffffff00, %eax\n" + "andl $0xff, %eax\n" // this push does two things: // - put the INT # on the stack as a parameter // - provides us with a temp for the %cr0 mods. @@ -115,7 +115,8 @@ __asm__ __volatile__ ( enum { - PCIBIOS = 0x1a + PCIBIOS = 0x1a, + MEMSIZE = 0x12 }; #ifdef CONFIG_PCIBIOS int @@ -161,14 +162,28 @@ biosint( intnumber, eax, ebx, ecx, edx); printk_debug("biosint: ebp 0x%lx esp 0x%lx edi 0x%lx esi 0x%lx\n", ebp, esp, edi, esi); printk_debug("biosint: ip 0x%x cs 0x%x flags 0x%x\n", ip, cs, flags); + // cases in a good compiler are just as good as your own tables. + switch (intnumber) { #ifdef CONFIG_PCIBIOS - if (intnumber == PCIBIOS) - ret = pcibios( &edi, &esi, &ebp, &esp, &ebx, &edx, &ecx, &eax, &flags); + case PCIBIOS: + ret = pcibios( &edi, &esi, &ebp, &esp, + &ebx, &edx, &ecx, &eax, &flags); + break; +#endif + case MEMSIZE: + // who cares. + eax = 64 * 1024; + ret = 0; + break; + default: + printk_info(__FUNCTION__ ": Unsupport int #0x%x\n", + intnumber); + break; + } if (ret) flags |= 1; // carry flags else flags &= ~1; -#endif stackflags = flags; return ret; }