[coreboot] Question about call LegacyBIOS in the memory(GSoC__SCSI boot)

Zhang Rui zrfail at gmail.com
Wed Jun 25 08:53:03 CEST 2008


LegacyBIOS could be added to coreboot.rom by lar tool now. I modified
the Makefile in arch/x86
I am now a little lost in x86emu of coreboot v3. And I have some
questions. Please help me.

1. What is the address of post() in LegacyBIOS?
>> and then how can we call the post() function?
> Well, that will require some work.  :-)  Take a look at how the build
> exports the assembler stub "post32" (in post.c) - which calls _start()
> (also in post.c).
    ".global post32\n"
    "lidtl " __stringify(0xf0000 | OFFSET_pmode_IDT_info) "\n"
    "lgdtl " __stringify(0xf0000 | OFFSET_rombios32_gdt_48) "\n"
    "movl $" __stringify(BUILD_STACK_ADDR) ", %esp\n"
    "ljmp $0x10, $_start\n"

According to these asm codes, we should load the idt and gdt and set
the stack point esp before we jump to the start() function. But these
codes are in LegacyBIOS, so "_start" can be used to present the
address of start(). How can I call post outside LegacyBIOS but just
use the bios.bin file(copied to 0xf0000)? Can this function have a
fixed address? or is there another approach?

2. How to modify the post() method in LegacyBIOS?
post() will auto boot the system at the end. But we want it return to
coreboot. So what is the boot code at the end of the function? Is


    dprintf(1, "Scan for option roms\n");
    rom_scan(0xc8000, 0xe0000);

May be we could write another funcion post_noboot() without the boot
code and have a fixed address?

3. How to get the address of idt of LegacyBIOS?
    "lidtl " __stringify(0xf0000 | OFFSET_pmode_IDT_info) "\n"
    "lgdtl " __stringify(0xf0000 | OFFSET_rombios32_gdt_48) "\n"
    "movl $" __stringify(BUILD_STACK_ADDR) ", %esp\n"

I noticed that OFFSET_pmode_IDT_info is defined in
rom16.offset.auto.h. But this header file is generated in building
process and I do not find the rule for it in the Makefile. So I want
to know how can I get the value of OFFSET_pmode_IDT_info? So do
OFFSET_rombios32_gdt_48 and BUILD_STACK_ADDR.

Kevin, could you help me with these three questions? Thanks.

4. Where is the entrance call of util/x86emu in coreboot v3?
There are several x86EMU_XXX function exported in e86emu.h. But they
are called only in run_bios() in biosemu.c. I placed a printk at the
beginning of run_bios() but it seems not executed. How does the codes
in util/x86emu used?
Where is the entrance call of util/x86emu in coreboot v3? Where should
I place the code to extract LegacyBIOS to the memory? Should I write a
new function and export it?

Stefan, could you help me with this question? Thanks.

Best regards.

Zhang Rui

More information about the coreboot mailing list