Subversion Repositories HelenOS-historic

Rev

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

Rev 1269 Rev 1277
Line 31... Line 31...
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
	
35
	
36
	# save SP in SPRG1
36
	# save R12 in SPRG1, backup CR in R12
37
	# save R12 in SPRG2, backup CR in R12
37
	# save SP in SPRG2
38
 
38
 
39
	mtsprg1 sp
-
 
40
	mtsprg2 r12
39
	mtsprg1 r12
41
	mfcr r12
40
	mfcr r12
-
 
41
	mtsprg2 sp
42
	
42
	
43
	# check whether SP is in kernel
43
	# check whether SP is in kernel
44
	
44
	
45
	andis. sp, sp, 0x8000
45
	andis. sp, sp, 0x8000
46
	bne 1f
46
	bne 1f
Line 53... Line 53...
53
	
53
	
54
	1:
54
	1:
55
	
55
	
56
		# stack is in kernel
56
		# stack is in kernel
57
		
57
		
58
		mfsprg1 sp
58
		mfsprg2 sp
59
		subis sp, sp, 0x8000
59
		subis sp, sp, 0x8000
60
	
60
	
61
	2:
61
	2:
62
	
62
	
63
	subi sp, sp, 140
63
	subi sp, sp, 148
64
	stw r0, 0(sp)
64
	stw r0, 0(sp)
65
	stw r2, 4(sp)
65
	stw r2, 4(sp)
66
	stw r3, 8(sp)
66
	stw r3, 8(sp)
67
	stw r4, 12(sp)
67
	stw r4, 12(sp)
68
	stw r5, 16(sp)
68
	stw r5, 16(sp)
Line 90... Line 90...
90
	stw r28, 104(sp)
90
	stw r28, 104(sp)
91
	stw r29, 108(sp)
91
	stw r29, 108(sp)
92
	stw r30, 112(sp)
92
	stw r30, 112(sp)
93
	stw r31, 116(sp)
93
	stw r31, 116(sp)
94
	
94
	
95
	mfsrr0 r3
-
 
96
	stw r3, 120(sp)
95
	stw r12, 120(sp)
97
	
96
	
98
	mfsrr1 r3
97
	mfsrr0 r12
99
	stw r3, 124(sp)
98
	stw r12, 124(sp)
100
	
99
	
101
	mflr r3
100
	mfsrr1 r12
102
	stw r3, 128(sp)
101
	stw r12, 128(sp)
103
	
102
	
-
 
103
	mflr r12
104
	stw r12, 132(sp)
104
	stw r12, 132(sp)
105
	
105
	
106
	mfctr r3
106
	mfctr r12
107
	stw r3, 136(sp)
107
	stw r12, 136(sp)
108
	
108
	
109
	mfxer r3
109
	mfxer r12
110
	stw r3, 140(sp)
110
	stw r12, 140(sp)
-
 
111
	
-
 
112
	mfsprg1 r12
-
 
113
	stw r12, 144(sp)
-
 
114
	
-
 
115
	mfsprg2 r12
-
 
116
	stw r12, 148(sp)
111
.endm
117
.endm
112
 
118
 
-
 
119
.org 0x060
-
 
120
jump_to_kernel:
-
 
121
	lis r12, iret@ha
-
 
122
	addi r12, r12, iret@l
-
 
123
	mtlr r12
-
 
124
 
-
 
125
	mfmsr r12
-
 
126
	ori r12, r12, (msr_ir | msr_dr)@l
-
 
127
	mtsrr1 r12
-
 
128
	
-
 
129
	addis sp, sp, 0x8000
-
 
130
	mr r4, sp
-
 
131
	rfi
-
 
132
 
-
 
133
jump_to_kernel_syscall:
-
 
134
	lis r12, syscall_handler@ha
-
 
135
	addi r12, r12, syscall_handler@l
-
 
136
	mtsrr0 r12
-
 
137
	
-
 
138
	lis r12, iret_syscall@ha
-
 
139
	addi r12, r12, iret_syscall@l
-
 
140
	mtlr r12
-
 
141
 
-
 
142
	mfmsr r12
-
 
143
	ori r12, r12, (msr_ir | msr_dr)@l
-
 
144
	mtsrr1 r12
-
 
145
	
-
 
146
	addis sp, sp, 0x8000
-
 
147
	rfi
-
 
148
 
113
.org 0x100
149
.org 0x100
114
.global exc_system_reset
150
.global exc_system_reset
115
exc_system_reset:
151
exc_system_reset:
116
	b exc_system_reset
