fix: ARM64 context switch, boot.S x17 clobber, and BWM rendering#218
Merged
fix: ARM64 context switch, boot.S x17 clobber, and BWM rendering#218
Conversation
…rendering Three critical fixes for ARM64 stability and rendering: 1. boot.S ERET path: Fixed x17 register clobbered by `mrs x17, spsr_el1` after restoring it from the exception frame. Changed both sync exception and IRQ handlers to use x16 (already a scratch register saved in eret_scratch) for the SPSR EL0/EL1 check. This was the root cause of DATA_ABORT crashes (FAR=0x5, DFSC=0x21) during the 84-test suite. 2. Context switch consolidation: Reduced 15-22 separate SCHEDULER lock acquisitions per context switch to a single lock hold, eliminating TOCTOU windows between lock releases. Added lock_for_context_switch(), inline save/restore helpers, and dispatch_thread_locked(). 3. Render thread GPU flush: Fixed blank screen when BWM takes display ownership. sys_fbdraw Flush copies pixels and marks dirty rects but relies on the render thread to call gpu_mmio::flush_rect(). The DISPLAY_TAKEN flag was incorrectly skipping flush_framebuffer(), so GPU scanout never happened. Also includes: kthread lock ordering fixes, full system test script (run-aarch64-full-test.sh), and test harness improvements. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
mrs x17, spsr_el1after frame restore — root cause of DATA_ABORT crashes (FAR=0x5) during the 84-test suite. Changed to x16 (scratch register) for SPSR check.DISPLAY_TAKENwas incorrectly skippingflush_framebuffer(), so dirty rects fromsys_fbdrawFlush were never submitted to the GPU.kthread_exit()andcurrent_kthread()by matchingwithout_interruptspattern used bykthread_run.run-aarch64-full-test.shthat waits for all 84 tests, verifies services, and runs a 15s stability soak.Test plan
🤖 Generated with Claude Code