VOGONS


SoftIce for DOS support

Topic actions

First post, by dosboxer

User metadata
Rank Newbie
Rank
Newbie

Hi all
I've recently discovered DosBox (0.73) for myself and I fall in love
Very nice system, the only thing I"m missing is, well, yes - SoftIce for DOS
I've tried to use the latest DOS version of SI - v2.8
Of course it does not run, so I'd like to put here my investigation.
SI Doc says you have two ways to run it
1) from config.sys - not possible as (AFAIK) no such a section in .conf file
2) from command prompt - just run S-ICE.EXE
the 2nd case closes DosBox without any prompt at all. This forum search lead just to some general ideas that SI uses debug regs DRx that are not supported by DosBox core. OK, if it'd be so, sice shall tell me about this fact, not just crash the whole system!?

Then I've asked myself - what is the reason of sice crash? here are the items done in order to investigate the root reason
a) logs - I've inspected dosbox.log file (that I've asked to create from dosbox-0.73.conf by adding new section as follows:
[log]
logfile=c:\dosbox73.log
Nothing interesting at all
b) inspecting of stdout.txt, stderr.txt files in DosBox installed dir - nothing interesting as well.
c) OK, simple ways are out, time to use some debugger in order to track the issue down. I knew that DosBox could be built as a debug and heavy debug binary, but I'm (still) not familiar with its native debugger, so I've used old good tool named avputil.com (came from old DOS times antivirus named AVP for DOS). It is very small & handy tool to do some RE in DOS
So, using it, I've found what drive DosBox crazy - after executing this command it silently closes itself (crashing):

41B6:0971 MOV CR0, EAX ; EAX content before executing = 0001h

CRx register is so called Control Register.
A control register is a processor register which changes or controls the general behavior of a CPU or other digital device.

OK, CR0 register:
CR0 - contains system control flags that control operating mode and states of the processor.

CR0: |PG|----RESERVED----|ET|TS|EM|MP|PE|
PE: Bit 0. The Protected Environment flag. This flag puts the system into protected mode when set.

In our case we are programming CR0 to have 1, ie - putting CPU into prot. mode that lead to crash.

My questions are:
0) does DosBox supports emulation of CRx regs (or in other words - does it support emulation of protected env. mode)?
1) is it a well-known issue with reprogramming CR0 from applicaiton
2) what could be done in order to support emulation of CR0 reprogramming
3) does someone know other apps/games/tools that work in DosBox and which are using CR0 reg
4) what else could I collect from my PC(info, files, etc) in order to proceed with investigation of the issue?

P.S. I've put core=normal key as it is usually recommended for debugging

Reply 1 of 9, by lightmaster

User metadata
Rank Oldbie
Rank
Oldbie

why softice when you have dosbox debug build???

Reply 2 of 9, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Watch the status window before DOSBox closes.

1+1=10

Reply 3 of 9, by dosboxer

User metadata
Rank Newbie
Rank
Newbie

h-a-l-9000
you are right, before death it wrote something there....
Here is the message from the status window

Exit to error: Illegal descriptor type 0 for int D
does it mean a game over or there are still some chances to handle?
If yes, I'm going to pay some time for deeper investigation
I'm still interested in answers for my 1st post....
Thanks!

Reply 4 of 9, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

OK, if it'd be so, sice shall tell me about this fact, not just crash the whole system!?

You can't detect this, so arbitrary things may happen, yet in the worst case
this *should* be dosbox closing.

0) does DosBox supports emulation of CRx regs

Yes. But your av util may not support tracing mode switches (very vew tools
actually can do this, so better use the dosbox debugger for that).

Reply 5 of 9, by dosboxer

User metadata
Rank Newbie
Rank
Newbie

wd, I agree with you regards DRx regs (AFAIK DRx first appeared in 386 CPU as it was the 1st CPU that supported protected mode, right? and DRx are accessible only from protected mode)

I also agree that avputil.com is not that strong - so what tools were you referring to?

lightmaster (and others)
OK, I've just found some article on native debugger (named "Guide to the DOSBox debugger" from Forum Index :: DOSBox Guides section)
But, I did not found a way to load an executable into debugger, the only way to enter dbg is to press ALT+Pause - right? but I'm not that fast to press it right after I've started .exe, any ideas how to gently start debugging of the target?
Anyway, many thanks for answers and sharing the ideas, good forum, great feeling of friendly atmosphere

Reply 6 of 9, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

debug program.exe

1+1=10

Reply 7 of 9, by dosboxer

User metadata
Rank Newbie
Rank
Newbie

One more question - native debugger - is it a debugger of DosBox itself or it could be used to debug real mode dos app as well?
How could i find the seg:off of my app (imagine I was able to press Alt+Pause while exe is running)

Reply 9 of 9, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

AFAIK DRx first appeared in 386 CPU as it was the 1st CPU that supported protected mode, right? and DRx are accessible only from protected mode

Yes, debug registers are available on 386+ only. But they are available on
all modes, not only pmode (though you need cpl0 to access them).