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

i386: Implement EBL_CR_POWERON MSR for Xbox CPU #1551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thrimbor
Copy link
Contributor

@thrimbor thrimbor commented Nov 2, 2023

This implements reading of the EBL_CR_POWERON MSR, which is documented in chapter 2.22 of Intel's Software Developer's Manual Volume 4. Technically some of its bits are supposed to be writable so this implementation is not entirely accurate, but to my knowledge neither the kernel nor the XDK ever access this MSR.
I intend to use this in nxdk in the future to calculate TSC frequency with perfect accuracy.

The value returned was taken from a stock Xbox CPU.

Testing is simple and can be done with a small nxdk app (might need a #include <intrin.h>):

    uint64_t msr = __readmsr(0x2a);
    debugPrint("MSR 0x2a: 0x%llx\n", msr);

I only implemented it for the TCG backend, I hope that's ok.

@GXTX
Copy link
Contributor

GXTX commented Nov 2, 2023

I intend to use this in nxdk in the future to calculate TSC frequency with perfect accuracy.

I had looked into this before ever playing with timers. The MSR does not accurately report over 10X multiplier. With 1.4GHz CPUs the multiplier is 10.5x. They report 0xCFC40000.

@thrimbor
Copy link
Contributor Author

thrimbor commented Nov 2, 2023

Kinda off-topic, but I already have it implemented and working.

@GXTX
Copy link
Contributor

GXTX commented Nov 3, 2023

Nice! All the docs I could find stop at 10X.

Pentium III Processor in BGA2 and Micro-PGA2 Packages
Linux

As for the PR.
I don't think it's appropriate, nxdk apps will assume an incorrect frequency based on this and (likely, I haven't seen your code) the FSB register, however xemu manually sets this via this.

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

Successfully merging this pull request may close these issues.

None yet

2 participants