summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2004-06-22 01:16:51 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2004-06-22 01:16:51 +0000
commitb867d3bf3e2c58679d9e9b015e5c0681960246ba (patch)
tree04cfa97f3e6c728503f131fbde87b8e1caeca1ac
parent02a7c0805e8a7a257c55e031889f3dd3c5794614 (diff)
Switch amd64 to __HAVE_CPUINFO
deraadt@ ok
-rw-r--r--sys/arch/amd64/amd64/genassym.cf3
-rw-r--r--sys/arch/amd64/amd64/locore.S11
-rw-r--r--sys/arch/amd64/amd64/machdep.c4
-rw-r--r--sys/arch/amd64/include/cpu.h35
-rw-r--r--sys/arch/amd64/include/types.h10
-rw-r--r--sys/arch/amd64/include/userret.h4
-rw-r--r--sys/sys/sched.h4
7 files changed, 20 insertions, 51 deletions
diff --git a/sys/arch/amd64/amd64/genassym.cf b/sys/arch/amd64/amd64/genassym.cf
index a56769705b4..7061ce92c6b 100644
--- a/sys/arch/amd64/amd64/genassym.cf
+++ b/sys/arch/amd64/amd64/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.4 2004/06/13 21:49:12 niklas Exp $
+# $OpenBSD: genassym.cf,v 1.5 2004/06/22 01:16:50 art Exp $
# Written by Artur Grabowski art@openbsd.org, Public Domain
@@ -41,6 +41,7 @@ member P_MD_REGS p_md.md_regs
member P_MD_FLAGS p_md.md_flags
member P_MD_ASTPENDING p_md.md_astpending
member p_flag
+member p_cpu
export P_SYSTEM
diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S
index 665161f05c6..a32e5de4edb 100644
--- a/sys/arch/amd64/amd64/locore.S
+++ b/sys/arch/amd64/amd64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.12 2004/06/21 22:35:47 niklas Exp $ */
+/* $OpenBSD: locore.S,v 1.13 2004/06/22 01:16:50 art Exp $ */
/* $NetBSD: locore.S,v 1.2 2003/04/26 19:34:45 fvdl Exp $ */
/*
@@ -142,20 +142,11 @@
#include <machine/asm.h>
-#if defined(MULTIPROCESSOR)
-
#define SET_CURPROC(proc,cpu) \
movq CPUVAR(SELF),cpu ; \
movq proc,CPUVAR(CURPROC) ; \
movq cpu,P_CPU(proc)
-#else
-
-#define SET_CURPROC(proc,tcpu) movq proc,CPUVAR(CURPROC)
-#define GET_CURPROC(reg) movq CPUVAR(CURPROC),reg
-
-#endif
-
#define GET_CURPCB(reg) movq CPUVAR(CURPCB),reg
#define SET_CURPCB(reg) movq reg,CPUVAR(CURPCB)
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 2d8b3eb11aa..7516289ac0b 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.24 2004/05/13 20:20:24 sturm Exp $ */
+/* $OpenBSD: machdep.c,v 1.25 2004/06/22 01:16:50 art Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -1821,7 +1821,6 @@ microtime(struct timeval *tv)
}
#endif
-#ifdef MULTIPROCESSOR
void
need_resched(struct cpu_info *ci)
{
@@ -1829,7 +1828,6 @@ need_resched(struct cpu_info *ci)
if ((ci)->ci_curproc != NULL)
aston((ci)->ci_curproc);
}
-#endif
/*
* Allocate an IDT vector slot within the given range.
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 9caf05b561d..4cd297e86b9 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.7 2004/06/13 21:49:13 niklas Exp $ */
+/* $OpenBSD: cpu.h,v 1.8 2004/06/22 01:16:50 art Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -53,13 +53,12 @@
#include <sys/device.h>
#include <sys/lock.h>
+#include <sys/sched.h>
struct cpu_info {
struct device *ci_dev;
struct cpu_info *ci_self;
-#if 0
struct schedstate_percpu ci_schedstate; /* scheduler state */
-#endif
struct cpu_info *ci_next;
struct proc *ci_curproc;
@@ -141,6 +140,12 @@ extern struct cpu_info *cpu_info_list;
#define CPU_INFO_FOREACH(cii, ci) cii = 0, ci = cpu_info_list; \
ci != NULL; ci = ci->ci_next
+/*
+ * Preempt the current process if in interrupt from user mode,
+ * or after the current trap/syscall if in system mode.
+ */
+extern void need_resched(struct cpu_info *);
+
#if defined(MULTIPROCESSOR)
#define X86_MAXPROCS 32 /* bitmask; can be bumped to 64 */
@@ -161,13 +166,6 @@ extern struct cpu_info *cpu_info[X86_MAXPROCS];
void cpu_boot_secondary_processors(void);
void cpu_init_idle_pcbs(void);
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-extern void need_resched(struct cpu_info *);
-
#else /* !MULTIPROCESSOR */
#define X86_MAXPROCS 1
@@ -179,6 +177,8 @@ extern struct cpu_info cpu_info_primary;
#endif
+#include <machine/psl.h>
+
/*
* definitions of cpu-dependent requirements
* referenced in generic code
@@ -186,19 +186,6 @@ extern struct cpu_info cpu_info_primary;
#define cpu_number() 0
#define CPU_IS_PRIMARY(ci) 1
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-
-#define need_resched(ci) \
-do { \
- struct cpu_info *__ci = curcpu(); \
- __ci->ci_want_resched = 1; \
- if (__ci->ci_curproc != NULL) \
- aston(__ci->ci_curproc); \
-} while (/*CONSTCOND*/0)
-
#endif /* MULTIPROCESSOR */
#define aston(p) ((p)->p_md.md_astpending = 1)
@@ -313,8 +300,6 @@ void x86_bus_space_mallocok(void);
#endif /* _KERNEL */
-#include <machine/psl.h>
-
/*
* CTL_MACHDEP definitions.
*/
diff --git a/sys/arch/amd64/include/types.h b/sys/arch/amd64/include/types.h
index 29db1c37d00..6b7458c307a 100644
--- a/sys/arch/amd64/include/types.h
+++ b/sys/arch/amd64/include/types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: types.h,v 1.2 2004/02/03 12:09:47 mickey Exp $ */
+/* $OpenBSD: types.h,v 1.3 2004/06/22 01:16:50 art Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -67,14 +67,8 @@ typedef unsigned long long uint64_t;
typedef long register_t;
-/* The amd64 does not have strict alignment requirements. */
-#define __NO_STRICT_ALIGNMENT
-
#define __HAVE_NWSCONS
-#define __HAVE_CPU_COUNTER
-#define __HAVE_SYSCALL_INTERN
-#define __HAVE_MINIMAL_EMUL
#define __HAVE_GENERIC_SOFT_INTERRUPTS
-#define __HAVE_CPU_MAXPROC
+#define __HAVE_CPUINFO
#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/amd64/include/userret.h b/sys/arch/amd64/include/userret.h
index 4422d1b25dd..8f5dd35892d 100644
--- a/sys/arch/amd64/include/userret.h
+++ b/sys/arch/amd64/include/userret.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: userret.h,v 1.1 2004/01/28 01:39:39 mickey Exp $ */
+/* $OpenBSD: userret.h,v 1.2 2004/06/22 01:16:50 art Exp $ */
/* $NetBSD: userret.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */
/*
@@ -95,5 +95,5 @@ userret(struct proc *p)
while ((sig = CURSIG(p)) != 0)
postsig(sig);
- curpriority = p->p_priority = p->p_usrpri;
+ curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
}
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 97c68dce08b..2bf36105626 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched.h,v 1.9 2004/06/21 23:12:14 art Exp $ */
+/* $OpenBSD: sched.h,v 1.10 2004/06/22 01:16:50 art Exp $ */
/* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */
/*-
@@ -138,7 +138,7 @@ void roundrobin(struct cpu_info *);
(parent)->p_estcpu = ESTCPULIM((parent)->p_estcpu + (child)->p_estcpu);\
} while (0)
-#ifndef splsched
+#if !defined(__HAVE_CPUINFO) && !defined(splsched)
#define splsched() splhigh()
#endif
#ifndef IPL_SCHED