Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. .text
  2. .align 8
  3. .globl asm_yield
  4. asm_yield:
  5. pushq %rbp
  6. movq %rsp,%rbp
  7. call .thread_save
  8. cmpq $0,%rsi
  9. call .thread_restore
  10. movq (%rsi),%rsp
  11. popq %rbp
  12. ret
  13.  
  14. .thread_save:
  15. movq %rsp,0(%rdi)
  16. movq %rbx,8(%rdi)
  17. movq %rdi,16(%rdi)
  18. movq %rsi,24(%rdi)
  19. movq %r12,32(%rdi)
  20. movq %r13,40(%rdi)
  21. movq %r14,48(%rdi)
  22. movq %r15,56(%rdi)
  23.  
  24. .thread_restore:
  25. movq 0(%rsi),%rsp
  26. movq 8(%rsi),%rbx
  27. movq 16(%rsi),%rdi
  28. movq 24(%rsi),%rsi
  29. movq 32(%rsi),%r12
  30. movq 40(%rsi),%r13
  31. movq 48(%rsi),%r14
  32. movq 56(%rsi),%r15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement