apic_vector.s:

- added Xcpustop IPI code to support stop_cpus()/restart_cpus().
   it is off by default, enable via smptests.h:TEST_CPUSTOP

intr_machdep.h:
 - moved +ICULEN to lower level.
 - added entry for Xcpustop.
This commit is contained in:
Steve Passe 1997-06-27 23:48:05 +00:00
parent 31d3baa2e0
commit 58db75841d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27007
5 changed files with 246 additions and 7 deletions

View file

@ -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

View file

@ -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));

View file

@ -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

View file

@ -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

View file

@ -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));