Bochs debugger with SMP

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
escortkeel
Posts: 9
Joined: Mon Jan 28, 2013 4:46 am
Location: Canberra, Australia
Contact:

Bochs debugger with SMP

Post by escortkeel »

Hi there! I think I'm missing something really obvious so hopefully the solution to my problem should be real-quick!

I'm firing up bochs in SMP mode and immediately I've got a problem. With 8 cores, I get the following debugger print:

Code: Select all

00000000000i[PLUGIN] reset of 'extfpuirq' plugin device by virtual method
00000000000i[PLUGIN] reset of 'parallel' plugin device by virtual method
00000000000i[PLUGIN] reset of 'serial' plugin device by virtual method
00000000000i[PLUGIN] reset of 'gameport' plugin device by virtual method
00000000000i[PLUGIN] reset of 'iodebug' plugin device by virtual method
00000000000i[PLUGIN] reset of 'usb_uhci' plugin device by virtual method
00000000000d[KBD   ] PS/2 mouse disabled
00000000000i[      ] set SIGINT handler to bx_debug_ctrlc_handler
Next at t=0
(0) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(1) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(2) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(3) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(4) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(5) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(6) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(7) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
00000000000d[KBD   ] PS/2 mouse disabled
<bochs:1> c
Next at t=5
(0) [0x0000000fe063] f000:e063 (unk. ctxt): out 0xd6, al              ; e6d6
(1) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(2) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(3) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(4) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(5) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(6) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(7) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
00000000005d[KBD   ] PS/2 mouse disabled
<bochs:2> c
Next at t=10
(0) [0x0000000fe06d] f000:e06d (unk. ctxt): in al, 0x71               ; e471
(1) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(2) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(3) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(4) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(5) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(6) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
(7) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b          ; ea5be000f0
00000000010d[KBD   ] PS/2 mouse disabled
<bochs:3> 

As you can see, execution randomly halts after I tell it to resume! This keeps happening infinitely, with a few lines being executed at a time. I tried to get around this problem by executing "step 10000000000" with the hope that it should just continue execution almost forever, which almost works, except that the bochs bios crashes a few million instructions in, with "PANIC: Keyboard error:21". When I comment out the debugger and disassembler options passed to the configure script, the whole thing works perfectly. (I've compiled bochs myself from SVN) using the following options:

Code: Select all

./configure \
  --enable-smp \
  --enable-x86-64 \
  --enable-long-phy-address \
  --enable-configurable-msrs \
  --enable-debugger \
  --enable-fpu \
  --enable-alignment-check \
  --enable-3dnow \
  --enable-monitor-mwait \
  --enable-svm \
  --enable-vmx=2 \
  --enable-avx \
  --enable-evex \
  --enable-perfmon \
  --enable-memtype \
  --enable-x86-debugger \
  --enable-a20-pin \
  --enable-ne2000 \
  --enable-e1000 \
  --enable-pci \
  --enable-clgd54xx \
  --enable-voodoo \
  --enable-usb \
  --enable-usb-ohci \
  --enable-usb-xhci \
  --enable-cdrom \
  --enable-sb16 \
  --enable-es1370 \
  --enable-gameport \
  --enable-busmouse \
  --enable-iodebug \
  --enable-large-ramfile \
  --enable-show-ips \
  --with-all-libs
Everything also works if I pass cpu: count=1 instead of cpu: count=8 in bochsrc.txt (reproduced below):

Code: Select all

display_library: sdl2

cpu: count=8

clock: sync=realtime, time0=local

romimage: file=../../bochs/bios/BIOS-bochs-latest
vgaromimage: file=../../bochs/bios/VGABIOS-lgpl-latest

magic_break: enabled=1
port_e9_hack: enabled=1

debug: keyboard=report

boot: cdrom
ata0-master: type=cdrom, path="cdrom.iso", status=inserted
Does anyone have any idea what the problem might be? Any help would be greatly appreciated. :)
I'm Keeley Hoek. | Homepage | K-OS on GitHub
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Bochs debugger with SMP

Post by stlw »

I will try to look if I can reproduce your issue.
Can you tell which Bochs version you use ?
Also, did you try to less than 8 CPUs configured ? Only 2 ?

This looks from your description that Bochs debugger is SMP mode only advances t=5 cycles and returns from continue command.
If it is the case I should be able to reproduce it here.

Thanks,
Stanislav
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Bochs debugger with SMP

Post by SpyderTL »

Does it always break on IN/OUT instructions? If so, that might be a hint into what is going on...
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Bochs debugger with SMP

Post by stlw »

SpyderTL wrote:Does it always break on IN/OUT instructions? If so, that might be a hint into what is going on...
Confirmed the problem with 'continue' command.
It was caused by one of the recent reworks in Bochs debugger.
I will try to fix it.
For now the 'step 1000000' workaround could be used, it seems like working for me.

Stanislav
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Bochs debugger with SMP

Post by stlw »

I reverted incorrect changes from few weeks ago which broke the SMP support in debugger.
The SVN should be okay now.
Please report about any potential issue.

Stanislav
Post Reply