rust-os icon indicating copy to clipboard operation
rust-os copied to clipboard

Fix syscall handler's temporary stack

Open ChocolateLoverRaj opened this issue 1 year ago • 0 comments

Use alloc to make sure that the alignment is 16 bytes

rsp should be set to the top of the stack, not the start

I read your blog post at https://nfil.dev/kernel/rust/coding/rust-kernel-to-userspace-and-back/#final-code-to-return-to-usermode and copied your syscall code for my OS. It didn't work, causing general protection faults, page faults, and double faults. My OS uses linked_list_allocator. After making the two changes, my OS syscalls can print with log::info! without panics, faults, or strange behavior. I made the same changes to your OS and it continues to work. Idk how it was working before. My guess is that it worked because of the internal implementation of your allocator.

ChocolateLoverRaj avatar Jan 28 '25 01:01 ChocolateLoverRaj