Hello,
Thanks for the hints.
El 16/04/15 a les 3.43, Kevin O'Connor ha escrit:
On Wed, Apr 15, 2015 at 07:31:21PM +0200, Roger Pau Monné wrote:
Hello,
I've compiled SeaBIOS on FreeBSD with gcc48, and although the build process succeeds, the resulting binary doesn't fully work. Most functions seem to work fine but there are some int15h functions that don't work properly (ie: they return invalid values).
I've compiled SeaBIOS with CONFIG_DEBUG_LEVEL=10 and got the following output (this is from the Xen console):
I'd be careful with debug level 10 - I've seen the high debugging cause issues. I usually don't go above 8. Alternatively, you can decrease the individual debug levels in src/config.h .
Instead of setting debug level to 10, I've set it to 2 and lowered DEBUG_HDL_15 to 1 also, but I still get the same bogus output:
[...] (d8) enter handle_15: (d8) a=00008600 b=00000000 c=00000000 d=0000c350 ds=4cf0 es=9eb8 ss=df80 (d8) si=00000004 di=00000000 bp=00000000 sp=0000fa06 cs=0000 ip=9336 f=0242 (d8) enter handle_15: (d8) a=00008600 b=00000000 c=00000000 d=0000c350 ds=4cf0 es=9eb8 ss=df80 (d8) si=00000004 di=00000000 bp=00000000 sp=0000fa06 cs=0000 ip=9336 f=0242 (XEN) irq.c:386: Dom8 callback via changed to Direct Vector 0x93 (XEN) irq.c:276: Dom8 PCI link 0 changed 5 -> 0 (XEN) irq.c:276: Dom8 PCI link 1 changed 10 -> 0 (XEN) irq.c:276: Dom8 PCI link 2 changed 11 -> 0 (XEN) irq.c:276: Dom8 PCI link 3 changed 5 -> 0 (d8) enter handle_15:
[...] (d4) enter handle_1a: (d4) a=00000200 b=00000000 c=00001725 d=00003400 ds=4cf0 es=9eb8 ss=dd00 (d4) si=00000004 di=00000000 bp=00000000 sp=0000fe66 cs=0000 ip=9336 f=0242 (d4) enter handle_1a: (d4) a=00000200 b=00000000 c=00001725 d=00003400 ds=4cf0 es=9eb8 ss=dd00 (d4) si=00000004 di=00000000 bp=00000000 sp=0000fe66 cs=0000 ip=9336 f=0242 (d4) enter handle_1a: (d4) a=00000200 b=00000000 c=00001725 d=00003400 ds=4cf0 es=9eb8 (XEN) irq.c:386: Dom4 callback via changed to Direct Vector 0x93 (XEN) irq.c:276: Dom4 PCI link 0 changed 5 -> 0 (XEN) irq.c:276: Dom4 PCI link 1 changed 10 -> 0 (XEN) irq.c:276: Dom4 PCI link 2 changed 11 -> 0 (XEN) irq.c:276: Dom4 PCI link 3 changed 5 -> 0 (d4) enter handle_15:
And that's all, there's no line containing the register values. I'm quite lost at figuring what's going on, so any help about how to proceed in order to debug this is highly appreciated.
In situations like the above, I run qemu with "-d in_asm,int,exec,cpu" and redirect the output to some log file. I then look through the log to see where things went wrong.
If you know which "int 15h" is returning bogus values, you can also use gdb with qemu and set a break point. See http://seabios.org/Debugging .
I've tried this, the function is handle_15c0. This happens quite late in the boot process, the FreeBSD code that triggers this issue is at:
http://fxr.watson.org/fxr/source/dev/atkbdc/atkbd.c#L1163
I've tried to run gdb against SeaBIOS, but it seems like breakpoints are not correctly working. I've launched Qemu with:
# qemu-system-x86_64 -bios out/bios.bin -nographic /dev/zvol/tank/freebsd -s -S
And then:
# gdb782 out/rom16.o GNU gdb (GDB) 7.8.2 [GDB v7.8.2 for FreeBSD] Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-portbld-freebsd11.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from out/rom16.o...done. (gdb) set architecture i8086 warning: A handler for the OS ABI "FreeBSD ELF" is not built into this configuration of GDB. Attempting to continue with the default i8086 settings.
The target architecture is assumed to be i8086 (gdb) add-symbol-file out/rom16.o 0xf0000 add symbol table from file "out/rom16.o" at .text_addr = 0xf0000 (y or n) y Reading symbols from out/rom16.o...warning: section .text not found in /root/xen/seabios/out/rom16.o done. (gdb) break handle_15c0 Breakpoint 1 at 0xf16f: file ./src/system.c, line 247. (gdb) break handle_15 Breakpoint 2 at 0xf0fc: file ./src/system.c, line 336. (gdb) target remote localhost:1234 Remote debugging using localhost:1234 ?? () at src/romlayout.S:651 651 ljmpw $SEG_BIOS, $entry_post (gdb) c Continuing.
And nothing more, FreeBSD boots but breakpoints don't trigger at all. I've tried this both with the working and non-working versions of SeaBIOS, and the behaviour is always the same.
Roger.