From b956b5370c5af3f239c38c446d1481e551b0072d Mon Sep 17 00:00:00 2001 From: Steve Passe Date: Sun, 6 Jul 1997 23:32:38 +0000 Subject: [PATCH] First cut at code for handling "spurious INTerrupts". First cut at code for handling CPU stop/restart. Notes: not working properly yet. --- sys/amd64/amd64/apic_vector.S | 106 +++++++++++++++++++++++++++------- sys/i386/i386/apic_vector.s | 106 +++++++++++++++++++++++++++------- sys/i386/isa/apic_vector.s | 106 +++++++++++++++++++++++++++------- 3 files changed, 252 insertions(+), 66 deletions(-) diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S index debc24961223..3c0bfab4d231 100644 --- a/sys/amd64/amd64/apic_vector.S +++ b/sys/amd64/amd64/apic_vector.S @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.1 1997/06/26 17:52:12 smp Exp smp $ + * $Id: apic_vector.s,v 1.3 1997/07/06 23:29:00 smp Exp smp $ */ @@ -167,20 +167,67 @@ __CONCAT(Xresume,irq_num): ; \ addl $4+4,%esp ; \ iret + +/* + * Handle TLB shootdowns. + */ .text SUPERALIGN_TEXT .globl _Xinvltlb _Xinvltlb: pushl %eax + +#ifdef COUNT_XINVLTLB_HITS + ss + movl _cpuid, %eax + ss + incl _xhits(,%eax,4) +#endif /* COUNT_XINVLTLB_HITS */ + movl %cr3, %eax /* invalidate the TLB */ movl %eax, %cr3 + movl $lapic_eoi, %eax ss /* stack segment, avoid %ds load */ movl $0, (%eax) /* End Of Interrupt to APIC */ + popl %eax iret + +/* + * Handle "spurious INTerrupts". + * Notes: + * This is different than the "spurious INTerrupt" generated by an + * 8259 PIC for missing INTs. See the APIC documentation for details. + * This routine should NOT do an 'EOI' cycle. + */ + .text + SUPERALIGN_TEXT + .globl _Xspuriousint +_Xspuriousint: + pushl %eax + pushl %ds /* save current data segment */ + + movl $KDSEL, %eax + movl %ax, %ds /* use KERNEL data segment */ + +#if 1 + ASMPOSTCODE_HI(0xc0) +#endif +#ifdef COUNT_SPURIOUS_INTS + incl _sihits +#endif + + /* No EOI cycle used here */ + + popl %ds /* restore previous data segment */ + popl %eax + iret + + #ifdef TEST_CPUSTOP + /* * Executed by a CPU when it receives an Xcpustop IPI from another CPU, * @@ -196,50 +243,42 @@ _Xcpustop: pushl %eax pushl %ds /* save current data segment */ -#ifdef DEBUG_CPUSTOP - movb $0x50, %al - outb %al, $POST_ADDR -#endif - movl $KDSEL, %eax movl %ax, %ds /* use KERNEL data segment */ +#if 1 +/** XXX still trying to make this !^#$#% thing work... */ + + movl _cpuid, %eax + incl _cshits(,%eax,4) +#else /** !^#$#% */ + ASMPOSTCODE_HI(0x10) + movl _cpuid, %eax /* id */ lock btsl %eax, _stopped_cpus /* stopped_cpus |= (1<