Subversion Repositories HelenOS-historic

Rev

Rev 1215 | Rev 1269 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1215 Rev 1267
Line 30... Line 30...
30
#include <arch/mm/page.h>
30
#include <arch/mm/page.h>
31
 
31
 
32
.section K_UNMAPPED_TEXT_START, "ax"
32
.section K_UNMAPPED_TEXT_START, "ax"
33
 
33
 
34
.macro CONTEXT_STORE
34
.macro CONTEXT_STORE
35
	mtspr sprg1, sp
-
 
36
	
35
	
-
 
36
	# save SP in SPRG1
-
 
37
	# save R12 in SPRG2, backup CR in R12
-
 
38
 
-
 
39
	mtsprg1 sp
-
 
40
	mtsprg2 r12
-
 
41
	mfcr r12
-
 
42
	
-
 
43
	# check whether SP is in kernel
-
 
44
	
37
	subis sp, sp, 0x8000
45
	andis. sp, sp, 0x8000
-
 
46
	bne 1f
-
 
47
	
-
 
48
		# stack is in user-space
-
 
49
		
-
 
50
		mfsprg0 sp
-
 
51
	
-
 
52
	b 2f
38
	
53
	
-
 
54
	1:
-
 
55
	
-
 
56
		# stack is in kernel
-
 
57
		
-
 
58
		mfsprg1 sp
-
 
59
		subis sp, sp, 0x8000
-
 
60
	
-
 
61
	2:
-
 
62
	
39
	subi sp, sp, 144
63
	subi sp, sp, 140
40
	stw r0, 0(sp)
64
	stw r0, 0(sp)
41
	stw r2, 4(sp)
65
	stw r2, 4(sp)
42
	stw r3, 8(sp)
66
	stw r3, 8(sp)
43
	stw r4, 12(sp)
67
	stw r4, 12(sp)
44
	stw r5, 16(sp)
68
	stw r5, 16(sp)
Line 46... Line 70...
46
	stw r7, 24(sp)
70
	stw r7, 24(sp)
47
	stw r8, 28(sp)
71
	stw r8, 28(sp)
48
	stw r9, 32(sp)
72
	stw r9, 32(sp)
49
	stw r10, 36(sp)
73
	stw r10, 36(sp)
50
	stw r11, 40(sp)
74
	stw r11, 40(sp)
51
	stw r12, 44(sp)
75
	stw r13, 44(sp)
52
	stw r13, 48(sp)
76
	stw r14, 48(sp)
53
	stw r14, 52(sp)
77
	stw r15, 52(sp)
54
	stw r15, 56(sp)
78
	stw r16, 56(sp)
55
	stw r16, 60(sp)
79
	stw r17, 60(sp)
56
	stw r17, 64(sp)
80
	stw r18, 64(sp)
57
	stw r18, 68(sp)
81
	stw r19, 68(sp)
58
	stw r19, 72(sp)
82
	stw r20, 72(sp)
59
	stw r20, 76(sp)
83
	stw r21, 76(sp)
60
	stw r21, 80(sp)
84
	stw r22, 80(sp)
61
	stw r22, 84(sp)
85
	stw r23, 84(sp)
62
	stw r23, 88(sp)
86
	stw r24, 88(sp)
63
	stw r24, 92(sp)
87
	stw r25, 92(sp)
64
	stw r25, 96(sp)
88
	stw r26, 96(sp)
65
	stw r26, 100(sp)
89
	stw r27, 100(sp)
66
	stw r27, 104(sp)
90
	stw r28, 104(sp)
67
	stw r28, 108(sp)
91
	stw r29, 108(sp)
68
	stw r29, 112(sp)
-
 
69
	stw r30, 116(sp)
92
	stw r30, 112(sp)
70
	stw r31, 120(sp)
93
	stw r31, 116(sp)
71
	
94
	
72
	mfspr r3, srr0
95
	mfsrr0 r3
73
	stw r3, 124(sp)
96
	stw r3, 120(sp)
74
	
97
	
75
	mfspr r3, srr1
98
	mfsrr1 r3
76
	stw r3, 128(sp)
99
	stw r3, 124(sp)
77
	
100
	
78
	mflr r3
101
	mflr r3
79
	stw r3, 132(sp)
102
	stw r3, 128(sp)
80
	
103
	
81
	mfcr r3
-
 
