wasi_thread_start.S 586 B

12345678910111213141516171819202122
  1. # A slightly modified copy of the wasi-libc implementation
  2. # https://github.com/WebAssembly/wasi-libc/pull/376/
  3. .globaltype __stack_pointer, i32
  4. .functype __wasi_thread_start_C (i32, i32) -> ()
  5. .globl wasi_thread_start
  6. wasi_thread_start:
  7. .functype wasi_thread_start (i32, i32) -> ()
  8. # Set up the minimum C environment.
  9. # Note: offsetof(start_arg, stack) == 0
  10. local.get 1 # start_arg
  11. i32.load 0 # stack
  12. global.set __stack_pointer
  13. # Make the C function do the rest of work.
  14. local.get 0 # tid
  15. local.get 1 # start_arg
  16. call __wasi_thread_start_C
  17. end_function