Skip to content

Conversation

@li041
Copy link
Contributor

@li041 li041 commented Dec 15, 2025

Fixes #225

@github-actions github-actions bot added aarch64 bug Something isn't working labels Dec 15, 2025
@li041 li041 requested a review from Copilot December 15, 2025 07:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug in the AArch64 boot code where the CPU ID value was being corrupted in release mode. The issue stems from using x17 (IP1, an intra-procedure-call temporary register) to store the CPU ID across multiple function calls. In release mode, x17 can be clobbered by compiler optimizations, linker veneers, or PLT stubs, causing the CPU ID value to be lost or corrupted.

The fix systematically replaces all instances of x17 with x19, a callee-saved register that is guaranteed to be preserved across function calls according to the ARM64 ABI.

  • Replaced x17 with x19 in boot_cpuid_get() function for storing and returning the CPU ID
  • Updated all x17 references in arch_entry() to use x19 for cpuid calculations and comparisons
  • Ensured the register is properly cleared after use before jumping to rust_main

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@caodg caodg requested a review from Inquisitor-201 December 15, 2025 13:19
@enkerewpo enkerewpo merged commit 2c14ab4 into syswonder:dev Dec 15, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aarch64 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to run in release mode for aarch64

2 participants