• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.align 2
2.globl .ontop_fcontext
3.ontop_fcontext:
4    # reserve space on stack
5    subi  1, 1, 184
6
7    std  13, 0(1)  # save R13
8    std  14, 8(1)  # save R14
9    std  15, 16(1)  # save R15
10    std  16, 24(1)  # save R16
11    std  17, 32(1)  # save R17
12    std  18, 40(1)  # save R18
13    std  19, 48(1)  # save R19
14    std  20, 56(1)  # save R20
15    std  21, 64(1)  # save R21
16    std  22, 72(1)  # save R22
17    std  23, 80(1)  # save R23
18    std  24, 88(1)  # save R24
19    std  25, 96(1)  # save R25
20    std  26, 104(1)  # save R26
21    std  27, 112(1)  # save R27
22    std  29, 120(1)  # save R28
23    std  29, 128(1)  # save R29
24    std  30, 136(1)  # save R30
25    std  31, 144(1)  # save R31
26    std  3,  152(1)  # save hidden
27
28    # save CR
29    mfcr  0
30    std  0, 160(1)
31    # save LR
32    mflr  0
33    std  0, 168(1)
34    # save LR as PC
35    std  0, 176(1)
36
37    # store RSP (pointing to context-data) in R7
38    mr  7, 1
39
40    # restore RSP (pointing to context-data) from R4
41    mr  1, 4
42
43    ld  13, 0(1)  # restore R13
44    ld  14, 8(1)  # restore R14
45    ld  15, 16(1)  # restore R15
46    ld  16, 24(1)  # restore R16
47    ld  17, 32(1)  # restore R17
48    ld  18, 40(1)  # restore R18
49    ld  19, 48(1)  # restore R19
50    ld  20, 56(1)  # restore R20
51    ld  21, 64(1)  # restore R21
52    ld  22, 72(1)  # restore R22
53    ld  23, 80(1)  # restore R23
54    ld  24, 88(1)  # restore R24
55    ld  25, 96(1)  # restore R25
56    ld  26, 104(1)  # restore R26
57    ld  27, 112(1)  # restore R27
58    ld  28, 120(1)  # restore R28
59    ld  29, 128(1)  # restore R29
60    ld  30, 136(1)  # restore R30
61    ld  31, 144(1)  # restore R31
62    ld  4,  152(1)  # restore hidden
63
64    # restore CR
65    ld  0, 160(1)
66    mtcr  0
67    # restore LR
68    ld  0, 168(1)
69    mtlr  0
70    # ignore PC
71
72    # adjust stack
73    addi  1, 1, 184
74
75    # return transfer_t
76    std  7, 0(4)
77    std  5, 8(4)
78
79    # restore CTR
80    mtctr  6
81
82    # jump to context
83    bctr
84