152
	b exc_system_reset
117
 
153
 
Line 123... Line 159...
123
.org 0x300
159
.org 0x300
124
.global exc_data_storage
160
.global exc_data_storage
125
exc_data_storage:
161
exc_data_storage:
126
	CONTEXT_STORE
162
	CONTEXT_STORE
127
	
163
	
128
	lis r3, pht_refill@ha
164
	lis r12, pht_refill@ha
129
	addi r3, r3, pht_refill@l
165
	addi r12, r12, pht_refill@l
130
	mtsrr0 r3
166
	mtsrr0 r12
131
	
-
 
132
	mfmsr r3
-
 
133
	ori r3, r3, (msr_ir | msr_dr)@l
-
 
134
	mtsrr1 r3
-
 
135
	
-
 
136
	lis r3, iret@ha
-
 
137
	addi r3, r3, iret@l
-
 
138
	mtlr r3
-
 
139
	
167
	
140
	addis sp, sp, 0x8000
-
 
141
	li r3, 1
168
	li r3, 1
142
	mr r4, sp
169
	b jump_to_kernel
143
	rfi
-
 
144
 
170
 
145
.org 0x400
171
.org 0x400
146
.global exc_instruction_storage
172
.global exc_instruction_storage
147
exc_instruction_storage:
173
exc_instruction_storage:
148
	CONTEXT_STORE
174
	CONTEXT_STORE
149
	
175
	
150
	lis r3, pht_refill@ha
176
	lis r12, pht_refill@ha
151
	addi r3, r3, pht_refill@l
177
	addi r12, r12, pht_refill@l
152
	mtsrr0 r3
178
	mtsrr0 r12
153
	
-
 
154
	mfmsr r3
-
 
155
	ori r3, r3, (msr_ir | msr_dr)@l
-
 
156
	mtsrr1 r3
-
 
157
	
-
 
158
	lis r3, iret@ha
-
 
159
	addi r3, r3, iret@l
-
 
160
	mtlr r3
-
 
161
	
179
	
162
	addis sp, sp, 0x8000
-
 
163
	li r3, 0
180
	li r3, 0
164
	mr r4, sp
181
	b jump_to_kernel
165
	rfi
-
 
166
 
182
 
167
.org 0x500
183
.org 0x500
168
.global exc_external
184
.global exc_external
169
exc_external:
185
exc_external:
170
	b exc_external
186
	b exc_external
Line 187... Line 203...
187
.org 0x900
203
.org 0x900
188
.global exc_decrementer
204
.global exc_decrementer
189
exc_decrementer:
205
exc_decrementer:
190
	CONTEXT_STORE	
206
	CONTEXT_STORE	
191
 
207
 
192
	lis r3, exc_dispatch@ha
208
	lis r12, exc_dispatch@ha
193
	addi r3, r3, exc_dispatch@l
209
	addi r12, r12, exc_dispatch@l
194
	mtsrr0 r3
210
	mtsrr0 r12
195
	
-
 
196
	mfmsr r3
-
 
197
	ori r3, r3, (msr_ir | msr_dr)@l
-
 
198
	mtsrr1 r3
-
 
199
	
-
 
200
	lis r3, iret@ha
-
 
201
	addi r3, r3, iret@l
-
 
202
	mtlr r3
-
 
203
	
211
	
204
	addis sp, sp, 0x8000
-
 
205
	li r3, 10
212
	li r3, 10
206
	mr r4, sp
213
	b jump_to_kernel
207
	rfi
-
 
208
 
214
 
209
.org 0xa00
215
.org 0xa00
210
.global exc_reserved0
216
.global exc_reserved0
211
exc_reserved0:
217
exc_reserved0:
212
	b exc_reserved0
218
	b exc_reserved0
Line 217... Line 223...
217
	b exc_reserved1
223
	b exc_reserved1
218
 
224
 
219
.org 0xc00
225
.org 0xc00
220
.global exc_syscall
226
.global exc_syscall
221
exc_syscall:
227
exc_syscall:
-
 
228
	CONTEXT_STORE	
-
 
229
	
222
	b exc_syscall
230
	b jump_to_kernel_syscall
223
 
231
 
224
.org 0xd00
232
.org 0xd00
225
.global exc_trace
233
.global exc_trace
226
exc_trace:
234
exc_trace:
227
	b exc_trace
235
	b exc_trace