VOGONS


First post, by william_p

User metadata
Rank Newbie
Rank
Newbie

Hello,

I need to change the way dosbox remember the "Big" bit of the code segment between switchs from protected mode and real mode.
So I ask where should I look to change this behavior (in the source code) and test with my test cases which doesn't work in dosbox currently ?

Some precisions :
Currently, in dosbox, the code segment becomes 16 bits each time we go to real mode from protected mode, without any condition.
Some programs do this :
- prepare a gdt with code selector in 32 bits mode (big bit set)
- jump to protected mode
- load the gdt
- load the selector into cs
- jump back to real mode, without reloading cs. (the cached hidden bits of the segment register remain the same)

In this case, the cpu must remain in 32 bits mode (for code). even if the cpu is back in real mode.

I know this because I coded , long time ago, a "dos extender" which used this trick to run 32 bits code in real mode (even faster than 32 bits protected mode). This extender was used into some demo my group made, and I would like to see it with dosbox...

So where is the best code location to change this ? Or what documentation should I read, where?

Reply 1 of 4, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

cpu.cpp
I thought this long flat/unreal mode was supported though.

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 4, by william_p

User metadata
Rank Newbie
Rank
Newbie

Thank you,

I'll try to change things in this file.

Dosbox supports Flat unReal Mode (*data* segments with 4GB limits).
This real mode which permits to run 32 bits *code* is different :

In protected mode, I load CS with a code selector where the 'D' Bit (bit 54) is set.
I switch back to realmode without reloading CS.
Then, the opcodes at CS:IP should be interpreted as in 32 bits mode.

The 'D' bit means: 0 = 16 bits code (use16), 1 = 32 bits code (use32).

Reply 3 of 4, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I think this has come up before regarding the Project Angel demo. The patch here may be effective in this case.

Reply 4 of 4, by william_p

User metadata
Rank Newbie
Rank
Newbie

I read the thread and this is exactly what I was talking about.
I'll try the patch or something else in cpu.cpp & report results
Thank you very much