Skip to content

ppc: Model configurable CPU frequencies - #209

Merged
dingusdev merged 1 commit into
dingusdev:masterfrom
mihaip:codex/tiger
Aug 14, 2026
Merged

ppc: Model configurable CPU frequencies#209
dingusdev merged 1 commit into
dingusdev:masterfrom
mihaip:codex/tiger

Conversation

@mihaip

@mihaip mihaip commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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)

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)

@dingusdev dingusdev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very nice commit which cleans up the virtual timer. A small bonus is the nicer CPU initialization.

@dingusdev
dingusdev merged commit c6c48ef into dingusdev:master Aug 14, 2026
7 checks passed
@mihaip

mihaip commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

(was reverted due to x86-64 performance issues, will try again)

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.

2 participants