Page 1 of 1
Bochs-2.2
Posted: Tue May 31, 2005 2:01 am
by Curufir
Released 28th of May.
Figured it might be useful to point out. The changelog shows quite a few bugs squashed so it's probably worth your while to update if you use Bochs for development.
Re:Bochs-2.2
Posted: Tue May 31, 2005 6:48 am
by AR
Downloaded the source and built but I'm having a little problem - cli; hlt; no longer works (causes a PANIC). Have I just used a bad commandline option or is there an option to revert this or am I going to have to hack the code?
Re:Bochs-2.2
Posted: Tue May 31, 2005 8:48 am
by Brendan
Hi,
AR wrote:
Downloaded the source and built but I'm having a little problem - cli; hlt; no longer works (causes a PANIC). Have I just used a bad commandline option or is there an option to revert this or am I going to have to hack the code?
The "cli; hlt" sequence stopped working with version 2.2 (and all of it's pre-releases). There is no command line (or ./configure script) options for it, so you'd need to hack the code.
As an alternative, it's probably easier to use:
Code: Select all
push ecx
clr ecx
.zz:
jecxz .zz
pop ecx
Then, when you think your OS has reached this point you'd do "control+C", then type in "set $ecx = 1" and step through it like normal...
Cheers,
Brendan
Re:Bochs-2.2
Posted: Tue May 31, 2005 5:19 pm
by oswizard
Or, start at line 61 of cpu\proc_ctrl.cc. Look at the following code:
Code: Select all
void BX_CPU_C::HLT(bxInstruction_c *i)
{
// hack to panic if HLT comes from BIOS
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value == 0xf000)
BX_PANIC(("HALT instruction encountered in the BIOS ROM"));
if (CPL!=0) {
exception(BX_GP_EXCEPTION, 0, 0);
return;
}
if (! BX_CPU_THIS_PTR get_IF ()) {
//BX_PANIC(("WARNING: HLT instruction with IF=0!"));
BX_INFO(("WARNING: HLT instruction with IF=0!"));
}
// stops instruction execution and places the processor in a
// HALT state. An enabled interrupt, NMI, or reset will resume
// execution. If interrupt (including NMI) is used to resume
// execution after HLT, the saved CS:eIP points to instruction
// following HLT.
I just changed BX_PANIC to BX_INFO.
Mike
Re:Bochs-2.2
Posted: Wed Jun 01, 2005 2:58 pm
by mystran
What do you use CLI;HLT for?
Re:Bochs-2.2
Posted: Wed Jun 01, 2005 5:03 pm
by Curufir
mystran wrote:
What do you use CLI;HLT for?
It's way to set an effective breakpoint in Bochs when using the debugger (At least prior to 2.2). The emulator hits the CLI/HLT instructions and just stops. You can then halt the simulation and check out whatever values you like (Assuming #IF isn't what you're checking). When you restart the simulation the instruction following HLT will be executed.
Of course you could always set a breakpoint in Bochs, but it's often handier to just throw a CLI/HLT after the function you're interested in without needing to figure out addresses.
There are plenty of alternatives if it no longer works.
Re:Bochs-2.2
Posted: Wed Jun 01, 2005 7:35 pm
by Slasher
I've just tried out the CLI;HLT combination in Bochs 2.2 and IT STILL WORKS
It might be a problem with the os being tested.
p.s.
in my bochsrc.txt file under Log controls i use this setting for panic
panic: action=report
Re:Bochs-2.2
Posted: Fri Jun 03, 2005 4:40 pm
by mystran
Hmmh.. if I want a breakpoint in bochs I'm happy to have it panic, since if somethings wrong badly enough for my OS code to fail to display it's own debug dump, then the bochs register trace is about the best I would hope to get.
But then again, that's probably because Bochs debugger refuses to work with me, causing bochs to hang indefinitely on every PANIC so that I have to kill -9 it, if the debugger is compiled in.
Re:Bochs-2.2
Posted: Fri Jun 03, 2005 9:35 pm
by AR
Having it PANIC makes it sort of hard to perform "x"/"xp"/"print-stack"... CLI; HLT allows you to just go:
Code: Select all
/* ... */
SomethingThatStuffsUpEverythingSomehow();
__asm__ ("cli\n hlt");
Then when it gets there you Ctrl+C for the debug prompt and inspect the memory, I'll probably use Brendan's method now though.
The debugger always locks up after the panic for me as well, but I can terminate it by closing the command prompt.