make_ppc64_sysv_xcoff_gas.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .globl make_fcontext[DS]
  2. .globl .make_fcontext[PR]
  3. .align 2
  4. .csect .make_fcontext[PR], 3
  5. .globl _make_fcontext
  6. #._make_fcontext:
  7. # save return address into R6
  8. mflr 6
  9. # first arg of make_fcontext() == top address of context-function
  10. # shift address in R3 to lower 16 byte boundary
  11. clrrwi 3, 3, 4
  12. # reserve space for context-data on context-stack
  13. # including 64 byte of linkage + parameter area (R1 % 16 == 0)
  14. subi 3, 3, 248
  15. # third arg of make_fcontext() == address of context-function
  16. stw 5, 176(3)
  17. # set back-chain to zero
  18. li 0, 0
  19. std 0, 184(3)
  20. # compute address of returned transfer_t
  21. addi 0, 3, 232
  22. mr 4, 0
  23. std 4, 152(3)
  24. # load LR
  25. mflr 0
  26. # jump to label 1
  27. bl .Label
  28. .Label:
  29. # load LR into R4
  30. mflr 4
  31. # compute abs address of label .L_finish
  32. addi 4, 4, .L_finish - .Label
  33. # restore LR
  34. mtlr 0
  35. # save address of finish as return-address for context-function
  36. # will be entered after context-function returns
  37. stw 4, 168(3)
  38. # restore return address from R6
  39. mtlr 6
  40. blr # return pointer to context-data
  41. .L_finish:
  42. # save return address into R0
  43. mflr 0
  44. # save return address on stack, set up stack frame
  45. stw 0, 8(1)
  46. # allocate stack space, R1 % 16 == 0
  47. stwu 1, -32(1)
  48. # exit code is zero
  49. li 3, 0
  50. # exit application
  51. bl ._exit
  52. nop