This repository has been archived on 2023-11-05. You can view files and clone it, but cannot push or open issues or pull requests.
wasm-micro-runtime/samples/wasi-threads/wasm-apps/wasi_thread_start.S
Marcin Kolny 0e2382a959
Disable aux stack allocations for threads spawned by wasi_thread_start (#1867)
This syscall doesn't need allocating stack or TLS and it's expected from the application
to do that instead. E.g. WASI-libc already does this for `pthread_create`.

Also fix some of the examples to allocate memory for stack and not use stack before
the stack pointer is set to a correct value.
2023-01-09 20:36:34 +08:00

22 lines
586 B
ArmAsm

# A slightly modified copy of the wasi-libc implementation
# https://github.com/WebAssembly/wasi-libc/pull/376/
.globaltype __stack_pointer, i32
.functype __wasi_thread_start_C (i32, i32) -> ()
.globl wasi_thread_start
wasi_thread_start:
.functype wasi_thread_start (i32, i32) -> ()
# Set up the minimum C environment.
# Note: offsetof(start_arg, stack) == 0
local.get 1 # start_arg
i32.load 0 # stack
global.set __stack_pointer
# Make the C function do the rest of work.
local.get 0 # tid
local.get 1 # start_arg
call __wasi_thread_start_C
end_function