Project

General

Profile

Emulator Issues #10269

Race condition with libogc and IOS reloads

Added by leoetlino over 3 years ago.

Status:
Accepted
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Dolphin has a race condition with IOS reloads which causes the reloadtest homebrew to fail and just hang forever on "waiting for IOS version number to be set".

Here's what happens on console:

  • PPC asks IOS to reload into the new IOS (ES_Launch)
  • After X amount of time (non-deterministic), IOS starts handling the ioctlv, parsing TMDs, tickets, checking the boot content, etc.
  • PPC clears the IOS version at 0x3140
  • IOS is still busy handling the launch request.
  • PPC waits for the old IOS to write the version for the new IOS to 0x3140
  • IOS writes the new version number so that the new IOS knows what version it is. The kernel then loads the new kernel to memory and branches to its entry point.
  • PPC waits for IOS to send an IPC ack
  • The new IOS kernel sends an IPC ack as it starts up.
  • PPC reinits IPC, IOS subsystems -- launch complete

On Dolphin, the timeline is a bit different:

  • PPC asks IOS to reload into the new IOS (ES_Launch)
  • IOS immediately starts handling the ioctlv, parsing TMDs, tickets, checking the boot content, etc.
  • IOS writes the new version number to 0x3140. The new IOS kernel is then initialised. The launch has completed on the IOS side -- but not on the PPC side.
  • PPC clears the IOS version at 0x3140
  • PPC waits for the old IOS to write the version for the new IOS to 0x3140, which never happens because IOS has already finished launching the new one. The PPC remains absolutely unaware of this.

A possible fix for this would be a CoreTiming to schedule the version write for slightly later. But a more generic way to fix this, along with other IOS issues (slowdowns, timing) would be threaded IOS emulation, where we could then easily delay the IOS thread to emulate launch processing time while still running the PPC emulation.

Also available in: Atom PDF