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