82
	stw r3, 136(sp)
104
	stw r12, 132(sp)
83
	
105
	
84
	mfctr r3
106
	mfctr r3
85
	stw r3, 140(sp)
107
	stw r3, 136(sp)
86
	
108
	
87
	mfxer r3
109
	mfxer r3
88
	stw r3, 144(sp)
110
	stw r3, 140(sp)
89
.endm
111
.endm
90
 
112
 
91
.org 0x100
113
.org 0x100
92
.global exc_system_reset
114
.global exc_system_reset
93
exc_system_reset:
115
exc_system_reset:
Line 100... Line 122...
100
 
122
 
101
.org 0x300
123
.org 0x300
102
.global exc_data_storage
124
.global exc_data_storage
103
exc_data_storage:
125
exc_data_storage:
104
	CONTEXT_STORE
126
	CONTEXT_STORE
105
 
127
	
106
	lis r3, pht_refill@ha
128
	lis r3, pht_refill@ha
107
	addi r3, r3, pht_refill@l
129
	addi r3, r3, pht_refill@l
108
	mtspr srr0, r3
130
	mtsrr0 r3
109
	
131
	
110
	mfmsr r3
132
	mfmsr r3
111
	ori r3, r3, (msr_ir | msr_dr)@l
133
	ori r3, r3, (msr_ir | msr_dr)@l
112
	mtspr srr1, r3
134
	mtsrr1 r3
113
	
135
	
114
	lis r3, iret@ha
136
	lis r3, iret@ha
115
	addi r3, r3, iret@l
137
	addi r3, r3, iret@l
116
	mtlr r3
138
	mtlr r3
117
	
139
	
118
	addis sp, sp, 0x8000
140
	addis sp, sp, 0x8000
-
 
141
	mr r3, sp
119
	rfi
142
	rfi
120
 
143
 
121
.org 0x400
144
.org 0x400
122
.global exc_instruction_storage
145
.global exc_instruction_storage
123
exc_instruction_storage:
146
exc_instruction_storage:
-
 
147
	CONTEXT_STORE
-
 
148
	
-
 
149
	lis r3, pht_refill@ha
124
	b exc_instruction_storage
150
	addi r3, r3, pht_refill@l
-
 
151
	mtsrr0 r3
125
 
152
	
126
.org 0x480
153
	mfmsr r3
127
.global exc_instruction_segment
154
	ori r3, r3, (msr_ir | msr_dr)@l
-
 
155
	mtsrr1 r3
-
 
156
	
128
exc_instruction_segment:
157
	lis r3, iret@ha
129
	b exc_instruction_segment
158
	addi r3, r3, iret@l
-
 
159
	mtlr r3
-
 
160
	
-
 
161
	addis sp, sp, 0x8000
-
 
162
	mr r3, sp
-
 
163
	rfi
130
 
164
 
131
.org 0x500
165
.org 0x500
132
.global exc_external
166
.global exc_external
133
exc_external:
167
exc_external:
134
	b exc_external
168
	b exc_external
Line 153... Line 187...
153
exc_decrementer:
187
exc_decrementer:
154
	CONTEXT_STORE	
188
	CONTEXT_STORE	
155
 
189
 
156
	lis r3, exc_dispatch@ha
190
	lis r3, exc_dispatch@ha
157
	addi r3, r3, exc_dispatch@l
191
	addi r3, r3, exc_dispatch@l
158
	mtspr srr0, r3
192
	mtsrr0 r3
159
	
193
	
160
	mfmsr r3
194
	mfmsr r3
161
	ori r3, r3, (msr_ir | msr_dr)@l
195
	ori r3, r3, (msr_ir | msr_dr)@l
162
	mtspr srr1, r3
196
	mtsrr1 r3
163
	
197
	
164
	lis r3, iret@ha
198
	lis r3, iret@ha
165
	addi r3, r3, iret@l
199
	addi r3, r3, iret@l
166
	mtlr r3
200
	mtlr r3
167
	
201
	
168
	addis sp, sp, 0x8000
202
	addis sp, sp, 0x8000
169
	li r3, 10
203
	li r3, 10
-
 
204
	mr r4, sp
170
	rfi
205
	rfi
171
 
206
 
172
.org 0xa00
207
.org 0xa00
173
.global exc_reserved0
208
.global exc_reserved0
174
exc_reserved0:
209
exc_reserved0: