[coreboot] SeaBIOS question and cross compilation fix.
Stefan Reinauer
stepan at coresystems.de
Sat Nov 8 21:50:34 CET 2008
Stefan Reinauer wrote:
> Hi, Kevin,
>
> I am experimenting with v3 and better integration of SeaBIOS and
> coreboot. For that, I am copying a SeaBIOS image to the FSEG during
> coreboot's VGA init code. In addition I added another 32bit entry point
> to SeaBIOS at 0xffc0 (Thus, living at 0xfffc0)
>
> int copy_systembios(void)
> {
> struct mem_file archive, result;
> int ret;
> init_archive(&archive);
> ret = find_file(&archive, "bios.bin", &result);
> if (ret) {
> printk(BIOS_WARNING, "No legacy bios found.\n");
> return -1;
> }
> process_file(&result, (void *)0xf0000);
> return 0;
> }
>
> void run_bios(struct device *dev, unsigned long addr)
> {
> int i;
> void (*init_systembios)(void) = (void *)0xfffc0;
> copy_systembios();
> init_systembios();
> real_mode_switch_call_vga((dev->bus->secondary << 8) |
> dev->path.pci.devfn);
> }
>
> Now, the entry point looks like this:
> diff -ur -x .git seabios2/src/romlayout.S seabios/src/romlayout.S
> --- seabios2/src/romlayout.S 2008-11-06 15:46:44.000000000 +0100
> +++ seabios/src/romlayout.S 2008-11-01 11:38:06.000000000 +0100
> @@ -544,6 +544,18 @@
> ORG 0xff54
> IRQ_ENTRY_ARG 05
>
> +.code32
> + ORG 0xffc0 // coreboot Entry Point
> + mov $0x3f8, %dx
> + mov $0x44, %al
> + outb %al, %dx // print
> + call _code32__init
> + mov $0x3f8, %dx
> + mov $0x45, %al
> + outb %al, %dx
> + ret
> +.code16gcc
Ok, thanks for your hint with the gdb debugging in qemu. This is quite nice.
(gdb) disas 0xfffc0 0xfffd4
Dump of assembler code from 0xfffc0 to 0xfffd4:
0x000fffc0: mov $0x3f8,%dx
0x000fffc4: mov $0x44,%al
0x000fffc6: out %al,(%dx)
0x000fffc7: call 0x1e2617
0x000fffcc: mov $0x3f8,%dx
0x000fffd0: mov $0x45,%al
0x000fffd2: out %al,(%dx)
0x000fffd3: ret
The call is actually interpreted as a call to 0x1e2617 instead of a call
to 0xf2617. Not sure where the 0x1e instead of the 0xf comes from.
out stepan$ i386-elf-nm rom.o |grep _init
000f2617 A _code32__init
000f2617 T _init
ndisasm translates the same assembler code from above as follows:
0000FFC0 66BAF803 mov dx,0x3f8
0000FFC4 B044 mov al,0x44
0000FFC6 EE out dx,al
0000FFC7 E84B260E00 call 0xf2617
0000FFCC 66BAF803 mov dx,0x3f8
0000FFD0 B045 mov al,0x45
0000FFD2 EE out dx,al
0000FFD3 C3 ret
so it looks like ndisasm and I made the same mistake, while qemu
interprets the code sequence differently.
Any hints?
--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.de • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20081108/0f907095/attachment.sig>
More information about the coreboot
mailing list