36 lines
665 B
ArmAsm
36 lines
665 B
ArmAsm
.code64
|
|
|
|
#include "mango/syscall.h"
|
|
|
|
.global __pthread_unmap_exit
|
|
.type __pthread_unmap_exit, @function
|
|
|
|
/*
|
|
%rdi = (kern_handle_t)address_space
|
|
%rsi = (void *)unmap_base
|
|
%rdx = (size_t)unmap_length
|
|
*/
|
|
__pthread_unmap_exit:
|
|
push %rbp
|
|
mov %rsp, %rbp
|
|
|
|
/* save the address space handle for later */
|
|
mov %rdi, %rbx
|
|
|
|
/* first, unmap the specified region */
|
|
mov $SYS_ADDRESS_SPACE_UNMAP, %rax
|
|
/* args are already in the correct registers */
|
|
syscall
|
|
|
|
/* next, close the handle to the address space */
|
|
mov $SYS_THREAD_EXIT, %rax
|
|
mov %rbx, %rdi
|
|
syscall
|
|
|
|
/* finally, stop the current thread */
|
|
mov $SYS_THREAD_EXIT, %rax
|
|
syscall
|
|
|
|
/* unreachable */
|
|
ret
|