invokeNative_ia32.asm 755 B

123456789101112131415161718192021222324252627
  1. ;
  2. ; Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. ;
  5. .386
  6. .model flat
  7. .code
  8. _invokeNative PROC
  9. push ebp
  10. mov ebp,esp
  11. mov ecx, [ebp+16] ; ecx = argc */
  12. mov edx, [ebp+12] ; edx = argv */
  13. test ecx, ecx
  14. jz skip_push_args ; if ecx == 0, skip pushing arguments */
  15. lea edx, [edx+ecx*4-4] ; edx = edx + ecx * 4 - 4 */
  16. sub edx,esp ; edx = edx - esp */
  17. loop_push:
  18. push [esp+edx]
  19. loop loop_push ; loop ecx counts */
  20. skip_push_args:
  21. mov edx, [ebp+8] ; edx = func_ptr */
  22. call edx
  23. leave
  24. ret
  25. _invokeNative ENDP
  26. END