invokeNative_ia32.s 898 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. .text
  6. .align 2
  7. #ifndef BH_PLATFORM_DARWIN
  8. .globl invokeNative
  9. .type invokeNative, @function
  10. invokeNative:
  11. #else
  12. .globl _invokeNative
  13. _invokeNative:
  14. #endif /* end of BH_PLATFORM_DARWIN */
  15. push %ebp
  16. movl %esp, %ebp
  17. movl 16(%ebp), %ecx /* ecx = argc */
  18. movl 12(%ebp), %edx /* edx = argv */
  19. test %ecx, %ecx
  20. jz skip_push_args /* if ecx == 0, skip pushing arguments */
  21. leal -4(%edx,%ecx,4), %edx /* edx = edx + ecx * 4 - 4 */
  22. subl %esp, %edx /* edx = edx - esp */
  23. 1:
  24. push 0(%esp,%edx)
  25. loop 1b /* loop ecx counts */
  26. skip_push_args:
  27. movl 8(%ebp), %edx /* edx = func_ptr */
  28. call *%edx
  29. leave
  30. ret