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 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