Bochs-2.2
Re:Bochs-2.2
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
Hi,
As an alternative, it's probably easier to use:
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
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.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?
As an alternative, it's probably easier to use:
Code: Select all
push ecx
clr ecx
.zz:
jecxz .zz
pop ecx
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Bochs-2.2
Or, start at line 61 of cpu\proc_ctrl.cc. Look at the following code:
I just changed BX_PANIC to BX_INFO.
Mike
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.
Mike
Re:Bochs-2.2
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.mystran wrote: What do you use CLI;HLT for?
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
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
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
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.
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
Having it PANIC makes it sort of hard to perform "x"/"xp"/"print-stack"... CLI; HLT allows you to just go: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.
Code: Select all
/* ... */
SomethingThatStuffsUpEverythingSomehow();
__asm__ ("cli\n hlt");
The debugger always locks up after the panic for me as well, but I can terminate it by closing the command prompt.