ppcexec: Emulate PowerPC sleep on MSR POW#186
Merged
Conversation
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)
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.
xnu-123.5 and similar vintage kernls enter the PowerPC 750 power save mode when the scheduler has no runnable work.
machine_idle_ppcselects HID0 doze or nap, records a nap timestamp, then executesmtmsrwithMSR[POW]set. It stays in a loop there (in case the power saving had no effect immediately) - it expects execution to resume at themachine_idle_retlabel (when an interrupt occurs), which ends up returning from the function.We model this state explicitly:
mtmsrsetsMSR[POW]with theHID0doze/nap/sleep flags, set a newEXEF_SLEEPflag.EXEF_SLEEPis 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)