-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context Switching Primitives for AArch64 #744
Context Switching Primitives for AArch64 #744
Conversation
…i-rs is fully merged
…uld be set in descriptors.
…alization to `memory`
…plemented the creation and filling of a new page table; Implemented the switch to the new page table
This reverts commit ff3944a.
…h64-context-switching
…h64-context-switching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Linux only saves/restores x18
- x29
on aarch64, which apparently corresponds to the set of callee-saved registers. If you change your implementation to that, does everything still work correctly?
https://github.com/torvalds/linux/blob/69b41ac87e4a664de78a395ff97166f0b2943210/arch/arm64/kernel/entry.S#L820
… "first register" & rename fr/lr
Indeed, it still works correctly 👌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few nitpicks left, other than that it looks excellent.
…h64-context-switching
Co-authored-by: Kevin Boos <[email protected]>
* Currently this only saves callee-saved registers, which includes `x19` through `x30`, in which `x29` is the frame register and `x30` is the link register (holds the return address). * We designate `x28` as the register used to pass a new task's ID to its entry point. b88a23a
This builds on #701.
This draft PR contains "regular" context switching primitives for aarch64:
context_switch_regular
function (same signature as on x86_64):_prev_stack_pointer
),_next_stack_pointer_value
),create_stack
is a utility function which allocates a 16-page long initial task stack; you have to give it a function pointer (such as the address oflanding_pad
) which will be executed if you usecontext_switch_regular
with that new stack.landing_pad
is a "task" function which simply re-triggers a context switch to return to the original main task.These are used in
main
just before infinite looping as a demonstration.