On Wed, Oct 15, 2008 at 5:00 PM, ron minnich rminnich@gmail.com wrote:
On Wed, Oct 15, 2008 at 1:27 PM, Myles Watson mylesgw@gmail.com wrote:
Here's the next part of the log now that I've enabled setup_realmode_idt (I'm running it right before real_mode_switch_call_vga.
Copying VGA ROM image from 0xfe040000 to 0xc0000, 0x8000 bytes BREAK HERE run_bios = 0x0000944a biosint: INT# 0x18 biosint: eax 0x2e ebx 0x10000 ecx 0xfe4 edx 0xcf11c biosint: ebp 0xc0000000 esp 0xd0000 edi 0x1a esi 0x0 biosint: ip 0x1022 cs 0xf flags 0x2067 BIOSINT: Unsupport int #0x18
when you're looking for a misaligned stack frame the registers are always interesting.
Note that edi looks like a 1a.
This code is unchanged for the most part since I wrote it. What you can do is look via gdb at the biosint function and see where it gets the int #. It is unlikely that this is a gcc problem. A misguided directive, on the other hand ...
let's look around:
gdb build/util/x86emu/vm86.o
Dump of assembler code for function biosint: 0x000004f3 <biosint+0>: push %esi 0x000004f4 <biosint+1>: mov %eax,%esi 0x000004f6 <biosint+3>: push %ebx 0x000004f7 <biosint+4>: sub $0x4,%esp 0x000004fa <biosint+7>: movzwl 0x34(%esp),%eax 0x000004ff <biosint+12>: mov 0x30(%esp),%ebx 0x00000503 <biosint+16>: mov %eax,(%esp) 0x00000506 <biosint+19>: push %esi 0x00000507 <biosint+20>: push $0x86 0x0000050c <biosint+25>: push $0x7 0x0000050e <biosint+27>: call 0x50f <biosint+28>
We are passing arg 1 in eax. How could this be?
Simple. We got Clever in v3:
-mregparm=3
A nice optimization that utterly destroys the bios interrupt support.
Myles, try setting -mregparm=0 and see if life is better.
I get a Execution halted due to Stopping SimNow due to unhandled case(s)
EAX=00000001 EBX=000163A8 ECX=80012010 EDX=00000FDC ESI=0000B10D EDI=00000001 ESP=00000F34 EBP=00000020 CS=0010 DS=0018 ES=0018 FS=0018 GS=0018 SS=0018 EFLAGS=oditSzapc GIF=1 ASID=00000000 HCR3=0000000000000000 VMHSAVEPA=0000000000000000 GuestVMCBPA=0000000000000000
0010:FFFFF07D 0000 add [eax],al 0010:FFFFF07F 007000 add [eax+00],dh 0010:FFFFF082 0000 add [eax],al 0010:FFFFF084 0018 add [eax],bl 0010:FFFFF086 01B44800000000 add [eax+ecx*2+00000000],esi 0010:FFFFF08D 0000 add [eax],al 0010:FFFFF08F 007000 add [eax+00],dh 0010:FFFFF092 0000 add [eax],al 0010:FFFFF094 0018 add [eax],bl 0010:FFFFF096 01BC4800000000 add [eax+ecx*2+00000000],edi 0010:FFFFF09D FF
The last output on the serial port is: biosint: INT# 0x1a biosint: eax 0xb102 ebx 0xc002e ecx 0xc2067 edx 0xf1022 biosint: ebp 0xcf0d8 esp 0xfe4 edi 0xd0000 esi 0x10000 biosint: ip 0x3246 cs 0xc000 flags 0x46 dev_find_device: find PCI: 1022:2067 Check Root Device Check CPU: 00 Check APIC: 00 Check PCI: 00:01.0 Check PCI: 1022:7462 Check PCI: 1022:7464 Check PCI: 1022:7464 Check PCI: 1022:7464 Check PCI: 1022:7458 Check PCI: 1022:7468 Check PCI: 1022:7469 Check PCI: 1022:746a Check PCI: 1022:746e Check PCI: 1022:746e Check PCI: 1022:746e Check PCI: 1022:1100 Check PCI: 1022:1100 Check PCI: 00:02.0 Check PCI: 1022:1100 Check PCI: 1022:1101 Check PCI: 1022:1102 Check PCI: 1022:1103 Check IOPORT: 2e Check APIC_CLUSTER: 1022:1100 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PNP: 0000 Check PCI: 1022:7460 Check PCI: 1022:7468 Check PCI: 1022:7469 Check PCI: 1022:746a Check PCI: 1022:746b Check PCI: 1022:746d Check PCI: 1022:746e Check PCI: 1022:746f Check PCI: 1022:7459 Check PCI: 1022:7458 Check PCI: 1022:7459 Check PCI: 1022:7464 Check PCI: 1022:7464 Check PCI: 1022:7463 Check PCI: 1022:7462 Check PCI: 1022:2067 found 0xb102: return 0x120 biosint: INT# 0x1a biosint: eax 0xb108 ebx 0x120 ecx 0xc2067 edx 0xf1022 biosint: ebp 0xcf0d8 esp 0xfe4 edi 0xd000a esi 0x10000 biosint: ip 0x325a cs 0xc000 flags 0x46 0xb108: bus 1 devfn 0x20 reg 0xa val 0x0 biosint: INT# 0x1a biosint: eax 0xb109 ebx 0x120 ecx 0x0 edx 0xf1022 biosint: ebp 0xcf0d8 esp 0xfe4 edi 0xd0008 esi 0x10000 biosint: ip 0x3269 cs 0xc000 flags 0x46 0xb109: bus 1 devfn 0x20 reg 0x8 val 0x3 biosint: INT# 0x1a biosint: eax 0xb10a ebx 0x120 ecx 0x3 edx 0xf1022 biosint: ebp 0xcf0d8 esp 0xfe4 edi 0xd0018 esi 0x10000 biosint: ip 0x3283 cs 0xc000 flags 0x46 0xb10a: bus 1 devfn 0x20 reg 0x18 val 0x1001 biosint: INT# 0x1a biosint: eax 0xb10a ebx 0x120 ecx 0x1000 edx 0xf1022 biosint: ebp 0xcf0d8 esp 0xfe4 edi 0xd0014 esi 0x100b1 biosint: ip 0x3294 cs 0xc000 flags 0x46 0xb10a: bus 1 devfn 0x20 reg 0x14 val 0xfe055000 biosint: INT# 0x1a biosint: eax 0xb10a ebx 0x120 ecx 0xfe055000 edx 0xf1022 biosint: ebp 0xcf0d8 esp 0xfe4 edi 0xd0010 esi 0x100ad biosint: ip 0x32a2 cs 0xc000 flags 0x46 0xb10a: bus 1 devfn 0x20 reg 0x10 val 0xfd000000 biosint: INT# 0x1a biosint: eax 0xb10d ebx 0x120 ecx 0xffffffff edx 0xf1022 biosint: ebp 0xcf0d8 esp 0xfe4 edi 0xd0010 esi 0x100a9 biosint: ip 0x32b3 cs 0xc000 flags 0x46
I vote we get rid of this type of Cleverness. It's just not performance critical in a bios. We're not an OS and we should keep it simple. I don't think we'll live or die on 3 on-stack variables.
ron