Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 95 EMM386.EXE V86 monitor does not allow RDTSC instruction #30

Open
joncampbell123 opened this issue Oct 16, 2017 · 7 comments
Open
Assignees
Labels

Comments

@joncampbell123
Copy link
Owner

Here's a disappointing revelation.

Apparently Windows 95's EMM386.EXE doesn't like it when 16-bit DOS applications try to use RDTSC. It seems to hang the system (or perhaps it's in an infinite Invalid Opcode exception loop). 32-bit DOS programs (under DOS4GW/DOS32) are not affected.

I would like to know if this has been a consistent problem across MS-DOS through Windows 98 SE, or if it's just the particular version of Windows 95 I'm testing right now (4.0.1111 Windows 95 SP1).

Until then, I'm going to have to have RDTSC-related code disable itself unless known versions of MS-DOS and EMM386.EXE are running :(

@joncampbell123 joncampbell123 self-assigned this Oct 16, 2017
@joncampbell123
Copy link
Owner Author

I can confirm that if I manually enter the RDTSC opcode in DOS DEBUG and try to single-step it, that the system hangs in the same way.

@joncampbell123
Copy link
Owner Author

Because of this issue, the CPU library now has a flag to indicate not to use the RDTSC instruction. For now, that flag is set if the build is 16-bit and virtual 8086 mode is active.

@joncampbell123
Copy link
Owner Author

I will update that code to not set the flag if it can recognize whether or not the v86 monitor permits RDTSC. Perhaps FreeDOS has a better implementation. Perhaps MS-DOS 6.22 and earlier don't have this issue, or perhaps Microsoft fixed this in Windows 98 DOS mode. I'll need to test this.

@joncampbell123
Copy link
Owner Author

This was observed on an old Pentium 133MHz test system with Windows 95 DOS mode on a CF card.

@joncampbell123
Copy link
Owner Author

TODO: Which MSR controls whether user-space can access RDTSC, by the way? I understand there's another one for whether or not user-space can use CPUID.

@joncampbell123
Copy link
Owner Author

@darkstar
Copy link

The P133 does not support rdtsc in v86 mode: http://www.os2museum.com/wp/undocumented-rdtsc/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants