Skip to content

Execute ARM64 service gates with Android thread slots - #4

Closed
thehobbit85 wants to merge 3 commits into
codex/port-02-android-rewriterfrom
codex/port-03-android-thread-gates
Closed

thehobbit85 wants to merge 3 commits into
codex/port-02-android-rewriterfrom
codex/port-03-android-thread-gates

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Capability

A rewritten ARM64 module can enter the native service gate on Android, dispatch on a per-thread host stack, and resume with its own registers and TLS. Host code can also call a guest function pointer and receive its result through the normal ARM64 calling convention. Apple and Android share the gate assembly. The Android build also links it as a position-independent ELF shared object.

The bionic thread-slot ABI comes from the Android port. This adapts it to the current per-thread gate stacks. Each guest thread claims bionic’s application slot (API 29+) and refuses an occupied slot. The loader checks the module’s rewrite layout before mapping it.

Validation at e987551

  • The actual rewriter produces a synthetic guest. Two threads call its callback, take a signal with a live spill below the guest stack pointer, enter a service call concurrently, and verify their returned registers and independent TLS values. The fixture supplies the test dispatcher and installs its own alternate signal stacks.
  • The fixture passed on Apple Silicon and with static bionic under qemu-aarch64 on a Linux kernel. The latter was built with the Android API 30 NDK compiler in the Android CI job. Android device signal delivery, full game loading and gameplay still need verification.
  • The macOS host and Metal graphics suites passed. The Python tool suite ran 907 tests with 16 skips. Python lint reported zero new findings. The Apple gate assembly object was byte-identical to the parent’s.
  • Legends Z-A was the only local game available to the regression harness. The comparison used DM_ALLOW_OTHER_METAL=1 for local compiler 32023.921 (pinned 32023.922). Its 28,603 shaders were unchanged. There is no scripted boot route for this game, so gameplay and timing remain unmeasured.

Stacked on #3. Keep the series in draft until the port is complete.

regress.py check (full): PASS

Baseline codex/port-02-android-rewriter 50086de, candidate codex/port-03-android-thread-gates e987551; Apple M2 Max, macOS 26.6, Xcode 27.0; 29.8 s

game status shaders (base → cand) newly failing newly building changed MSL interface (new / known) boot fps p50 frame p99 ms peak MB prepare s new RED
LegendsZA 0100F43008C44000 PASS 28603/28603 → 28603/28603 0 0 0 0 / 0 – – – – – –

LegendsZA 0100F43008C44000: PASS

  • time: chain 29.6 s

Inherited CI failure

The C lint job reported the same two findings as #2, both in the untouched Metal test dm/gfx/tests/t_geometry_hazards.m. The analyzer flagged a retained program at line 141 and a nullable readback destination at line 153. Upstream PR 979 addresses those findings separately.

@thehobbit85 thehobbit85 closed this Nov 3, 2026
@thehobbit85
thehobbit85 deleted the codex/port-03-android-thread-gates branch November 3, 2026 04:44
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