Page 1 of 1

Bochs panics even with just minimal boot code

Posted: Wed Oct 15, 2014 11:34 am
by jrhetf4xb
Hi,

I started using Bochs in order to get some more CPU information because VirtualBox doesn't help me much (that's what I've used so far). And to my surprise Bochs panics the same way irrespective of what code I supply it with. The error I get is always this:

Code: Select all

Event type: PANIC
Device: [CPU0 ]
Message: prefetch: getHostMemAddr vetoed direct read, pAddr=0x00000000000a4ede
I've stripped down my bootloader code to just this piece:

Code: Select all

.code16
.section .text
    .globl boot0

boot0:
    cli
    jmp halt
        
  halt:
    jmp halt
And I still get the error! I've had no issues with VirtualBox so far...

And here is a piece of the log file, the last line (LOCK prefix etc.) starts getting repeated thousands of times after it, including many more:

Code: Select all

00000000000i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000
00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00000000000i[CPU0 ] CPUID[0x00000001]: 00000f23 00000800 00002000 07cbfbff
00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000001 2a100800
00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000
00000000000i[PLGIN] reset of 'unmapped' plugin device by virtual method
00000000000i[PLGIN] reset of 'biosdev' plugin device by virtual method
00000000000i[PLGIN] reset of 'speaker' plugin device by virtual method
00000000000i[PLGIN] reset of 'extfpuirq' plugin device by virtual method
00000000000i[PLGIN] reset of 'gameport' plugin device by virtual method
00000000000i[PLGIN] reset of 'pci_ide' plugin device by virtual method
00000000000i[PLGIN] reset of 'acpi' plugin device by virtual method
00000000000i[PLGIN] reset of 'ioapic' plugin device by virtual method
00000000000i[PLGIN] reset of 'keyboard' plugin device by virtual method
00000000000i[PLGIN] reset of 'harddrv' plugin device by virtual method
00000000000i[PLGIN] reset of 'serial' plugin device by virtual method
00000000000i[PLGIN] reset of 'parallel' plugin device by virtual method
00000000000i[PLGIN] reset of 'sb16' plugin device by virtual method
00000032737i[CPU0 ] LOCK prefix unallowed (op1=0x2, modrm=0x00)
Could someone help me with this?

Re: Bochs panics even with just minimal boot code

Posted: Wed Oct 15, 2014 12:02 pm
by Octocontrabass
Why isn't Bochs running its BIOS?

Re: Bochs panics even with just minimal boot code

Posted: Wed Oct 15, 2014 12:10 pm
by jrhetf4xb
Octocontrabass wrote:Why isn't Bochs running its BIOS?
Sorry, I don't understand. Is this a request to provide some of my files (configuration)? :D
The log file says the BIOS should be loaded...

Code: Select all

00000000000i[MEM0 ] allocated memory at 0xb42ad008. after alignment, vector=0xb42ae000
00000000000i[MEM0 ] 32.00MB
00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32
00000000000i[MEM0 ] rom at 0xe0000/131072 ('/usr/share/bochs/BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/40448 ('/usr/share/vgabios/vgabios.bin')

Re: Bochs panics even with just minimal boot code

Posted: Wed Oct 15, 2014 1:01 pm
by xenos
Which Bochs version are you using, what is the command line and what does your (full) bochsrc file look like? It would also be helpful to see the full log output (except for the repeated line).

Re: Bochs panics even with just minimal boot code

Posted: Wed Oct 15, 2014 4:10 pm
by jrhetf4xb
Bochs version is 2.4.6
I attached the src and log files

Re: Bochs panics even with just minimal boot code

Posted: Wed Oct 15, 2014 4:28 pm
by Octocontrabass
Bochs is executing garbage instead of the BIOS. Normally, the BIOS will print several diagnostic strings to the log while it executes. Are you sure /usr/share/bochs/BIOS-bochs-latest exists and is the correct file?

Additionally, that version of Bochs is over 3 years old. You should consider updating to a newer version.

Re: Bochs panics even with just minimal boot code

Posted: Wed Oct 15, 2014 7:09 pm
by Brendan
Hi,
jrhetf4xb wrote:Bochs version is 2.4.6
I attached the src and log files
Try changing this:

Code: Select all

romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xe0000
To this:

Code: Select all

romimage: file=/usr/share/bochs/BIOS-bochs-latest
Even for Bochs, I think the firmware should be loaded just below 0x0000000100000000 (just like in a modern real computer) and not just below 0x00100000 (like an ancient 8086). Fortunately Bochs is able to figure out the size of the ROM and calculate the address itself, so you don't need to (unless you're doing something very strange).


Cheers,

Brendan

Re: Bochs panics even with just minimal boot code

Posted: Thu Oct 16, 2014 6:19 am
by jrhetf4xb
It works now, thank you!

As for updating to a newer version, I'm using a Linux image I was supplied with for VirtualBox and it had this version of Bochs installed. Will definitely update as soon as I understand how to do it (new Linux user here)...

Re: Bochs panics even with just minimal boot code

Posted: Thu Oct 16, 2014 8:07 am
by seuti
jrhetf4xb wrote:new Linux user here
If you are running it in a Virtual Machine, take snapshots before you do something so then you can revert to them if something goes wrong.
The best way to learn is just by trying it, and when you can't figure it out just try Google.