Subversion Repositories HelenOS

Rev

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

Rev 1829 Rev 1831
Line 35... Line 35...
35
.text
35
.text
36
 
36
 
37
.global xen_callback
37
.global xen_callback
38
.global xen_failsafe_callback
38
.global xen_failsafe_callback
39
.global enable_l_apic_in_msr
39
.global enable_l_apic_in_msr
40
.global interrupt_handlers
-
 
41
.global memcpy
40
.global memcpy
42
.global memcpy_from_uspace
41
.global memcpy_from_uspace
43
.global memcpy_from_uspace_failover_address
42
.global memcpy_from_uspace_failover_address
44
.global memcpy_to_uspace
43
.global memcpy_to_uspace
45
.global memcpy_to_uspace_failover_address
44
.global memcpy_to_uspace_failover_address
Line 121... Line 120...
121
	orl $(0xfee00000),%eax
120
	orl $(0xfee00000),%eax
122
	wrmsr
121
	wrmsr
123
 
122
 
124
	pop %eax
123
	pop %eax
125
	ret
124
	ret
126
 
-
 
127
# Clear nested flag
-
 
128
# overwrites %ecx
-
 
129
.macro CLEAR_NT_FLAG
-
 
130
	pushfl
-
 
131
	pop %ecx
-
 
132
	and $0xffffbfff,%ecx
-
 
133
	push %ecx
-
 
134
	popfl
-
 
135
.endm	
-
 
136
 
-
 
137
## Declare interrupt handlers
-
 
138
#
-
 
139
# Declare interrupt handlers for n interrupt
-
 
140
# vectors starting at vector i.
-
 
141
#
-
 
142
# The handlers setup data segment registers
-
 
143
# and call exc_dispatch().
-
 
144
#
-
 
145
#define INTERRUPT_ALIGN 64
-
 
146
.macro handler i n
-
 
147
 
-
 
148
.ifeq \i-0x30     # Syscall handler
-
 
149
	push %ds
-
 
150
	push %es
-
 
151
	push %fs
-
 
152
	push %gs
-
 
153
 
-
 
154
	# Push arguments on stack
-
 
155
	push %edi
-
 
156
	push %esi
-
 
157
	push %edx
-
 
158
	push %ecx
-
 
159
	push %eax
-
 
160
	
-
 
161
	# we must fill the data segment registers
-
 
162
	movw $16,%ax
-
 
163
	movw %ax,%ds
-
 
164
	movw %ax,%es
-
 
165
	
-
 
166
	sti
-
 
167
	
-
 
168
	call syscall_handler   # syscall_handler(ax,cx,dx,si,di)
-
 
169
	cli
-
 
170
	addl $20, %esp         # clean-up of parameters
-
 
171
	
-
 
172
	pop %gs
-
 
173
	pop %fs
-
 
174
	pop %es
-
 
175
	pop %ds
-
 
176
	
-
 
177
	CLEAR_NT_FLAG
-
 
178
	iret
-
 
179
.else	
-
 
180
	/*
-
 
181
	 * This macro distinguishes between two versions of ia32 exceptions.
-
 
182
	 * One version has error word and the other does not have it.
-
 
183
	 * The latter version fakes the error word on the stack so that the
-
 
184
	 * handlers and istate_t can be the same for both types.
-
 
185
	 */
-
 
186
	.iflt \i-32
-
 
187
		.if (1 << \i) & ERROR_WORD_INTERRUPT_LIST
-
 
188
			/* 
-
 
189
			 * With error word, do nothing
-
 
190
			 */
-
 
191
                .else
-
 
192
                        /*
-
 
193
                         * Version without error word,
-
 
194
                         */
-
 
195
			subl $4, %esp
-
 
196
                .endif
-
 
197
        .else
-
 
198
                /*
-
 
199
                 * Version without error word,
-
 
200
                 */
-
 
201
		subl $4, %esp
-
 
202
	.endif
-
 
203
	
-
 
204
	push %ds
-
 
205
	push %es
-
 
206
	push %fs
-
 
207
	push %gs
-
 
208
 
-
 
209
#ifdef CONFIG_DEBUG_ALLREGS
-
 
210
	push %ebx
-
 
211
	push %ebp
-
 
212
	push %edi
-
 
213
	push %esi
-
 
214
#else
-
 
215
	sub $16, %esp
-
 
216
#endif
-
 
217
	push %edx
-
 
218
	push %ecx
-
 
219
	push %eax
-
 
220
	
-
 
221
	# we must fill the data segment registers
-
 
222
	movw $16,%ax
-
 
223
	movw %ax,%ds
-
 
224
	movw %ax,%es
-
 
225
 
-
 
226
	pushl %esp          # *istate
-
 
227
	pushl $(\i)         # intnum
-
 
228
	call exc_dispatch   # excdispatch(intnum, *istate)
-
 
229
	addl $8,%esp        # Clear arguments from stack
-
 
230
 
-
 
231
	CLEAR_NT_FLAG # Modifies %ecx
-
 
232
	
-
 
233
	pop %eax
-
 
234
	pop %ecx
-
 
235
	pop %edx
-
 
236
#ifdef CONFIG_DEBUG_ALLREGS
-
 
237
	pop %esi
-
 
238
	pop %edi
-
 
239
	pop %ebp
-
 
240
	pop %ebx
-
 
241
#else
-
 
242
	add $16, %esp
-
 
243
#endif	
-
 
244
	
-
 
245
	pop %gs
-
 
246
	pop %fs
-
 
247
	pop %es
-
 
248
	pop %ds
-
 
249
 
-
 
250
	addl $4,%esp	# Skip error word, no matter whether real or fake.
-
 
251
	iret
-
 
252
.endif
-
 
253
 
-
 
254
	.align INTERRUPT_ALIGN
-
 
255
	.if (\n-\i)-1
-
 
256
	handler "(\i+1)",\n
-
 
257
	.endif
-
 
258
.endm
-
 
259
 
-
 
260
# keep in sync with pm.h !!!
-
 
261
IDT_ITEMS=64
-
 
262
.align INTERRUPT_ALIGN
-
 
263
interrupt_handlers:
-
 
264
h_start:
-
 
265
	handler 0 IDT_ITEMS
-
 
266
h_end:
-
 
267
 
-
 
268
.data
-
 
269
.global interrupt_handler_size
-
 
270
 
-
 
271
interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS
-