1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
/* $OpenBSD: uthread_machdep_asm.S,v 1.2 2003/01/27 21:45:24 drahn Exp $ */
/* David Leonard, <d@csee.uq.edu.au>. Public domain. */
#include <machine/asm.h>
/* These need to be kept in sync with uthread_machdep.c */
#define REGOFF(n) (2*4 + (n-14)*4)
#define FPOFF(n) (REGOFF(36) + (n)*8)
#define FRAMESIZE FPOFF(33)
#define SA(x) (((x)+0xf)&~0xf)
ENTRY(_thread_machdep_switch)
stwu 1, -SA(FRAMESIZE)(1)
/* Save context into frame */
stw 14, REGOFF(14)(1)
stw 15, REGOFF(15)(1)
stw 16, REGOFF(16)(1)
stw 17, REGOFF(17)(1)
stw 18, REGOFF(18)(1)
stw 19, REGOFF(19)(1)
stw 20, REGOFF(20)(1)
stw 21, REGOFF(21)(1)
stw 22, REGOFF(22)(1)
stw 23, REGOFF(23)(1)
stw 24, REGOFF(24)(1)
stw 25, REGOFF(25)(1)
stw 26, REGOFF(26)(1)
stw 27, REGOFF(27)(1)
stw 28, REGOFF(28)(1)
stw 29, REGOFF(29)(1)
stw 30, REGOFF(30)(1)
stw 31, REGOFF(31)(1)
mflr 0; stw 0, REGOFF(32)(1)
mfcr 0; stw 0, REGOFF(33)(1)
mfctr 0; stw 0, REGOFF(34)(1)
mfxer 0; stw 0, REGOFF(35)(1)
stfd 0, FPOFF(0)(1)
stfd 1, FPOFF(1)(1)
stfd 2, FPOFF(2)(1)
stfd 3, FPOFF(3)(1)
stfd 4, FPOFF(4)(1)
stfd 5, FPOFF(5)(1)
stfd 6, FPOFF(6)(1)
stfd 7, FPOFF(7)(1)
stfd 8, FPOFF(8)(1)
stfd 9, FPOFF(9)(1)
stfd 10, FPOFF(10)(1)
stfd 11, FPOFF(11)(1)
stfd 12, FPOFF(12)(1)
stfd 13, FPOFF(13)(1)
stfd 14, FPOFF(14)(1)
stfd 15, FPOFF(15)(1)
stfd 16, FPOFF(16)(1)
stfd 17, FPOFF(17)(1)
stfd 18, FPOFF(18)(1)
stfd 19, FPOFF(19)(1)
stfd 20, FPOFF(20)(1)
stfd 21, FPOFF(21)(1)
stfd 22, FPOFF(22)(1)
stfd 23, FPOFF(23)(1)
stfd 24, FPOFF(24)(1)
stfd 25, FPOFF(25)(1)
stfd 26, FPOFF(26)(1)
stfd 27, FPOFF(27)(1)
stfd 28, FPOFF(28)(1)
stfd 29, FPOFF(29)(1)
stfd 30, FPOFF(30)(1)
stfd 31, FPOFF(31)(1)
mffs 0; stfd 0, FPOFF(32)(1)
/* Switch stacks */
stw 1, 0(4)
lwz 1, 0(3)
/* Restore context from the frame */
lfd 0, FPOFF(32)(1); mtfsf 0xff, 0
lfd 31, FPOFF(31)(1)
lfd 30, FPOFF(30)(1)
lfd 29, FPOFF(29)(1)
lfd 28, FPOFF(28)(1)
lfd 27, FPOFF(27)(1)
lfd 26, FPOFF(26)(1)
lfd 25, FPOFF(25)(1)
lfd 24, FPOFF(24)(1)
lfd 23, FPOFF(23)(1)
lfd 22, FPOFF(22)(1)
lfd 21, FPOFF(21)(1)
lfd 20, FPOFF(20)(1)
lfd 19, FPOFF(19)(1)
lfd 18, FPOFF(18)(1)
lfd 17, FPOFF(17)(1)
lfd 16, FPOFF(16)(1)
lfd 15, FPOFF(15)(1)
lfd 14, FPOFF(14)(1)
lfd 13, FPOFF(13)(1)
lfd 12, FPOFF(12)(1)
lfd 11, FPOFF(11)(1)
lfd 10, FPOFF(10)(1)
lfd 9, FPOFF(9)(1)
lfd 8, FPOFF(8)(1)
lfd 7, FPOFF(7)(1)
lfd 6, FPOFF(6)(1)
lfd 5, FPOFF(5)(1)
lfd 4, FPOFF(4)(1)
lfd 3, FPOFF(3)(1)
lfd 2, FPOFF(2)(1)
lfd 1, FPOFF(1)(1)
lfd 0, FPOFF(0)(1)
lwz 0, REGOFF(35)(1); mtxer 0
lwz 0, REGOFF(34)(1); mtctr 0
lwz 0, REGOFF(33)(1); mtcr 0
lwz 0, REGOFF(32)(1); mtlr 0
lwz 31, REGOFF(31)(1)
lwz 30, REGOFF(30)(1)
lwz 29, REGOFF(29)(1)
lwz 28, REGOFF(28)(1)
lwz 27, REGOFF(27)(1)
lwz 26, REGOFF(26)(1)
lwz 25, REGOFF(25)(1)
lwz 24, REGOFF(24)(1)
lwz 23, REGOFF(23)(1)
lwz 22, REGOFF(22)(1)
lwz 21, REGOFF(21)(1)
lwz 20, REGOFF(20)(1)
lwz 19, REGOFF(19)(1)
lwz 18, REGOFF(18)(1)
lwz 17, REGOFF(17)(1)
lwz 16, REGOFF(16)(1)
lwz 15, REGOFF(15)(1)
lwz 14, REGOFF(14)(1)
la 1, SA(FRAMESIZE)(1)
blr
|