feat(hal): Consolidate per_cpu.rs to use HAL exclusively #84
+310
−577
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
per_cpu.rsto use HAL trait calls viaX86PerCpuHAL_PERCPU_INITIALIZED,HAL_TIMER_CALIBRATED) for CI validationValidation Fixes (Latest Commit)
Address issues found during technical implementation validation:
HAL Read-back Verification - Added verification in
per_cpu::init()that confirms GS-relative operations work correctly (tests cpu_id and preempt_count cycle)Offset Constant Consolidation - Removed duplicate offset constants, now uses
offset_of!compile-time assertions against HAL constants (13 field assertions)Debug Underflow Assertions - Added debug-only underflow checks in
irq_exit,nmi_exit,softirq_exitCompiler Fence Consistency - Added fences to
irq_enter/irq_exitmatching other interrupt context functionsNMI_MASK Bug Fix - Fixed from
0x3 << 26(2 bits, wrong) to0x1 << 26(1 bit, correct per Linux kernel)Documentation Fix - Updated preempt_count bit layout comment to match actual implementation
Changes
per_cpu.rs Consolidation
All per-CPU operations now go through the HAL:
current_thread,set_current_threadkernel_stack_top,set_kernel_stack_toppreempt_disable,preempt_enable,preempt_countin_interrupt,irq_enter/exit,nmi_enter/exitsoftirq_pending,raise_softirq,clear_softirqget/set_next_cr3,get/set_kernel_cr3Boot Stage Markers
HAL_PERCPU_INITIALIZED- Emitted when per-CPU data is initializedHAL_TIMER_CALIBRATED- Emitted when TSC calibration completesTest plan
🤖 Generated with Claude Code