diff options
-rw-r--r-- | sys/amd64/amd64/apic_vector.S | 77 | ||||
-rw-r--r-- | sys/amd64/isa/intr_machdep.h | 11 | ||||
-rw-r--r-- | sys/i386/i386/apic_vector.s | 77 | ||||
-rw-r--r-- | sys/i386/isa/apic_vector.s | 77 | ||||
-rw-r--r-- | sys/i386/isa/intr_machdep.h | 11 |
5 files changed, 246 insertions, 7 deletions
diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S index fa7edb0..debc249 100644 --- a/sys/amd64/amd64/apic_vector.S +++ b/sys/amd64/amd64/apic_vector.S @@ -1,9 +1,11 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.2 1997/05/31 08:59:51 peter Exp $ + * $Id: apic_vector.s,v 1.1 1997/06/26 17:52:12 smp Exp smp $ */ +#include <machine/smptests.h> /** TEST_CPUSTOP */ + /* convert an absolute IRQ# into a bitmask */ #define IRQ_BIT(irq_num) (1 << (irq_num)) @@ -178,6 +180,69 @@ _Xinvltlb: popl %eax iret +#ifdef TEST_CPUSTOP +/* + * Executed by a CPU when it receives an Xcpustop IPI from another CPU, + * + * - Signals its receipt. + * - Waits for permission to restart. + * - Signals its restart. + */ + + .text + SUPERALIGN_TEXT + .globl _Xcpustop +_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 */ + + movl _cpuid, %eax /* id */ + + lock + btsl %eax, _stopped_cpus /* stopped_cpus |= (1<<id) */ + +#ifdef DEBUG_CPUSTOP + movb $0x51, %al + outb %al, $POST_ADDR + movl _cpuid, %eax /* RESTORE id */ +#endif + +1: + btl %eax, _started_cpus /* while (!(started_cpus & (1<<id))) */ + jnc 1b + +#ifdef DEBUG_CPUSTOP + movb $0x52, %al + outb %al, $POST_ADDR + movl _cpuid, %eax /* RESTORE id */ +#endif + + lock + btrl %eax, _started_cpus /* started_cpus &= ~(1<<id) */ + +#ifdef DEBUG_CPUSTOP + movb $0x53, %al + outb %al, $POST_ADDR +#endif + + movl $lapic_eoi, %eax + movl $0, (%eax) /* End Of Interrupt to APIC */ + + popl %ds /* restore previous data segment */ + popl %eax + + iret +#endif /* TEST_CPUSTOP */ + + MCOUNT_LABEL(bintr) FAST_INTR(0,fastintr0) FAST_INTR(1,fastintr1) @@ -262,6 +327,16 @@ _ivectors: iactive: .long 0 +#ifdef TEST_CPUSTOP + .globl _stopped_cpus +_stopped_cpus: + .long 0 + + .globl _started_cpus +_started_cpus: + .long 0 +#endif /* TEST_CPUSTOP */ + /* * Interrupt counters and names. The format of these and the label names diff --git a/sys/amd64/isa/intr_machdep.h b/sys/amd64/isa/intr_machdep.h index a9a512e..8e43e98 100644 --- a/sys/amd64/isa/intr_machdep.h +++ b/sys/amd64/isa/intr_machdep.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91 - * $Id: isa_device.h,v 1.39 1997/04/27 21:18:58 fsmp Exp $ + * $Id: intr_machdep.h,v 1.1 1997/06/26 17:31:00 smp Exp smp $ */ #ifndef _I386_ISA_INTR_MACHDEP_H_ @@ -82,10 +82,17 @@ inthand_t inthand_t IDTVEC(intr16), IDTVEC(intr17), IDTVEC(intr18), IDTVEC(intr19), IDTVEC(intr20), IDTVEC(intr21), IDTVEC(intr22), IDTVEC(intr23); -#define XINVLTLB_OFFSET 32 + +#define XINVLTLB_OFFSET (ICU_OFFSET + 32) inthand_t Xinvltlb; +#if defined(TEST_CPUSTOP) +#define XCPUSTOP_OFFSET (ICU_OFFSET + 64) +inthand_t + Xcpustop; +#endif /* TEST_CPUSTOP */ + struct isa_device; void isa_defaultirq __P((void)); diff --git a/sys/i386/i386/apic_vector.s b/sys/i386/i386/apic_vector.s index fa7edb0..debc249 100644 --- a/sys/i386/i386/apic_vector.s +++ b/sys/i386/i386/apic_vector.s @@ -1,9 +1,11 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.2 1997/05/31 08:59:51 peter Exp $ + * $Id: apic_vector.s,v 1.1 1997/06/26 17:52:12 smp Exp smp $ */ +#include <machine/smptests.h> /** TEST_CPUSTOP */ + /* convert an absolute IRQ# into a bitmask */ #define IRQ_BIT(irq_num) (1 << (irq_num)) @@ -178,6 +180,69 @@ _Xinvltlb: popl %eax iret +#ifdef TEST_CPUSTOP +/* + * Executed by a CPU when it receives an Xcpustop IPI from another CPU, + * + * - Signals its receipt. + * - Waits for permission to restart. + * - Signals its restart. + */ + + .text + SUPERALIGN_TEXT + .globl _Xcpustop +_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 */ + + movl _cpuid, %eax /* id */ + + lock + btsl %eax, _stopped_cpus /* stopped_cpus |= (1<<id) */ + +#ifdef DEBUG_CPUSTOP + movb $0x51, %al + outb %al, $POST_ADDR + movl _cpuid, %eax /* RESTORE id */ +#endif + +1: + btl %eax, _started_cpus /* while (!(started_cpus & (1<<id))) */ + jnc 1b + +#ifdef DEBUG_CPUSTOP + movb $0x52, %al + outb %al, $POST_ADDR + movl _cpuid, %eax /* RESTORE id */ +#endif + + lock + btrl %eax, _started_cpus /* started_cpus &= ~(1<<id) */ + +#ifdef DEBUG_CPUSTOP + movb $0x53, %al + outb %al, $POST_ADDR +#endif + + movl $lapic_eoi, %eax + movl $0, (%eax) /* End Of Interrupt to APIC */ + + popl %ds /* restore previous data segment */ + popl %eax + + iret +#endif /* TEST_CPUSTOP */ + + MCOUNT_LABEL(bintr) FAST_INTR(0,fastintr0) FAST_INTR(1,fastintr1) @@ -262,6 +327,16 @@ _ivectors: iactive: .long 0 +#ifdef TEST_CPUSTOP + .globl _stopped_cpus +_stopped_cpus: + .long 0 + + .globl _started_cpus +_started_cpus: + .long 0 +#endif /* TEST_CPUSTOP */ + /* * Interrupt counters and names. The format of these and the label names diff --git a/sys/i386/isa/apic_vector.s b/sys/i386/isa/apic_vector.s index fa7edb0..debc249 100644 --- a/sys/i386/isa/apic_vector.s +++ b/sys/i386/isa/apic_vector.s @@ -1,9 +1,11 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.2 1997/05/31 08:59:51 peter Exp $ + * $Id: apic_vector.s,v 1.1 1997/06/26 17:52:12 smp Exp smp $ */ +#include <machine/smptests.h> /** TEST_CPUSTOP */ + /* convert an absolute IRQ# into a bitmask */ #define IRQ_BIT(irq_num) (1 << (irq_num)) @@ -178,6 +180,69 @@ _Xinvltlb: popl %eax iret +#ifdef TEST_CPUSTOP +/* + * Executed by a CPU when it receives an Xcpustop IPI from another CPU, + * + * - Signals its receipt. + * - Waits for permission to restart. + * - Signals its restart. + */ + + .text + SUPERALIGN_TEXT + .globl _Xcpustop +_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 */ + + movl _cpuid, %eax /* id */ + + lock + btsl %eax, _stopped_cpus /* stopped_cpus |= (1<<id) */ + +#ifdef DEBUG_CPUSTOP + movb $0x51, %al + outb %al, $POST_ADDR + movl _cpuid, %eax /* RESTORE id */ +#endif + +1: + btl %eax, _started_cpus /* while (!(started_cpus & (1<<id))) */ + jnc 1b + +#ifdef DEBUG_CPUSTOP + movb $0x52, %al + outb %al, $POST_ADDR + movl _cpuid, %eax /* RESTORE id */ +#endif + + lock + btrl %eax, _started_cpus /* started_cpus &= ~(1<<id) */ + +#ifdef DEBUG_CPUSTOP + movb $0x53, %al + outb %al, $POST_ADDR +#endif + + movl $lapic_eoi, %eax + movl $0, (%eax) /* End Of Interrupt to APIC */ + + popl %ds /* restore previous data segment */ + popl %eax + + iret +#endif /* TEST_CPUSTOP */ + + MCOUNT_LABEL(bintr) FAST_INTR(0,fastintr0) FAST_INTR(1,fastintr1) @@ -262,6 +327,16 @@ _ivectors: iactive: .long 0 +#ifdef TEST_CPUSTOP + .globl _stopped_cpus +_stopped_cpus: + .long 0 + + .globl _started_cpus +_started_cpus: + .long 0 +#endif /* TEST_CPUSTOP */ + /* * Interrupt counters and names. The format of these and the label names diff --git a/sys/i386/isa/intr_machdep.h b/sys/i386/isa/intr_machdep.h index a9a512e..8e43e98 100644 --- a/sys/i386/isa/intr_machdep.h +++ b/sys/i386/isa/intr_machdep.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91 - * $Id: isa_device.h,v 1.39 1997/04/27 21:18:58 fsmp Exp $ + * $Id: intr_machdep.h,v 1.1 1997/06/26 17:31:00 smp Exp smp $ */ #ifndef _I386_ISA_INTR_MACHDEP_H_ @@ -82,10 +82,17 @@ inthand_t inthand_t IDTVEC(intr16), IDTVEC(intr17), IDTVEC(intr18), IDTVEC(intr19), IDTVEC(intr20), IDTVEC(intr21), IDTVEC(intr22), IDTVEC(intr23); -#define XINVLTLB_OFFSET 32 + +#define XINVLTLB_OFFSET (ICU_OFFSET + 32) inthand_t Xinvltlb; +#if defined(TEST_CPUSTOP) +#define XCPUSTOP_OFFSET (ICU_OFFSET + 64) +inthand_t + Xcpustop; +#endif /* TEST_CPUSTOP */ + struct isa_device; void isa_defaultirq __P((void)); |