Skip to content

ppcexec: Emulate PowerPC sleep on MSR POW#186

Merged
dingusdev merged 1 commit into
dingusdev:masterfrom
mihaip:upstream-ppc-power-save
Jul 2, 2026
Merged

ppcexec: Emulate PowerPC sleep on MSR POW#186
dingusdev merged 1 commit into
dingusdev:masterfrom
mihaip:upstream-ppc-power-save

Conversation

@mihaip

@mihaip mihaip commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

xnu-123.5 and similar vintage kernls enter the PowerPC 750 power save mode when the scheduler has no runnable work. machine_idle_ppc selects HID0 doze or nap, records a nap timestamp, then executes mtmsr with MSR[POW] set. It stays in a loop there (in case the power saving had no effect immediately) - it expects execution to resume at the machine_idle_ret label (when an interrupt occurs), which ends up returning from the function.

We model this state explicitly:

  • When mtmsr sets MSR[POW] with the HID0 doze/nap/sleep flags, set a new EXEF_SLEEP flag.
  • While EXEF_SLEEP is set, keep processing host events without advancing the guest PC.

Towards getting the 10.0 public beta to boot (#154) - before this we would enter the DPPC debugger shortly after this instruction (due to a bogus MSR LE flag eventually being set). Now we make more progress and end up in a "Still waiting for root device" loop (presumably something at the ATA layer)

xnu-123.5 and similar vintage kernls enter the PowerPC 750 powersave mode
when the scheduler has no runnable work. `machine_idle_ppc` selects HID0
doze or nap, records a nap timestamp, then executes mtmsr with MSR[POW]
set. It stays in a loop there (in case the power saving had no effect
immediately) - it expects execution to resume at the `machine_idle_ret`
label (when an interrupt occurs), which ends up returning from the
function.

We model this state explicitly:
- When mtmsr sets MSR[POW] with the HID0 doze/nap/sleep flags, set a new
  EXEF_SLEEP flag.
- When EXEF_SLEEP is set, keep processing host events without advancing
  the guest PC.

Towards getting the 10.0 public beta to boot (dingusdev#154) - before this we
would enter the DPPC debugger shortly after this instruction (due to a
bogus MSR LE flag eventually being set). Now we make more progress and
end up in a "Still waiting for root device" loop (presumably something
at the ATA layer)
@dingusdev dingusdev merged commit 79a06c5 into dingusdev:master Jul 2, 2026
7 checks passed
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