To be honest I'm not sure what the problem is - I never get the "unknown instruction" warning (I do get the "HLT with IF=0" problem though).nooooooooos wrote:Is this fault really because of HLT instructions and the dealing of Bochs with them? I don't think so because there is also the instructions-fault, which I can not comment out.
And this is only a warning and should work even if Bochs doesn't like HLT with IF=0...
For "HLT with IF=0", if a CPU disables interrupts and does HLT then the only things that can make it continue are a reset, INIT IPI, NMI or SMI. For single-CPU systems Bochs detects this and (correctly) does a warning, as it's impossible for anything to continue. For multi-CPU this isn't the case - one CPU can do HLT with IF=0 and another CPU can send an INIT IPI to restart the halted CPU.
My BIOS auto-detects the number and type of CPUs that are present. To do this it starts all CPUs, checks how many started, etc, but then needs to stop them running (that's why my BIOS uses HLT with IF=0). If the OS supports SMP it'll issue an INIT IPI to start the halted CPUs when it's ready (as part of the INIT-SIPI-SIPI startup sequence).
The normal Bochs BIOS doesn't work like this - it doesn't know anything about the MPS tables (the emulator generates them before the BIOS is started), which is why the fields for CPU features and CPU signature in the default MPS tables are wrong, and also why you don't get the "HLT with IF-0" problem with the normal Bochs BIOS.
I'm currently downloading the pre-compiled "bochs-2.3.5.exe" from the Bochs web site to see where the invalid opcode problem is coming from. I'll post again after doing some testing...
[EDIT]I downloaded the pre-compiled version of Bochs and installed it on a Windows XP machine here. My BIOS ran without any problems for single-CPU but I couldn't test if SMP worked or not because the pre-compiled version doesn't support SMP at all - I get a ">>PANIC<< numerical parameter 'n_processors' was set to 2, which is out of range 1 to 1".[/EDIT]
Cheers,
Brendan