Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/sommerfeld_i386mp_1]: src/sys/arch/i386/i386 MP support: use cpu_info fi...
details: https://anonhg.NetBSD.org/src/rev/95ee264e3cf9
branches: sommerfeld_i386mp_1
changeset: 482172:95ee264e3cf9
user: sommerfeld <sommerfeld%NetBSD.org@localhost>
date: Sun Feb 20 18:06:41 2000 +0000
description:
MP support: use cpu_info fields rather than globals where appropriate.
Adapt to intr.h changes.
miscellaneous other tweaks.
cpu_switch and related code still needs changes for appropriate
locking around context switch time.
diffstat:
sys/arch/i386/i386/locore.s | 260 +++++++++++++++++++++++++++++++++-----------
1 files changed, 195 insertions(+), 65 deletions(-)
diffs (truncated from 680 to 300 lines):
diff -r 530c44a21202 -r 95ee264e3cf9 sys/arch/i386/i386/locore.s
--- a/sys/arch/i386/i386/locore.s Sun Feb 20 18:03:42 2000 +0000
+++ b/sys/arch/i386/i386/locore.s Sun Feb 20 18:06:41 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.215 2000/01/06 18:41:24 drochner Exp $ */
+/* $NetBSD: locore.s,v 1.215.2.1 2000/02/20 18:06:41 sommerfeld Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -83,11 +83,14 @@
#include "opt_compat_linux.h"
#include "opt_compat_ibcs2.h"
#include "opt_compat_svr4.h"
+#include "opt_multiprocessor.h"
#include "opt_compat_oldboot.h"
#include "npx.h"
#include "assym.h"
#include "apm.h"
+#include "lapic.h"
+#include "ioapic.h"
#include <sys/errno.h>
#include <sys/syscall.h>
@@ -112,6 +115,10 @@
#include <machine/trap.h>
#include <machine/bootinfo.h>
+#if NLAPIC > 0
+#include <machine/i82489reg.h>
+#endif
+
/*
* override user-land alignment before including asm.h
*/
@@ -127,6 +134,70 @@
#define _ALIGN_TEXT ALIGN_TEXT
#include <machine/asm.h>
+#define CPL _C_LABEL(lapic_tpr)
+
+#if defined(MULTIPROCESSOR)
+
+#include <machine/i82489reg.h>
+
+#define GET_CPUINFO(reg) \
+ movzbl _C_LABEL(local_apic)+LAPIC_ID+3,reg ; \
+ movl _C_LABEL(cpu_info)(,reg,4),reg
+
+#define GET_CURPROC(reg, treg) \
+ GET_CPUINFO(treg) ; \
+ movl CPU_INFO_CURPROC(treg),reg
+
+#define PUSH_CURPROC(treg) \
+ GET_CPUINFO(treg) ; \
+ pushl CPU_INFO_CURPROC(treg)
+
+#define CLEAR_CURPROC(treg) \
+ GET_CPUINFO(treg) ; \
+ movl $0,CPU_INFO_CURPROC(treg)
+
+#define SET_CURPROC(reg,treg) \
+ GET_CPUINFO(treg) ; \
+ movl reg,CPU_INFO_CURPROC(treg)
+
+#define GET_CURPCB(reg) \
+ GET_CPUINFO(reg) ; \
+ movl CPU_INFO_CURPCB(reg),reg
+
+#define SET_CURPCB(reg,treg) \
+ GET_CPUINFO(treg) ; \
+ movl reg,CPU_INFO_CURPCB(treg)
+
+#define CLEAR_RESCHED(treg) \
+ GET_CPUINFO(treg) ; \
+ xorl %eax,%eax ; \
+ movl %eax,CPU_INFO_RESCHED(treg)
+
+#define CHECK_ASTPENDING(treg) \
+ GET_CPUINFO(treg) ;\
+ cmpl $0,CPU_INFO_ASTPENDING(treg)
+
+#define CLEAR_ASTPENDING(cireg) \
+ movl $0,CPU_INFO_ASTPENDING(cireg)
+
+#else
+
+#define GET_CURPROC(reg,treg) movl _C_LABEL(curproc),reg
+#define CLEAR_CURPROC(treg) movl $0,_C_LABEL(curproc)
+#define SET_CURPROC(reg,treg) movl reg,_C_LABEL(curproc)
+#define PUSH_CURPROC(treg) pushl _C_LABEL(curproc)
+
+#define GET_CURPCB(reg) movl _C_LABEL(curpcb),reg
+#define SET_CURPCB(reg,treg) movl reg,_C_LABEL(curpcb)
+
+#define CHECK_ASTPENDING(treg) cmpb $0,_C_LABEL(astpending)
+#define CLEAR_ASTPENDING(treg) movb $0,_C_LABEL(astpending)
+
+#define CLEAR_RESCHED(treg) \
+ xorl %eax,%eax ;\
+ movl %eax,_C_LABEL(want_resched) ;
+
+#endif
/* XXX temporary kluge; these should not be here */
#define IOM_BEGIN 0x0a0000 /* start of I/O memory "hole" */
@@ -220,12 +291,33 @@
#ifdef COMPAT_OLDBOOT
.globl _C_LABEL(bootdev)
#endif
- .globl _C_LABEL(proc0paddr),_C_LABEL(curpcb),_C_LABEL(PTDpaddr)
+ .globl _C_LABEL(proc0paddr),_C_LABEL(PTDpaddr)
.globl _C_LABEL(biosbasemem),_C_LABEL(biosextmem)
.globl _C_LABEL(gdt)
+#ifndef MULTIPROCESSOR
+ .globl _C_LABEL(curpcb)
+#endif
#ifdef I586_CPU
.globl _C_LABEL(idt)
#endif
+ .globl _C_LABEL(lapic_tpr)
+
+#if NLAPIC > 0
+ .globl _C_LABEL(local_apic)
+_C_LABEL(local_apic):
+ .space LAPIC_TPRI
+_C_LABEL(lapic_tpr):
+ .space LAPIC_PPRI-LAPIC_TPRI
+_C_LABEL(lapic_ppr):
+ .space LAPIC_ISR-LAPIC_PPRI
+_C_LABEL(lapic_isr):
+ .space NBPG-LAPIC_ISR
+#else
+ _C_LABEL(lapic_tpr):
+ .long 0
+#endif
+
+
_C_LABEL(cpu): .long 0 # are we 386, 386sx, or 486,
# or Pentium, or..
_C_LABEL(cpu_id): .long 0 # saved from `cpuid' instruction
@@ -709,6 +801,7 @@
pushl %ebx
call %esi
addl $4,%esp
+ movl $0,CPL
INTRFASTEXIT
/* NOTREACHED */
@@ -1012,7 +1105,7 @@
ENTRY(kcopy)
pushl %esi
pushl %edi
- movl _C_LABEL(curpcb),%eax # load curpcb into eax and set on-fault
+ GET_CURPCB(%eax) # load curpcb into eax and set on-fault
pushl PCB_ONFAULT(%eax)
movl $_C_LABEL(copy_fault), PCB_ONFAULT(%eax)
@@ -1032,7 +1125,7 @@
rep
movsb
- movl _C_LABEL(curpcb),%edx
+ GET_CURPCB(%edx) # XXX save curpcb?
popl PCB_ONFAULT(%edx)
popl %edi
popl %esi
@@ -1056,7 +1149,7 @@
movsl
cld
- movl _C_LABEL(curpcb),%edx
+ GET_CURPCB(%edx)
popl PCB_ONFAULT(%edx)
popl %edi
popl %esi
@@ -1120,7 +1213,7 @@
/* Compute PTE offset for start address. */
shrl $PGSHIFT,%edi
- movl _C_LABEL(curpcb),%edx
+ GET_CURPCB(%edx)
movl $2f,PCB_ONFAULT(%edx)
1: /* Check PTE for each page. */
@@ -1149,7 +1242,7 @@
jmp _C_LABEL(copy_fault)
#endif /* I386_CPU */
-3: movl _C_LABEL(curpcb),%edx
+3: GET_CURPCB(%edx)
movl $_C_LABEL(copy_fault),PCB_ONFAULT(%edx)
/* bcopy(%esi, %edi, %eax); */
@@ -1176,7 +1269,7 @@
ENTRY(copyin)
pushl %esi
pushl %edi
- movl _C_LABEL(curpcb),%eax
+ GET_CURPCB(%eax)
pushl $0
movl $_C_LABEL(copy_fault),PCB_ONFAULT(%eax)
@@ -1206,7 +1299,7 @@
rep
movsb
- movl _C_LABEL(curpcb),%edx
+ GET_CURPCB(%edx)
popl PCB_ONFAULT(%edx)
popl %edi
popl %esi
@@ -1214,7 +1307,7 @@
ret
ENTRY(copy_fault)
- movl _C_LABEL(curpcb),%edx
+ GET_CURPCB(%edx)
popl PCB_ONFAULT(%edx)
popl %edi
popl %esi
@@ -1248,7 +1341,7 @@
movl $NBPG,%ecx
subl %eax,%ecx # ecx = NBPG - (src % NBPG)
- movl _C_LABEL(curpcb),%eax
+ GET_CURPCB(%eax)
movl $6f,PCB_ONFAULT(%eax)
1: /*
@@ -1303,7 +1396,7 @@
#endif /* I386_CPU */
#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)
-5: movl _C_LABEL(curpcb),%eax
+5: GET_CURPCB(%eax)
movl $_C_LABEL(copystr_fault),PCB_ONFAULT(%eax)
/*
* Get min(%edx, VM_MAXUSER_ADDRESS-%edi).
@@ -1347,7 +1440,7 @@
ENTRY(copyinstr)
pushl %esi
pushl %edi
- movl _C_LABEL(curpcb),%ecx
+ GET_CURPCB(%ecx)
movl $_C_LABEL(copystr_fault),PCB_ONFAULT(%ecx)
movl 12(%esp),%esi # %esi = from
@@ -1390,7 +1483,7 @@
copystr_return:
/* Set *lencopied and return %eax. */
- movl _C_LABEL(curpcb),%ecx
+ GET_CURPCB(%ecx)
movl $0,PCB_ONFAULT(%ecx)
movl 20(%esp),%ecx
subl %edx,%ecx
@@ -1454,7 +1547,7 @@
movl 4(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-4,%edx
ja _C_LABEL(fusuaddrfault)
- movl _C_LABEL(curpcb),%ecx
+ GET_CURPCB(%ecx)
movl $_C_LABEL(fusufault),PCB_ONFAULT(%ecx)
movl (%edx),%eax
movl $0,PCB_ONFAULT(%ecx)
@@ -1468,7 +1561,7 @@
movl 4(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-2,%edx
ja _C_LABEL(fusuaddrfault)
- movl _C_LABEL(curpcb),%ecx
+ GET_CURPCB(%ecx)
movl $_C_LABEL(fusufault),PCB_ONFAULT(%ecx)
movzwl (%edx),%eax
movl $0,PCB_ONFAULT(%ecx)
@@ -1483,7 +1576,7 @@
movl 4(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-2,%edx
ja _C_LABEL(fusuaddrfault)
- movl _C_LABEL(curpcb),%ecx
+ GET_CURPCB(%ecx)
movl $_C_LABEL(fusubail),PCB_ONFAULT(%ecx)
movzwl (%edx),%eax
movl $0,PCB_ONFAULT(%ecx)
@@ -1497,7 +1590,7 @@
movl 4(%esp),%edx
cmpl $VM_MAXUSER_ADDRESS-1,%edx
ja _C_LABEL(fusuaddrfault)
- movl _C_LABEL(curpcb),%ecx
+ GET_CURPCB(%ecx)
movl $_C_LABEL(fusufault),PCB_ONFAULT(%ecx)
movzbl (%edx),%eax
movl $0,PCB_ONFAULT(%ecx)
@@ -1543,7 +1636,7 @@
jne 2f
#endif /* I486_CPU || I586_CPU || I686_CPU */
- movl _C_LABEL(curpcb),%eax
+ GET_CURPCB(%eax)
movl $3f,PCB_ONFAULT(%eax)
Home |
Main Index |
Thread Index |
Old Index