xemu icon indicating copy to clipboard operation
xemu copied to clipboard

i386: Implement EBL_CR_POWERON MSR for Xbox CPU

Open thrimbor opened this issue 1 year ago • 3 comments

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.

thrimbor avatar Nov 02 '23 02:11 thrimbor

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.

GXTX avatar Nov 02 '23 09:11 GXTX

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

thrimbor avatar Nov 02 '23 23:11 thrimbor

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.

GXTX avatar Nov 03 '23 00:11 GXTX

Hi, how was the multipliers >10X confirmed?

GXTX avatar Aug 21 '24 12:08 GXTX