Skip to content

Refactor update_kernel_sp function#112

Merged
LuernOutOfOrder merged 1 commit intodevelopfrom
93-refactor-the-update_kernel_sp-fn
Feb 3, 2026
Merged

Refactor update_kernel_sp function#112
LuernOutOfOrder merged 1 commit intodevelopfrom
93-refactor-the-update_kernel_sp-fn

Conversation

@LuernOutOfOrder
Copy link
Owner

This pull request refactors how the kernel stack pointer is updated in the RISC-V32 architecture. The main change is to make the stack pointer update function accept an explicit stack pointer argument, improving clarity and modularity. The update also reorganizes related code into more appropriate modules.

Refactoring and modularization of kernel stack pointer update:

  • Added a new update_kernel_sp(sp: usize) function to src/arch/riscv32/mem.rs, which sets the kernel stack pointer using an explicit argument.
  • Replaced the old update_kernel_sp() function in src/mem/mod.rs with a new mem_update_kernel_sp() function, which retrieves the stack pointer from memory and calls the new update_kernel_sp(sp) function.
  • Updated boot process in src/boot.rs to use mem_update_kernel_sp() instead of the previous update_kernel_sp(). [1] [2]
  • Moved the new memory-related code into the arch::riscv32::mem module and updated imports accordingly. [1] [2]

This pull-request improve the codebase by avoiding that the kernel function use arch specific asm, leave the asm in the arch specific module.

…ic API from kernel mem module to update the kernel sp
@LuernOutOfOrder LuernOutOfOrder added this to the v0.4.2 milestone Feb 3, 2026
@LuernOutOfOrder LuernOutOfOrder self-assigned this Feb 3, 2026
@LuernOutOfOrder LuernOutOfOrder added the enhancement New feature or request label Feb 3, 2026
@LuernOutOfOrder LuernOutOfOrder merged commit ca607d2 into develop Feb 3, 2026
3 checks passed
@LuernOutOfOrder LuernOutOfOrder deleted the 93-refactor-the-update_kernel_sp-fn branch February 3, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant