Deleted Added
full compact
apic_vector.S (75393) apic_vector.S (76078)
1/*
2 * from: vector.s, 386BSD 0.1 unknown origin
1/*
2 * from: vector.s, 386BSD 0.1 unknown origin
3 * $FreeBSD: head/sys/amd64/amd64/apic_vector.S 75393 2001-04-10 21:34:13Z jhb $
3 * $FreeBSD: head/sys/amd64/amd64/apic_vector.S 76078 2001-04-27 19:28:25Z jhb $
4 */
5
6
7#include <machine/apic.h>
8#include <machine/smp.h>
9
10#include "i386/isa/intr_machdep.h"
11

--- 165 unchanged lines hidden (view full) ---

177 SUPERALIGN_TEXT
178 .globl Xspuriousint
179Xspuriousint:
180
181 /* No EOI cycle used here */
182
183 iret
184
4 */
5
6
7#include <machine/apic.h>
8#include <machine/smp.h>
9
10#include "i386/isa/intr_machdep.h"
11

--- 165 unchanged lines hidden (view full) ---

177 SUPERALIGN_TEXT
178 .globl Xspuriousint
179Xspuriousint:
180
181 /* No EOI cycle used here */
182
183 iret
184
185
186/*
187 * Handle TLB shootdowns.
188 */
189 .text
190 SUPERALIGN_TEXT
191 .globl Xinvltlb
192Xinvltlb:
193 pushl %eax

--- 12 unchanged lines hidden (view full) ---

206 movl %eax, %cr3
207
208 ss /* stack segment, avoid %ds load */
209 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
210
211 popl %eax
212 iret
213
185/*
186 * Handle TLB shootdowns.
187 */
188 .text
189 SUPERALIGN_TEXT
190 .globl Xinvltlb
191Xinvltlb:
192 pushl %eax

--- 12 unchanged lines hidden (view full) ---

205 movl %eax, %cr3
206
207 ss /* stack segment, avoid %ds load */
208 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
209
210 popl %eax
211 iret
212
214
215/*
213/*
216 * Executed by a CPU when it receives an Xcpucheckstate IPI from another CPU,
217 *
218 * - Stores current cpu state in checkstate_cpustate[cpuid]
219 * 0 == user, 1 == sys, 2 == intr
220 * - Stores current process in checkstate_curproc[cpuid]
221 *
222 * - Signals its receipt by setting bit cpuid in checkstate_probed_cpus.
223 *
224 * stack: 0->ds, 4->fs, 8->ebx, 12->eax, 16->eip, 20->cs, 24->eflags
214 * Forward hardclock to another CPU. Pushes a trapframe and calls
215 * forwarded_hardclock().
225 */
216 */
226
227 .text
228 SUPERALIGN_TEXT
217 .text
218 SUPERALIGN_TEXT
229 .globl Xcpucheckstate
230 .globl checkstate_cpustate
231 .globl checkstate_curproc
232 .globl checkstate_pc
233Xcpucheckstate:
234 pushl %eax
235 pushl %ebx
236 pushl %ds /* save current data segment */
237 pushl %fs
238
239 movl $KDSEL, %eax
240 mov %ax, %ds /* use KERNEL data segment */
219 .globl Xhardclock
220Xhardclock:
221 PUSH_FRAME
222 movl $KDSEL, %eax /* reload with kernel's data segment */
223 mov %ax, %ds
224 mov %ax, %es
241 movl $KPSEL, %eax
242 mov %ax, %fs
243
244 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
245
225 movl $KPSEL, %eax
226 mov %ax, %fs
227
228 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
229
246 movl $0, %ebx
247 movl 20(%esp), %eax
248 andl $3, %eax
249 cmpl $3, %eax
250 je 1f
251 testl $PSL_VM, 24(%esp)
252 jne 1f
253 incl %ebx /* system or interrupt */
2541:
255 movl PCPU(CPUID), %eax
256 movl %ebx, checkstate_cpustate(,%eax,4)
257 movl PCPU(CURPROC), %ebx
258 movl %ebx, checkstate_curproc(,%eax,4)
230 movl PCPU(CURPROC),%ebx
231 incl P_INTR_NESTING_LEVEL(%ebx)
232 call forwarded_hardclock
233 decl P_INTR_NESTING_LEVEL(%ebx)
234 MEXITCOUNT
235 jmp doreti
259
236
260 movl 16(%esp), %ebx
261 movl %ebx, checkstate_pc(,%eax,4)
237/*
238 * Forward statclock to another CPU. Pushes a trapframe and calls
239 * forwarded_statclock().
240 */
241 .text
242 SUPERALIGN_TEXT
243 .globl Xstatclock
244Xstatclock:
245 PUSH_FRAME
246 movl $KDSEL, %eax /* reload with kernel's data segment */
247 mov %ax, %ds
248 mov %ax, %es
249 movl $KPSEL, %eax
250 mov %ax, %fs
262
251
263 lock /* checkstate_probed_cpus |= (1<<id) */
264 btsl %eax, checkstate_probed_cpus
252 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
265
253
266 popl %fs
267 popl %ds /* restore previous data segment */
268 popl %ebx
269 popl %eax
270 iret
254 FAKE_MCOUNT(13*4(%esp))
255 movl PCPU(CURPROC),%ebx
256 incl P_INTR_NESTING_LEVEL(%ebx)
257 call forwarded_statclock
258 decl P_INTR_NESTING_LEVEL(%ebx)
259 MEXITCOUNT
260 jmp doreti
271
261
272
273/*
274 * Executed by a CPU when it receives an Xcpuast IPI from another CPU,
275 *
262/*
263 * Executed by a CPU when it receives an Xcpuast IPI from another CPU,
264 *
276 * - Signals its receipt by clearing bit cpuid in checkstate_need_ast.
277 *
278 * - We need a better method of triggering asts on other cpus.
265 * The other CPU has already executed aston() or need_resched() on our
266 * current process, so we simply need to ack the interrupt and return
267 * via doreti to run ast().
279 */
280
281 .text
282 SUPERALIGN_TEXT
283 .globl Xcpuast
284Xcpuast:
285 PUSH_FRAME
286 movl $KDSEL, %eax
287 mov %ax, %ds /* use KERNEL data segment */
288 mov %ax, %es
289 movl $KPSEL, %eax
290 mov %ax, %fs
291
268 */
269
270 .text
271 SUPERALIGN_TEXT
272 .globl Xcpuast
273Xcpuast:
274 PUSH_FRAME
275 movl $KDSEL, %eax
276 mov %ax, %ds /* use KERNEL data segment */
277 mov %ax, %es
278 movl $KPSEL, %eax
279 mov %ax, %fs
280
292 movl PCPU(CPUID), %eax
293 lock /* checkstate_need_ast &= ~(1<<id) */
294 btrl %eax, checkstate_need_ast
295 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
296
281 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
282
297 lock
298 btsl %eax, checkstate_pending_ast
299 jc 1f
300
301 FAKE_MCOUNT(13*4(%esp))
302
283 FAKE_MCOUNT(13*4(%esp))
284
303 MTX_LOCK_SPIN(sched_lock, 0)
304 movl PCPU(CURPROC),%ebx
305 orl $PS_ASTPENDING, P_SFLAG(%ebx)
306
307 movl PCPU(CPUID), %eax
308 lock
309 btrl %eax, checkstate_pending_ast
310 lock
311 btrl %eax, CNAME(resched_cpus)
312 jnc 2f
313 orl $PS_NEEDRESCHED, P_SFLAG(%ebx)
314 lock
315 incl CNAME(want_resched_cnt)
3162:
317 MTX_UNLOCK_SPIN(sched_lock)
318 lock
319 incl CNAME(cpuast_cnt)
320 MEXITCOUNT
321 jmp doreti
285 MEXITCOUNT
286 jmp doreti
3221:
323 /* We are already in the process of delivering an ast for this CPU */
324 POP_FRAME
325 iret
326
327/*
328 * Executed by a CPU when it receives an Xcpustop IPI from another CPU,
329 *
330 * - Signals its receipt.
331 * - Waits for permission to restart.
332 * - Signals its restart.
333 */
287
288/*
289 * Executed by a CPU when it receives an Xcpustop IPI from another CPU,
290 *
291 * - Signals its receipt.
292 * - Waits for permission to restart.
293 * - Signals its restart.
294 */
334
335 .text
336 SUPERALIGN_TEXT
337 .globl Xcpustop
338Xcpustop:
339 pushl %ebp
340 movl %esp, %ebp
341 pushl %eax
342 pushl %ecx

--- 9 unchanged lines hidden (view full) ---

352 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
353
354 movl PCPU(CPUID), %eax
355 imull $PCB_SIZE, %eax
356 leal CNAME(stoppcbs)(%eax), %eax
357 pushl %eax
358 call CNAME(savectx) /* Save process context */
359 addl $4, %esp
295 .text
296 SUPERALIGN_TEXT
297 .globl Xcpustop
298Xcpustop:
299 pushl %ebp
300 movl %esp, %ebp
301 pushl %eax
302 pushl %ecx

--- 9 unchanged lines hidden (view full) ---

312 movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
313
314 movl PCPU(CPUID), %eax
315 imull $PCB_SIZE, %eax
316 leal CNAME(stoppcbs)(%eax), %eax
317 pushl %eax
318 call CNAME(savectx) /* Save process context */
319 addl $4, %esp
360
361
362 movl PCPU(CPUID), %eax
363
364 lock
320
321 movl PCPU(CPUID), %eax
322
323 lock
365 btsl %eax, stopped_cpus /* stopped_cpus |= (1<<id) */
324 btsl %eax, CNAME(stopped_cpus) /* stopped_cpus |= (1<<id) */
3661:
3251:
367 btl %eax, started_cpus /* while (!(started_cpus & (1<<id))) */
326 btl %eax, CNAME(started_cpus) /* while (!(started_cpus & (1<<id))) */
368 jnc 1b
369
370 lock
327 jnc 1b
328
329 lock
371 btrl %eax, started_cpus /* started_cpus &= ~(1<<id) */
330 btrl %eax, CNAME(started_cpus) /* started_cpus &= ~(1<<id) */
372 lock
331 lock
373 btrl %eax, stopped_cpus /* stopped_cpus &= ~(1<<id) */
332 btrl %eax, CNAME(stopped_cpus) /* stopped_cpus &= ~(1<<id) */
374
375 test %eax, %eax
376 jnz 2f
377
378 movl CNAME(cpustop_restartfunc), %eax
379 test %eax, %eax
380 jz 2f
381 movl $0, CNAME(cpustop_restartfunc) /* One-shot */

--- 105 unchanged lines hidden (view full) ---

487 .data
488
489#ifdef COUNT_XINVLTLB_HITS
490 .globl _xhits
491_xhits:
492 .space (NCPU * 4), 0
493#endif /* COUNT_XINVLTLB_HITS */
494
333
334 test %eax, %eax
335 jnz 2f
336
337 movl CNAME(cpustop_restartfunc), %eax
338 test %eax, %eax
339 jz 2f
340 movl $0, CNAME(cpustop_restartfunc) /* One-shot */

--- 105 unchanged lines hidden (view full) ---

446 .data
447
448#ifdef COUNT_XINVLTLB_HITS
449 .globl _xhits
450_xhits:
451 .space (NCPU * 4), 0
452#endif /* COUNT_XINVLTLB_HITS */
453
495/* variables used by stop_cpus()/restart_cpus()/Xcpustop */
496 .globl stopped_cpus, started_cpus
497stopped_cpus:
498 .long 0
499started_cpus:
500 .long 0
501
502 .globl checkstate_probed_cpus
503checkstate_probed_cpus:
504 .long 0
505 .globl checkstate_need_ast
506checkstate_need_ast:
507 .long 0
508checkstate_pending_ast:
509 .long 0
510 .globl CNAME(resched_cpus)
511 .globl CNAME(want_resched_cnt)
512 .globl CNAME(cpuast_cnt)
513 .globl CNAME(cpustop_restartfunc)
514CNAME(resched_cpus):
515 .long 0
516CNAME(want_resched_cnt):
517 .long 0
518CNAME(cpuast_cnt):
519 .long 0
520CNAME(cpustop_restartfunc):
521 .long 0
522
523 .globl apic_pin_trigger
524apic_pin_trigger:
525 .long 0
526
527 .text
454 .globl apic_pin_trigger
455apic_pin_trigger:
456 .long 0
457
458 .text