[SeaBIOS] Bochs cvs + SeaBIOS git master + FreeDOS = slow load + invalid opcode

Sebastian Herbszt herbszt at gmx.de
Sun Jan 10 15:59:22 CET 2010


Kevin O'Connor wrote:
> On Sat, Jan 09, 2010 at 07:48:51PM +0100, Sebastian Herbszt wrote:
>> I have tried SeaBIOS 0.5.1 on Bochs cvs with FreeDOS 1.0 Final boot floppy.
>> Loading from floppy was utterly slow and then FreeDOS dumped
>> 
>> Invalid Opcode at 0013 0000 0202 800F 01F3 20F4 10AA 10AA 109A 0000 0000 0000 00

(0) Breakpoint 2, 0x0000000000000010 in ?? ()
Next at t=4522611939
(0) [0x00000010] 0000:0010 (unk. ctxt): push bx                   ; 53
<bochs:12> disasm /5
00000010: (                    ): push bx                   ; 53
00000011: (                    ): inc word ptr ds:[bx+si]   ; ff00
00000013: (                    ): lock push bx              ; f053
00000015: (                    ): inc word ptr ds:[bx+si]   ; ff00
00000017: (                    ): lock ret 0xd110           ; f0c210d1

(0) [0x0002112e] 20f4:01ee (unk. ctxt): call far 0000:0010        ; 9a10000000

and 0x20f4 is SS

> I saw this as well.  I bisected it to this commit:
> 
> ee2efa7303077ce98a745f637e213ba9a0965811
> 
> and if I apply the following change, it fixes the problem on bochs:
> 
> --- a/src/util.h
> +++ b/src/util.h
> @@ -39,7 +39,7 @@ static inline void cpu_relax(void)
> // Atomically enable irqs and sleep until an irq; then re-disable irqs.
> static inline void wait_irq(void)
> {
> -    asm volatile("sti ; hlt ; cli ; cld": : :"memory");
> +    asm volatile("sti ; rep ; nop ; cli ; cld": : :"memory");
> }
> 
> static inline void nop(void)
> 
> However, I didn't think there was anything wrong with the original
> code.  Am I missing something?

It should be ok. Your replacement uses PAUSE which can cause VM exits.

- Sebastian




More information about the SeaBIOS mailing list