ppc: Model configurable CPU frequencies - #210
Draft
mihaip wants to merge 2 commits into
Draft
Conversation
The `page_start` variable is not needed, we can get the same information (for the end of execution block comparison) from `eb_end`. This keeps one fewer value live across each opcode invocation. On x86-64 it removes one register spill/reload pair from the execution loop.
Virtual time previously advanced by a fixed 16 ns per interpreted
instruction, making every CPU behave like the legacy 62.5 MHz model
regardless of the selected machine. G3 guests also received ad hoc HID1
values from individual machine implementations, while Gazelle supported
several frequencies that could not share that logic.
Require each machine to provide its hardware-appropriate bus, core, and
timebase clocks through one `PPC_CPU_Config` configuration object. We can then
derive things from it (e.g. supported MPC603ev and MPC750 HID1 PLL encodings).
We can also populate the `include_601` global based on `version` instead of a
separate flag.
To model time with more flexibility, we now use 60.4 fixed-point nanoseconds for
instruction timing. This lets us have a broad set of frequencies and still
support running the CPU for ~35 years of virtual time before it overflows.
This results in two emulation accuracy improvements:
- Tiger successfully gets to the Finder. The virtual time we were exposing to
the guest was advancing too quickly, preventing loginwindow from connecting
before WindowServer's internal five-second no-client timer expired.
The server then exited normally, loginwindow aborted when it could not
establish its CoreGraphics connection, and we remained stuck at the last
textual output from a verbose boot ("Waiting for IFC").
- Animations are now more accurate (e.g. Mac OS X dock icon bouncing is no
longer too fast on a G3)
This behavior is opt-in, configured by the `--cpu-timing=per-machine`
flag. This way host machines that cannot keep up with the new timing are
not forced to use it, since that makes the perceived performance worse.
mihaip
marked this pull request as draft
August 15, 2026 16:40
Contributor
Author
|
(converting to draft, will think if there's a less invasive way of getting Tiger to boot) |
Contributor
|
What's wrong with the proposed changes? |
Contributor
|
A |
Contributor
Author
|
@joevt this adds some complexity (and a new execution mode), hence my second thoughts. |
Contributor
|
So it's not a performance issue? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Virtual time previously advanced by a fixed 16 ns per interpreted instruction, making every CPU behave like the legacy 62.5 MHz model regardless of the selected machine. G3 guests also received ad hoc HID1 values from individual machine implementations, while Gazelle supported several frequencies that could not share that logic.
Require each machine to provide its hardware-appropriate bus, core, and timebase clocks through one
PPC_CPU_Configconfiguration object. We can then derive things from it (e.g. supported MPC603ev and MPC750 HID1 PLL encodings). We can also populate theinclude_601global based onversioninstead of a separate flag.To model time with more flexibility, we now use 60.4 fixed-point nanoseconds for instruction timing. This lets us have a broad set of frequencies and still support running the CPU for ~35 years of virtual time before it overflows.
This results in two emulation accuracy improvements:
This behavior is opt-in, configured by the
--cpu-timing=per-machineflag. This way host machines that cannot keep up with the new timing are not forced to use it, since that makes the perceived performance worse (main difference from the version in #209).To also make the new variable access in the
ppc_exec_innerloop be net-neutral in terms of x86-64 register allocation, there is a small optimization to remove the unnecessarypage_startvariable.For #194