VOGONS


First post, by smeezekitty

User metadata
Rank Oldbie
Rank
Oldbie

Ok. Here goes.

Many times when running newer windows versions on my 486, some newer software
dies with illegal instruction requiring pentium or pentium mmx instructions.

I was wondering if it would be possible to write an emulation driver that would
catch those illegal instructions and emulate them. I know it would be slow but that is besides the point.

I know next to nothing about windows driver development.

Any insight on if this is possible.

Last edited by smeezekitty on 2014-06-03, 05:46. Edited 1 time in total.

Reply 1 of 17, by Harekiet

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yeh I'd assume this would be possible, install a custom interrupt handler on the illegal opcode exception, detect the opcode and run it in software. If they'd use lot's of pentium instructions afterwards it would be dog slow though 😀

Reply 2 of 17, by mr_bigmouth_502

User metadata
Rank Oldbie
Rank
Oldbie

It would be interesting to see something like this for SSE2 instructions, especially on an Athlon XP or Pentium III system.

Reply 3 of 17, by gandhig

User metadata
Rank Member
Rank
Member
mr_bigmouth_502 wrote:

It would be interesting to see something like this for SSE2 instructions, especially on an Athlon XP or Pentium III system.

+1 😀
I will be more than happy to chip in with contributions(to my best) and ready to dust up my programming skills, if an expert jumps on the bandwagon.

Dosbox SVN r4019 + savestates Build (Alpha)
1st thread & the only one related to the forum(?)...warning about modern-retro combo
Dead, but, Personal Favourite
Replacement for Candy Crush...Train the Brain

Reply 4 of 17, by mwdmeyer

User metadata
Rank Oldbie
Rank
Oldbie

I think this is a clever idea but I suspect it wouldn't be easy to do!

Vogons Wiki - http://vogonswiki.com

Reply 5 of 17, by smeezekitty

User metadata
Rank Oldbie
Rank
Oldbie

I know something about programming but not driver development. Otherwise I would be working on it right now

Yeh I'd assume this would be possible, install a custom interrupt handler on the illegal opcode exception, detect the opcode and run it in software. If they'd use lot's of pentium instructions afterwards it would be dog slow though 😀

But there are some programs that use just enough P5+ instructions to not work. It shouldn't impact those too much.

It would be interesting to see something like this for SSE2 instructions, especially on an Athlon XP or Pentium III system.

Once the framework is in place, it should be possible to emulate almost any instruction

Reply 6 of 17, by smeezekitty

User metadata
Rank Oldbie
Rank
Oldbie

I observed the most common faulting instructions seems to be rdtsc. I wonder why it is used so much?

Reply 7 of 17, by Harekiet

User metadata
Rank DOSBox Author
Rank
DOSBox Author

It's a nice high resolution timer.

Reply 10 of 17, by smeezekitty

User metadata
Rank Oldbie
Rank
Oldbie

Some progress. I confirmed the binary driver on that page installs on Win2K atleast on my 486 without crashing.
I am now in the progress of installing the MS DDK. See how that goes

Reply 11 of 17, by smeezekitty

User metadata
Rank Oldbie
Rank
Oldbie

I need help.
This is the initial test handler. Keeping it simple, all its suppose to do is skip CPUID

The problem is I cannot figure out how to return to execution past the illegal instruction.

I run a test program that executes CPUID and trying different things either the program crashes
or the whole OS BSoDs

__declspec(naked) void illegal_operand_handler (void) { 
__asm{
push ebp
mov ebp, esp
pushad
pushfd
push ds
mov ds, ax
mov esi, [ebp+4]
cld
lods byte ptr [esi]
cmp al, 0xf
je handle_0xf
GoPrevTrap01:
pop ds
popfd
popad
pop ebp
jmp dword ptr [prevIllegalOpHandler]

handle_0xf:
lods byte ptr [esi] //Find out what the faulting instruction is
cmp al, 0xA2
jne not_cpuid
add dword ptr [ebp+3], 4
pop ds
popfd
popad
pop ebp
iretd
not_cpuid:
jmp short GoPrevTrap01
};
}

Reply 12 of 17, by Deepika

User metadata
Rank Newbie
Rank
Newbie

Dear All,

Dosbox.exe does not support running a third party exe with arguments.
May someone let me know how to use exe with arguments in Dosbox.

Also, When i tried to debug the source code of dosbox application that i downloaded from the below site has 343 errors. some of the errors for reference.

http://www.dosbox.com/wiki/Building_DOSBox_wi … _C_2008_Express

1.error C2143: syntax error : missing ';' before '*' sdlmain.cpp
2.error C3861: 'SDL_WM_SetCaption': identifier not found sdlmain.cpp
3.error C4430: missing type specifier - int assumed. Note: C++ does not support default-int sdlmain.cpp
4.error C2039: 'overlay' : is not a member of 'SDL_Block' sdlmain.cpp

Thanks
Deepika

Reply 13 of 17, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
Deepika wrote:
Dear All, […]
Show full quote

Dear All,

Dosbox.exe does not support running a third party exe with arguments.
May someone let me know how to use exe with arguments in Dosbox.

Also, When i tried to debug the source code of dosbox application that i downloaded from the below site has 343 errors. some of the errors for reference.

http://www.dosbox.com/wiki/Building_DOSBox_wi … _C_2008_Express

1.error C2143: syntax error : missing ';' before '*' sdlmain.cpp
2.error C3861: 'SDL_WM_SetCaption': identifier not found sdlmain.cpp
3.error C4430: missing type specifier - int assumed. Note: C++ does not support default-int sdlmain.cpp
4.error C2039: 'overlay' : is not a member of 'SDL_Block' sdlmain.cpp

Thanks
Deepika

You should start a new thread rather than replying to an unrelated thread.

You may notice all those errors relate to sdlmain.cpp. This suggests that you may not have the SDL libraries installed correctly.

The only way to start an executable within DOSBox via command-line arguments when DOSBox is started is to use multiple instances of the "-c" switch to mount the appropriate directories and launch the appropriate executable.

Reply 14 of 17, by gerwin

User metadata
Rank l33t
Rank
l33t
smeezekitty wrote:

I observed the most common faulting instructions seems to be rdtsc. I wonder why it is used so much?

RDTSC is sampled twice to measure the actual CPU speed in MHz. Though multi-core and speedstep configurations now complicate this process.

--> ISA Soundcard Overview // Doom MBF 2.04 // SetMul

Reply 15 of 17, by smeezekitty

User metadata
Rank Oldbie
Rank
Oldbie

Ok progress.
It is now able to skip certain bad instructions

Working on emulation now.

Reply 16 of 17, by Gypsum Thirty

User metadata
Rank Newbie
Rank
Newbie

BUMP!

I know this is an older post, but I have been for looking ages for an SSE2 driver that would emulate SSE2 instructions on WinXP so small or simple programs that require it can run on older computers.

Was progress ever made here?

Reply 17 of 17, by smeezekitty

User metadata
Rank Oldbie
Rank
Oldbie
Gypsum Thirty wrote:

BUMP!

I know this is an older post, but I have been for looking ages for an SSE2 driver that would emulate SSE2 instructions on WinXP so small or simple programs that require it can run on older computers.

Was progress ever made here?

SSE3 is pretty complicated. IIRC, I was able to catch and handle missing instructions. But my ISR skills were lacking to implement things like rdtsc