- build an additional BIOS image without the new 32-bit extensions. It can be

used when the new BIOS fails
- use wbinvd instruction in the 32-bit init code
This commit is contained in:
Volker Ruppert 2006-10-03 20:30:09 +00:00
parent 8c350ca092
commit 9d0f111995
5 changed files with 26 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -57,7 +57,7 @@ BIOS_BUILD_DATE = "-DBIOS_BUILD_DATE=\"$(BUILDDATE)\""
$(CXX) -c $(BX_INCDIRS) $(CXXFLAGS) $(LOCAL_CXXFLAGS) @CXXFP@$< @OFP@$@
bios: biossums BIOS-bochs-latest
bios: biossums BIOS-bochs-latest BIOS-bochs-legacy
clean:
@RMCOMMAND@ *.o *.a *.s _rombios*_.c rombios*.txt rombios*.sym
@ -70,7 +70,18 @@ dist-clean: clean
bios-clean:
@RMCOMMAND@ BIOS-bochs-*
rombios16.bin: rombios.c apmbios.S biossums
BIOS-bochs-legacy: rombios.c apmbios.S biossums rombios.h
$(GCC) $(BIOS_BUILD_DATE) -DLEGACY -E -P $< > _rombiosl_.c
$(BCC) -o rombiosl.s -C-c -D__i86__ -0 -S _rombiosl_.c
sed -e 's/^\.text//' -e 's/^\.data//' rombiosl.s > _rombiosl_.s
$(AS86) _rombiosl_.s -b tmp.bin -u- -w- -g -0 -j -O -l rombiosl.txt
-perl ${srcdir}/makesym.perl < rombiosl.txt > rombiosl.sym
mv tmp.bin $@
./biossums $@
@RMCOMMAND@ _rombiosl_.s
rombios16.bin: rombios.c apmbios.S biossums rombios.h
$(GCC) $(BIOS_BUILD_DATE) -E -P $< > _rombios_.c
$(BCC) -o rombios.s -C-c -D__i86__ -0 -S _rombios_.c
sed -e 's/^\.text//' -e 's/^\.data//' rombios.s > _rombios_.s
@ -81,7 +92,7 @@ rombios16.bin: rombios.c apmbios.S biossums
@RMCOMMAND@ _rombios_.s
rombios32.bin: rombios32.out
rombios32.bin: rombios32.out rombios.h
objcopy -O binary $< $@
./biossums -pad $@

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rombios.h,v 1.2 2006-10-01 16:39:18 vruppert Exp $
// $Id: rombios.h,v 1.3 2006-10-03 20:27:30 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2006 Volker Ruppert
@ -21,7 +21,11 @@
/* define it to include QEMU specific code */
//#define BX_QEMU
#define BX_ROMBIOS32 1
#ifndef LEGACY
# define BX_ROMBIOS32 1
#else
# define BX_ROMBIOS32 0
#endif
#define DEBUG_ROMBIOS 0
#define PANIC_PORT 0x400

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rombios32.c,v 1.7 2006-10-02 20:29:09 vruppert Exp $
// $Id: rombios32.c,v 1.8 2006-10-03 20:27:30 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// 32 bit Bochs BIOS init code
@ -45,6 +45,8 @@ typedef unsigned long long uint64_t;
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) \
: "0" (index))
#define wbinvd() asm volatile("wbinvd")
#define CPUID_APIC (1 << 9)
#define APIC_BASE ((uint8_t *)0xfee00000)
@ -591,6 +593,7 @@ static void bios_lock_shadow_ram(void)
PCIDevice *d = &i440_pcidev;
int v;
wbinvd();
v = pci_config_readb(d, 0x59);
v = (v & 0x0f) | (0x10);
pci_config_writeb(d, 0x59, v);
@ -645,7 +648,7 @@ static void smm_init(PCIDevice *d)
outb(0xb3, 0x01);
/* raise an SMI interrupt */
outb(0xb2, 0x01);
outb(0xb2, 0x00);
/* wait until SMM code executed */
while (inb(0xb3) != 0x00);
@ -656,6 +659,7 @@ static void smm_init(PCIDevice *d)
/* copy the SMM code */
memcpy((void *)0xa8000, &smm_code_start,
&smm_code_end - &smm_code_start);
wbinvd();
/* close the SMM memory window and enable normal SMM */
pci_config_writeb(&i440_pcidev, 0x72, 0x02 | 0x08);