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