Skip to content

Commit

Permalink
Kernel: thread entrypoint fastcall ABI
Browse files Browse the repository at this point in the history
Changing the way the kernel passes the argument to a thread entrypoint
to the fastcall ABI, so we no longer need the entrypoint to be a naked function.
  • Loading branch information
Orycterope committed Jun 17, 2019
1 parent 7664199 commit f2e7bda
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions kernel/src/i386/process_switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ fn jump_to_entrypoint(ep: usize, userspace_stack_ptr: usize, arg: usize) -> ! {
push $0 // Entrypoint
// Clean up all registers. Also setup arguments.
mov eax, $2
mov ecx, $2
mov eax, 0
mov ebx, 0
mov ecx, 0
mov edx, 0
mov ebp, 0
mov edi, 0
Expand Down
2 changes: 1 addition & 1 deletion libuser/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub fn exit_process() -> ! {
}

/// Creates a thread in the current process.
pub fn create_thread(ip: extern fn() -> !, arg: usize, sp: *const u8, priority: u32, processor_id: u32) -> Result<Thread, KernelError> {
pub fn create_thread(ip: extern "fastcall" fn(usize) -> !, arg: usize, sp: *const u8, priority: u32, processor_id: u32) -> Result<Thread, KernelError> {
unsafe {
let (out_handle, ..) = syscall(nr::CreateThread, ip as usize, arg, sp as _, priority as _, processor_id as _, 0)?;
Ok(Thread(Handle::new(out_handle as _)))
Expand Down

0 comments on commit f2e7bda

Please sign in to comment.