-
Notifications
You must be signed in to change notification settings - Fork 20
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
Improve syscall implementation #284
Conversation
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.
lgtm, added a couple of remarks "just because".
375dbdb
to
974476d
Compare
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.
Great series, thanks a lot for doing this! Only needs a tiny bit more polishing.
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
The terminate_user_task() is used upon exception when in usermode. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Main change is a split of the syscall implementation with proper assembly routines: syscall_handler_entry() and simplified syscall_exit() and a simplified C-level syscall handler function. The syscall_exit() is implemented and handled fully in asm. The syscall() usermode function implements typical syscall ABI, passing syscall number via AX register and the rest of parameters via SI, DX, DI, R8 and R9. The assembly entry point rearranges the registers to fix the C-level handler function API. Only 5 arguments to the syscall can be provided. Usermode upon calling syscall() takes are of callee saved registers by saving/restoring them via usermode stack (only reminder of unused registers is preserved as the rest is considered implicitely clobbered). Additionally SYSCALL_PRINTF has been improved to support variadic number of arguments (it passes the va_list args to the kernel mode). Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
In 64bit mode push 64bit 0 value on the stack as the aligning error code and overwrite upper 32 bits of it with vector value. In 32bit mode push 32bit 0 value on the stack as the aligning error code and push vector value additionally. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
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.
LGTM!
Note: This PR is based on #282. Please review and merge #282 first or focus only on the new bits.