1
0

jump.asm 790 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. global _start
  2. section .data
  3. align 16
  4. %include "header.inc"
  5. mov eax, 0
  6. mov ebx, 0
  7. mov ecx, 0
  8. mov edx, 0
  9. mov esi, 0
  10. mov edi, 0
  11. ; skip
  12. jmp .target1
  13. inc eax
  14. .target1:
  15. ; conditional jump up
  16. .target2:
  17. inc ebx
  18. inc ecx
  19. cmp ebx, 2
  20. jne .target2
  21. ; conditional jump down
  22. .target3:
  23. cmp ebx, 4
  24. je .target4
  25. inc ebx
  26. inc edx
  27. jmp .target3
  28. .target4:
  29. call .fun
  30. call .not_returning_fun
  31. .after_call:
  32. jmp .after_fun
  33. .fun:
  34. inc esi
  35. ret
  36. .not_returning_fun:
  37. inc esi
  38. jmp .after_call
  39. inc esi
  40. ret
  41. .after_fun:
  42. push .target5
  43. ret
  44. .target5:
  45. ; clear stack (pushed eip is not the same between vm and gdb execution)
  46. mov dword [esp], 0
  47. mov dword [esp-4], 0
  48. %include "footer.inc"