context_i686.asm 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. [bits 32]
  2. %define MJB_BX 0
  3. %define MJB_SI 1
  4. %define MJB_DI 2
  5. %define MJB_BP 3
  6. %define MJB_SP 4
  7. %define MJB_PC 5
  8. %define MJB_RSP MJB_SP
  9. %define MJB_SIZE 24
  10. %define LINKAGE 4
  11. %define PCOFF 0
  12. %define PTR_SIZE 4
  13. %define PARMS LINKAGE
  14. %define JMPBUF PARMS
  15. %define JBUF PARMS
  16. %define VAL JBUF + PTR_SIZE
  17. EXPORT __mylongjmp
  18. mov ecx, [esp + JBUF]
  19. mov eax, [esp + VAL]
  20. mov edx, [ecx + MJB_PC*4]
  21. mov ebx, [ecx + MJB_BX*4]
  22. mov esi, [ecx + MJB_SI*4]
  23. mov edi, [ecx + MJB_DI*4]
  24. mov ebp, [ecx + MJB_BP*4]
  25. mov esp, [ecx + MJB_SP*4]
  26. jmp edx
  27. EXPORT __mysetjmp
  28. mov eax, [esp + JMPBUF]
  29. mov [eax + MJB_BX*4], ebx
  30. mov [eax + MJB_SI*4], esi
  31. mov [eax + MJB_DI*4], edi
  32. lea ecx, [esp + JMPBUF]
  33. mov [eax + MJB_SP*4], ecx
  34. mov ecx, [esp + PCOFF]
  35. mov [eax + MJB_PC*4], ecx
  36. mov [eax + MJB_BP*4], ebp
  37. xor eax, eax
  38. ret