From a7231bde768a83be74d645f7f9cda0670310d553 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 7 Nov 2006 18:50:07 +0000 Subject: [PATCH] Remove system dependancies on . Only architecture files need it now. SWI_* defines moved from the MD to the MI directory. --- sys/bus/cam/cam_xpt.c | 3 +- sys/cpu/i386/include/cpu.h | 8 +- sys/cpu/i386/include/reloc.h | 6 +- sys/dev/serial/cy/cy.c | 3 +- sys/dev/serial/rc/rc.c | 3 +- sys/dev/serial/sio/sio.c | 3 +- sys/emulation/posix4/ksched.c | 3 +- sys/kern/kern_intr.c | 4 +- sys/kern/kern_sched.c | 3 +- sys/kern/kern_sig.c | 5 +- sys/kern/kern_synch.c | 3 +- sys/kern/kern_timeout.c | 3 +- sys/kern/lwkt_ipiq.c | 3 +- sys/kern/lwkt_msgport.c | 3 +- sys/kern/lwkt_thread.c | 3 +- sys/kern/lwkt_token.c | 3 +- sys/kern/subr_prof.c | 3 +- sys/kern/subr_taskqueue.c | 4 +- sys/kern/usched_bsd4.c | 3 +- sys/kern/usched_dummy.c | 3 +- sys/net/netisr.c | 3 +- sys/netgraph/tty/ng_tty.c | 7 +- sys/netproto/key/keysock.c | 4 +- sys/opencrypto/crypto.c | 3 +- sys/platform/pc32/apic/apic_ipl.s | 3 +- sys/platform/pc32/apic/apic_vector.s | 3 +- sys/platform/pc32/i386/autoconf.c | 3 +- sys/platform/pc32/i386/exception.s | 3 +- sys/platform/pc32/i386/machdep.c | 3 +- sys/platform/pc32/i386/swtch.s | 3 +- sys/platform/pc32/i386/sys_machdep.c | 3 +- sys/platform/pc32/i386/tls.c | 3 +- sys/platform/pc32/i386/trap.c | 3 +- sys/platform/pc32/i386/vm_machdep.c | 3 +- sys/platform/pc32/icu/icu_ipl.s | 4 +- sys/platform/pc32/icu/icu_vector.s | 4 +- sys/platform/pc32/include/ipl.h | 87 ++---- .../{pc32 => vkernel}/i386/autoconf.c | 8 +- sys/platform/vkernel/i386/locore.s | 78 ++++++ sys/platform/vkernel/include/globaldata.h | 143 ++++++++++ sys/platform/vkernel/include/lock.h | 96 +++++++ .../vkernel/include/pcb.h} | 65 +++-- sys/platform/vkernel/include/pmap.h | 250 ++++++++++++++++++ sys/platform/vkernel/include/proc.h | 50 ++++ sys/platform/vkernel/include/thread.h | 104 ++++++++ sys/platform/vkernel/include/types.h | 44 +++ sys/platform/vkernel/include/vmparam.h | 93 +++++++ sys/sys/interrupt.h | 62 ++++- 48 files changed, 1039 insertions(+), 168 deletions(-) copy sys/platform/{pc32 => vkernel}/i386/autoconf.c (98%) create mode 100644 sys/platform/vkernel/i386/locore.s create mode 100644 sys/platform/vkernel/include/globaldata.h create mode 100644 sys/platform/vkernel/include/lock.h copy sys/{cpu/i386/include/reloc.h => platform/vkernel/include/pcb.h} (58%) create mode 100644 sys/platform/vkernel/include/pmap.h create mode 100644 sys/platform/vkernel/include/proc.h create mode 100644 sys/platform/vkernel/include/thread.h create mode 100644 sys/platform/vkernel/include/types.h create mode 100644 sys/platform/vkernel/include/vmparam.h diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index bfb49af5e4..dc4a71e3a6 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_xpt.c,v 1.80.2.18 2002/12/09 17:31:55 gibbs Exp $ - * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.31 2006/09/10 01:26:32 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.32 2006/11/07 18:49:57 dillon Exp $ */ #include #include @@ -46,7 +46,6 @@ #include #include -#include #include "cam.h" #include "cam_ccb.h" diff --git a/sys/cpu/i386/include/cpu.h b/sys/cpu/i386/include/cpu.h index 7de9f15e65..729c230796 100644 --- a/sys/cpu/i386/include/cpu.h +++ b/sys/cpu/i386/include/cpu.h @@ -35,11 +35,11 @@ * * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/include/cpu.h,v 1.43.2.2 2001/06/15 09:37:57 scottl Exp $ - * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.20 2006/11/07 06:43:24 dillon Exp $ + * $DragonFly: src/sys/cpu/i386/include/cpu.h,v 1.21 2006/11/07 18:49:59 dillon Exp $ */ -#ifndef _MACHINE_CPU_H_ -#define _MACHINE_CPU_H_ +#ifndef _CPU_CPU_H_ +#define _CPU_CPU_H_ /* * Definitions unique to i386 cpu support. @@ -132,4 +132,4 @@ void fork_return (struct lwp *, struct trapframe); #endif -#endif /* !_MACHINE_CPU_H_ */ +#endif /* !_CPU_CPU_H_ */ diff --git a/sys/cpu/i386/include/reloc.h b/sys/cpu/i386/include/reloc.h index 2ef96887a7..d109bc84be 100644 --- a/sys/cpu/i386/include/reloc.h +++ b/sys/cpu/i386/include/reloc.h @@ -32,11 +32,11 @@ * * @(#)reloc.h 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/i386/include/reloc.h,v 1.7 1999/08/28 00:44:23 peter Exp $ - * $DragonFly: src/sys/cpu/i386/include/reloc.h,v 1.3 2003/06/28 04:16:03 dillon Exp $ + * $DragonFly: src/sys/cpu/i386/include/reloc.h,v 1.4 2006/11/07 18:49:59 dillon Exp $ */ -#ifndef _MACHINE_RELOC_H_ -#define _MACHINE_RELOC_H_ +#ifndef _CPU_RELOC_H_ +#define _CPU_RELOC_H_ /* Relocation format. */ struct relocation_info { diff --git a/sys/dev/serial/cy/cy.c b/sys/dev/serial/cy/cy.c index e0f73352e4..642077ca8d 100644 --- a/sys/dev/serial/cy/cy.c +++ b/sys/dev/serial/cy/cy.c @@ -28,7 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/cy.c,v 1.97.2.2 2001/08/22 13:04:58 bde Exp $ - * $DragonFly: src/sys/dev/serial/cy/cy.c,v 1.24 2006/11/07 06:43:23 dillon Exp $ + * $DragonFly: src/sys/dev/serial/cy/cy.c,v 1.25 2006/11/07 18:50:06 dillon Exp $ */ #include "opt_compat.h" @@ -81,7 +81,6 @@ #include #include #include -#include #ifndef SMP #include #endif diff --git a/sys/dev/serial/rc/rc.c b/sys/dev/serial/rc/rc.c index d7b974f179..f55e88cfe7 100644 --- a/sys/dev/serial/rc/rc.c +++ b/sys/dev/serial/rc/rc.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/rc.c,v 1.53.2.1 2001/02/26 04:23:10 jlemon Exp $ - * $DragonFly: src/sys/dev/serial/rc/rc.c,v 1.20 2006/11/07 06:43:23 dillon Exp $ + * $DragonFly: src/sys/dev/serial/rc/rc.c,v 1.21 2006/11/07 18:50:06 dillon Exp $ * */ @@ -49,7 +49,6 @@ #include #include #include -#include #include diff --git a/sys/dev/serial/sio/sio.c b/sys/dev/serial/sio/sio.c index 77a6e80046..84d711e01c 100644 --- a/sys/dev/serial/sio/sio.c +++ b/sys/dev/serial/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/sio.c,v 1.291.2.35 2003/05/18 08:51:15 murray Exp $ - * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.36 2006/10/25 20:56:02 dillon Exp $ + * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.37 2006/11/07 18:50:06 dillon Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -88,7 +88,6 @@ #include #include -#include #ifndef SMP #include #endif diff --git a/sys/emulation/posix4/ksched.c b/sys/emulation/posix4/ksched.c index 019987392c..408d93f677 100644 --- a/sys/emulation/posix4/ksched.c +++ b/sys/emulation/posix4/ksched.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/posix4/ksched.c,v 1.7.2.1 2000/05/16 06:58:13 dillon Exp $ - * $DragonFly: src/sys/emulation/posix4/Attic/ksched.c,v 1.6 2005/11/14 18:50:00 dillon Exp $ + * $DragonFly: src/sys/emulation/posix4/Attic/ksched.c,v 1.7 2006/11/07 18:50:06 dillon Exp $ */ /* ksched: Soft real time scheduling based on "rtprio". @@ -42,7 +42,6 @@ #include #include #include /* For need_user_resched */ -#include /* For need_user_resched */ #include "posix4.h" diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 2de006b1fa..bf4f986451 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_intr.c,v 1.24.2.1 2001/10/14 20:05:50 luigi Exp $ - * $DragonFly: src/sys/kern/kern_intr.c,v 1.42 2006/09/05 00:55:45 dillon Exp $ + * $DragonFly: src/sys/kern/kern_intr.c,v 1.43 2006/11/07 18:50:06 dillon Exp $ * */ @@ -38,10 +38,10 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 8f8aed9f77..827f90e0f1 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/posix4/ksched.c,v 1.7.2.1 2000/05/16 06:58:13 dillon Exp $ - * $DragonFly: src/sys/kern/kern_sched.c,v 1.6 2005/11/14 18:50:00 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sched.c,v 1.7 2006/11/07 18:50:06 dillon Exp $ */ /* ksched: Soft real time scheduling based on "rtprio". @@ -42,7 +42,6 @@ #include #include #include /* For need_user_resched */ -#include /* For need_user_resched */ #include "posix4.h" diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index c90dec899c..75f31a4aa5 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -37,7 +37,7 @@ * * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 * $FreeBSD: src/sys/kern/kern_sig.c,v 1.72.2.17 2003/05/16 16:34:34 obrien Exp $ - * $DragonFly: src/sys/kern/kern_sig.c,v 1.55 2006/10/10 15:40:46 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sig.c,v 1.56 2006/11/07 18:50:06 dillon Exp $ */ #include "opt_ktrace.h" @@ -64,12 +64,11 @@ #include #include #include +#include #include #include #include - -#include #include #include diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 8a0c604ad7..f57cf723a2 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -37,7 +37,7 @@ * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 * $FreeBSD: src/sys/kern/kern_synch.c,v 1.87.2.6 2002/10/13 07:29:53 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_synch.c,v 1.67 2006/09/05 03:48:12 dillon Exp $ + * $DragonFly: src/sys/kern/kern_synch.c,v 1.68 2006/11/07 18:50:06 dillon Exp $ */ #include "opt_ktrace.h" @@ -62,7 +62,6 @@ #include #include -#include #include TAILQ_HEAD(tslpque, thread); diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 2423217b4d..aa7cdfd246 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -70,7 +70,7 @@ * * From: @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_timeout.c,v 1.59.2.1 2001/11/13 18:24:52 archie Exp $ - * $DragonFly: src/sys/kern/kern_timeout.c,v 1.22 2006/09/05 03:48:12 dillon Exp $ + * $DragonFly: src/sys/kern/kern_timeout.c,v 1.23 2006/11/07 18:50:06 dillon Exp $ */ /* * DRAGONFLY BGL STATUS @@ -108,7 +108,6 @@ #include #include #include -#include #include #ifndef MAX_SOFTCLOCK_STEPS diff --git a/sys/kern/lwkt_ipiq.c b/sys/kern/lwkt_ipiq.c index 21d2276259..0b5778f207 100644 --- a/sys/kern/lwkt_ipiq.c +++ b/sys/kern/lwkt_ipiq.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/lwkt_ipiq.c,v 1.17 2005/10/26 10:46:45 sephe Exp $ + * $DragonFly: src/sys/kern/lwkt_ipiq.c,v 1.18 2006/11/07 18:50:06 dillon Exp $ */ /* @@ -68,7 +68,6 @@ #include #include -#include #include #include diff --git a/sys/kern/lwkt_msgport.c b/sys/kern/lwkt_msgport.c index 9065267217..b45ea0d521 100644 --- a/sys/kern/lwkt_msgport.c +++ b/sys/kern/lwkt_msgport.c @@ -34,7 +34,7 @@ * NOTE! This file may be compiled for userland libraries as well as for * the kernel. * - * $DragonFly: src/sys/kern/lwkt_msgport.c,v 1.34 2005/10/25 17:26:54 dillon Exp $ + * $DragonFly: src/sys/kern/lwkt_msgport.c,v 1.35 2006/11/07 18:50:06 dillon Exp $ */ #ifdef _KERNEL @@ -65,7 +65,6 @@ #include #include -#include #include #ifdef SMP #include diff --git a/sys/kern/lwkt_thread.c b/sys/kern/lwkt_thread.c index 2e327e1e7e..de20799cff 100644 --- a/sys/kern/lwkt_thread.c +++ b/sys/kern/lwkt_thread.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.101 2006/06/04 21:09:50 dillon Exp $ + * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.102 2006/11/07 18:50:06 dillon Exp $ */ /* @@ -71,7 +71,6 @@ #include #include -#include #include #else diff --git a/sys/kern/lwkt_token.c b/sys/kern/lwkt_token.c index 4e26165baa..d2a0827bc0 100644 --- a/sys/kern/lwkt_token.c +++ b/sys/kern/lwkt_token.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/lwkt_token.c,v 1.27 2006/06/04 21:09:50 dillon Exp $ + * $DragonFly: src/sys/kern/lwkt_token.c,v 1.28 2006/11/07 18:50:06 dillon Exp $ */ #ifdef _KERNEL @@ -64,7 +64,6 @@ #include #include -#include #include #define THREAD_STACK (UPAGES * PAGE_SIZE) diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index 70e90da7f2..69bc9f3ec4 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -32,7 +32,7 @@ * * @(#)subr_prof.c 8.3 (Berkeley) 9/23/93 * $FreeBSD: src/sys/kern/subr_prof.c,v 1.32.2.2 2000/08/03 00:09:32 ps Exp $ - * $DragonFly: src/sys/kern/subr_prof.c,v 1.12 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/kern/subr_prof.c,v 1.13 2006/11/07 18:50:06 dillon Exp $ */ #include @@ -44,7 +44,6 @@ #include #include -#include #include #ifdef GPROF diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c index 0f38947325..3d42305540 100644 --- a/sys/kern/subr_taskqueue.c +++ b/sys/kern/subr_taskqueue.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/subr_taskqueue.c,v 1.1.2.3 2003/09/10 00:40:39 ken Exp $ - * $DragonFly: src/sys/kern/subr_taskqueue.c,v 1.10 2006/09/05 00:55:45 dillon Exp $ + * $DragonFly: src/sys/kern/subr_taskqueue.c,v 1.11 2006/11/07 18:50:06 dillon Exp $ */ #include @@ -38,8 +38,6 @@ #include #include -#include - MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues"); static STAILQ_HEAD(taskqueue_list, taskqueue) taskqueue_queues; diff --git a/sys/kern/usched_bsd4.c b/sys/kern/usched_bsd4.c index 5522559eaa..da2d794406 100644 --- a/sys/kern/usched_bsd4.c +++ b/sys/kern/usched_bsd4.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/usched_bsd4.c,v 1.16 2006/07/11 01:01:50 dillon Exp $ + * $DragonFly: src/sys/kern/usched_bsd4.c,v 1.17 2006/11/07 18:50:06 dillon Exp $ */ #include @@ -37,7 +37,6 @@ #include #include #include -#include #include #include diff --git a/sys/kern/usched_dummy.c b/sys/kern/usched_dummy.c index f729512e2d..d31ba127e6 100644 --- a/sys/kern/usched_dummy.c +++ b/sys/kern/usched_dummy.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/usched_dummy.c,v 1.3 2006/06/10 20:19:38 dillon Exp $ + * $DragonFly: src/sys/kern/usched_dummy.c,v 1.4 2006/11/07 18:50:06 dillon Exp $ */ #include @@ -45,7 +45,6 @@ #include #include #include -#include #include #include diff --git a/sys/net/netisr.c b/sys/net/netisr.c index d7ff020745..ce5ab55b95 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -35,7 +35,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/net/netisr.c,v 1.27 2006/09/05 00:55:46 dillon Exp $ + * $DragonFly: src/sys/net/netisr.c,v 1.28 2006/11/07 18:50:07 dillon Exp $ */ /* @@ -68,7 +68,6 @@ #include #include #include -#include #include #include diff --git a/sys/netgraph/tty/ng_tty.c b/sys/netgraph/tty/ng_tty.c index a223e46671..d0511441c4 100644 --- a/sys/netgraph/tty/ng_tty.c +++ b/sys/netgraph/tty/ng_tty.c @@ -37,7 +37,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_tty.c,v 1.7.2.3 2002/02/13 00:43:12 dillon Exp $ - * $DragonFly: src/sys/netgraph/tty/ng_tty.c,v 1.15 2006/11/07 06:43:25 dillon Exp $ + * $DragonFly: src/sys/netgraph/tty/ng_tty.c,v 1.16 2006/11/07 18:50:07 dillon Exp $ * $Whistle: ng_tty.c,v 1.21 1999/11/01 09:24:52 julian Exp $ */ @@ -78,11 +78,6 @@ #include #include "ng_tty.h" -#ifdef __i386__ /* fiddle with the spl locking */ -#include -#include -#endif - /* Misc defs */ #define MAX_MBUFQ 3 /* Max number of queued mbufs */ #define NGT_HIWATER 400 /* High water mark on output */ diff --git a/sys/netproto/key/keysock.c b/sys/netproto/key/keysock.c index 2a474b3d54..9d03474dd1 100644 --- a/sys/netproto/key/keysock.c +++ b/sys/netproto/key/keysock.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netkey/keysock.c,v 1.1.2.4 2003/01/11 19:10:59 ume Exp $ */ -/* $DragonFly: src/sys/netproto/key/keysock.c,v 1.15 2006/09/05 00:55:49 dillon Exp $ */ +/* $DragonFly: src/sys/netproto/key/keysock.c,v 1.16 2006/11/07 18:50:07 dillon Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ /* @@ -49,8 +49,6 @@ #include #include -#include - #include #include #include diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 66d13f5aea..10898b9fcb 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.7 2003/06/03 00:09:02 sam Exp $ */ -/* $DragonFly: src/sys/opencrypto/crypto.c,v 1.12 2006/09/05 03:48:13 dillon Exp $ */ +/* $DragonFly: src/sys/opencrypto/crypto.c,v 1.13 2006/11/07 18:50:07 dillon Exp $ */ /* $OpenBSD: crypto.c,v 1.38 2002/06/11 11:14:29 beck Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/sys/platform/pc32/apic/apic_ipl.s b/sys/platform/pc32/apic/apic_ipl.s index 4158401f79..069fdac63c 100644 --- a/sys/platform/pc32/apic/apic_ipl.s +++ b/sys/platform/pc32/apic/apic_ipl.s @@ -54,14 +54,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/apic_ipl.s,v 1.27.2.2 2000/09/30 02:49:35 ps Exp $ - * $DragonFly: src/sys/platform/pc32/apic/apic_ipl.s,v 1.16 2005/11/04 08:57:24 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/apic/apic_ipl.s,v 1.17 2006/11/07 18:50:06 dillon Exp $ */ #include "use_npx.h" #include #include -#include #include #include #include diff --git a/sys/platform/pc32/apic/apic_vector.s b/sys/platform/pc32/apic/apic_vector.s index b7596c0210..d81278af06 100644 --- a/sys/platform/pc32/apic/apic_vector.s +++ b/sys/platform/pc32/apic/apic_vector.s @@ -1,14 +1,13 @@ /* * from: vector.s, 386BSD 0.1 unknown origin * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $ - * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.33 2006/11/07 06:43:24 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/apic/apic_vector.s,v 1.34 2006/11/07 18:50:06 dillon Exp $ */ #include "use_npx.h" #include "opt_auto_eoi.h" #include -#include #include #include #include diff --git a/sys/platform/pc32/i386/autoconf.c b/sys/platform/pc32/i386/autoconf.c index ec6e0c0823..e316b04811 100644 --- a/sys/platform/pc32/i386/autoconf.c +++ b/sys/platform/pc32/i386/autoconf.c @@ -35,7 +35,7 @@ * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/autoconf.c,v 1.146.2.2 2001/06/07 06:05:58 dd Exp $ - * $DragonFly: src/sys/platform/pc32/i386/autoconf.c,v 1.30 2006/11/07 06:43:24 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/autoconf.c,v 1.31 2006/11/07 18:50:06 dillon Exp $ */ /* @@ -73,7 +73,6 @@ #include #include -#include #include #include #include diff --git a/sys/platform/pc32/i386/exception.s b/sys/platform/pc32/i386/exception.s index 05d3165e93..8b838e4082 100644 --- a/sys/platform/pc32/i386/exception.s +++ b/sys/platform/pc32/i386/exception.s @@ -31,14 +31,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/exception.s,v 1.65.2.3 2001/08/15 01:23:49 peter Exp $ - * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.28 2006/10/23 21:50:30 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/exception.s,v 1.29 2006/11/07 18:50:07 dillon Exp $ */ #include "use_npx.h" #include #include -#include #include #include #include diff --git a/sys/platform/pc32/i386/machdep.c b/sys/platform/pc32/i386/machdep.c index 4ae86f95e6..a8ddbf6b20 100644 --- a/sys/platform/pc32/i386/machdep.c +++ b/sys/platform/pc32/i386/machdep.c @@ -36,7 +36,7 @@ * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $ - * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.102 2006/11/07 17:51:23 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.103 2006/11/07 18:50:07 dillon Exp $ */ #include "use_apm.h" @@ -98,7 +98,6 @@ #include #include #include -#include #include #include /* pcb.h included via sys/user.h */ #include /* CPU_prvspace */ diff --git a/sys/platform/pc32/i386/swtch.s b/sys/platform/pc32/i386/swtch.s index 017b349b8e..b8ebafc222 100644 --- a/sys/platform/pc32/i386/swtch.s +++ b/sys/platform/pc32/i386/swtch.s @@ -66,7 +66,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/swtch.s,v 1.89.2.10 2003/01/23 03:36:24 ps Exp $ - * $DragonFly: src/sys/platform/pc32/i386/swtch.s,v 1.41 2006/11/07 06:43:24 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/swtch.s,v 1.42 2006/11/07 18:50:07 dillon Exp $ */ #include "use_npx.h" @@ -75,7 +75,6 @@ #include #include -#include #include #include diff --git a/sys/platform/pc32/i386/sys_machdep.c b/sys/platform/pc32/i386/sys_machdep.c index 4a5d50b101..d3d5578f49 100644 --- a/sys/platform/pc32/i386/sys_machdep.c +++ b/sys/platform/pc32/i386/sys_machdep.c @@ -32,7 +32,7 @@ * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 * $FreeBSD: src/sys/i386/i386/sys_machdep.c,v 1.47.2.3 2002/10/07 17:20:00 jhb Exp $ - * $DragonFly: src/sys/platform/pc32/i386/sys_machdep.c,v 1.25 2006/09/03 17:55:34 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/sys_machdep.c,v 1.26 2006/11/07 18:50:07 dillon Exp $ * */ @@ -53,7 +53,6 @@ #include #include -#include #include /* pcb.h included by sys/user.h */ #include #include diff --git a/sys/platform/pc32/i386/tls.c b/sys/platform/pc32/i386/tls.c index 331cfeeb75..1cd2792e83 100644 --- a/sys/platform/pc32/i386/tls.c +++ b/sys/platform/pc32/i386/tls.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/pc32/i386/tls.c,v 1.4 2006/06/05 07:26:10 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/tls.c,v 1.5 2006/11/07 18:50:07 dillon Exp $ */ #include @@ -49,7 +49,6 @@ #include #include #include -#include #include #include /* pcb.h included via sys/user.h */ #include /* CPU_prvspace */ diff --git a/sys/platform/pc32/i386/trap.c b/sys/platform/pc32/i386/trap.c index 29db609fe7..78cb7e0a7f 100644 --- a/sys/platform/pc32/i386/trap.c +++ b/sys/platform/pc32/i386/trap.c @@ -36,7 +36,7 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $ - * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.85 2006/11/07 17:51:23 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.86 2006/11/07 18:50:07 dillon Exp $ */ /* @@ -83,7 +83,6 @@ #include #include -#include #include #include #include diff --git a/sys/platform/pc32/i386/vm_machdep.c b/sys/platform/pc32/i386/vm_machdep.c index 76e570187b..1205b15524 100644 --- a/sys/platform/pc32/i386/vm_machdep.c +++ b/sys/platform/pc32/i386/vm_machdep.c @@ -39,7 +39,7 @@ * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ * $FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.132.2.9 2003/01/25 19:02:23 dillon Exp $ - * $DragonFly: src/sys/platform/pc32/i386/vm_machdep.c,v 1.47 2006/10/20 17:02:19 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/vm_machdep.c,v 1.48 2006/11/07 18:50:07 dillon Exp $ */ #include "use_npx.h" @@ -67,7 +67,6 @@ #include #include #include /* npxthread */ -#include /* SWI_ */ #include #include diff --git a/sys/platform/pc32/icu/icu_ipl.s b/sys/platform/pc32/icu/icu_ipl.s index 30ac4db299..dead57da72 100644 --- a/sys/platform/pc32/icu/icu_ipl.s +++ b/sys/platform/pc32/icu/icu_ipl.s @@ -67,20 +67,20 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/icu_ipl.s,v 1.6 1999/08/28 00:44:42 peter Exp $ - * $DragonFly: src/sys/platform/pc32/icu/icu_ipl.s,v 1.16 2006/10/23 21:50:30 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/icu/icu_ipl.s,v 1.17 2006/11/07 18:50:07 dillon Exp $ */ #include "use_npx.h" #include #include -#include #include #include #include #include #include "assym.s" +#include "icu_ipl.h" /* * WARNING! SMP builds can use the ICU now so this code must be MP safe. diff --git a/sys/platform/pc32/icu/icu_vector.s b/sys/platform/pc32/icu/icu_vector.s index 05cc72857f..c24cbf8344 100644 --- a/sys/platform/pc32/icu/icu_vector.s +++ b/sys/platform/pc32/icu/icu_vector.s @@ -1,7 +1,7 @@ /* * from: vector.s, 386BSD 0.1 unknown origin * $FreeBSD: src/sys/i386/isa/icu_vector.s,v 1.14.2.2 2000/07/18 21:12:42 dfr Exp $ - * $DragonFly: src/sys/platform/pc32/icu/icu_vector.s,v 1.27 2006/11/07 06:43:24 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/icu/icu_vector.s,v 1.28 2006/11/07 18:50:07 dillon Exp $ */ /* * WARNING! SMP builds can use the ICU now so this code must be MP safe. @@ -11,7 +11,6 @@ #include "opt_auto_eoi.h" #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include "assym.s" +#include "icu_ipl.h" #ifndef APIC_IO diff --git a/sys/platform/pc32/include/ipl.h b/sys/platform/pc32/include/ipl.h index 01d189f5fe..21932daacf 100644 --- a/sys/platform/pc32/include/ipl.h +++ b/sys/platform/pc32/include/ipl.h @@ -1,37 +1,37 @@ -/*- - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * +/* + * Copyright (c) 2006 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/i386/include/ipl.h,v 1.17.2.3 2002/12/17 18:04:02 sam Exp $ - * $DragonFly: src/sys/platform/pc32/include/ipl.h,v 1.11 2006/11/07 06:43:24 dillon Exp $ + * + * $DragonFly: src/sys/platform/pc32/include/ipl.h,v 1.12 2006/11/07 18:50:07 dillon Exp $ */ #ifndef _MACHINE_IPL_H_ @@ -40,35 +40,4 @@ #include #include -/* - * Software interrupt bit numbers in priority order. The priority only - * determines which swi will be dispatched next; a higher priority swi - * may be dispatched when a nested h/w interrupt handler returns. - */ -#define SWI_TTY (FIRST_SOFTINT + 0) -#define SWI_NET (FIRST_SOFTINT + 1) -#define SWI_CAMNET (FIRST_SOFTINT + 2) -#define SWI_CRYPTO SWI_CAMNET -#define SWI_CAMBIO (FIRST_SOFTINT + 3) -#define SWI_VM (FIRST_SOFTINT + 4) -#define SWI_TQ (FIRST_SOFTINT + 5) -#define SWI_CLOCK (FIRST_SOFTINT + 6) - -/* - * Corresponding interrupt-pending bits for spending. NOTE: i386 only - * supports 32 software interupts (due to its gd_spending mask). - */ -#define SWI_TTY_PENDING (1 << (SWI_TTY - FIRST_SOFTINT)) -#define SWI_NET_PENDING (1 << (SWI_NET - FIRST_SOFTINT)) -#define SWI_CAMNET_PENDING (1 << (SWI_CAMNET - FIRST_SOFTINT)) -#define SWI_CRYPTO_PENDING SWI_CAMNET_PENDING -#define SWI_CAMBIO_PENDING (1 << (SWI_CAMBIO - FIRST_SOFTINT)) -#define SWI_VM_PENDING (1 << (SWI_VM - FIRST_SOFTINT)) -#define SWI_TQ_PENDING (1 << (SWI_TQ - FIRST_SOFTINT)) -#define SWI_CLOCK_PENDING (1 << (SWI_CLOCK - FIRST_SOFTINT)) - -#ifndef LOCORE - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_IPL_H_ */ +#endif diff --git a/sys/platform/pc32/i386/autoconf.c b/sys/platform/vkernel/i386/autoconf.c similarity index 98% copy from sys/platform/pc32/i386/autoconf.c copy to sys/platform/vkernel/i386/autoconf.c index ec6e0c0823..9647c1a309 100644 --- a/sys/platform/pc32/i386/autoconf.c +++ b/sys/platform/vkernel/i386/autoconf.c @@ -35,7 +35,7 @@ * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/autoconf.c,v 1.146.2.2 2001/06/07 06:05:58 dd Exp $ - * $DragonFly: src/sys/platform/pc32/i386/autoconf.c,v 1.30 2006/11/07 06:43:24 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/i386/autoconf.c,v 1.1 2006/11/07 18:50:07 dillon Exp $ */ /* @@ -72,12 +72,6 @@ #include #include -#include -#include -#include -#include -#include - #include #include #include diff --git a/sys/platform/vkernel/i386/locore.s b/sys/platform/vkernel/i386/locore.s new file mode 100644 index 0000000000..8af6bb8b4b --- /dev/null +++ b/sys/platform/vkernel/i386/locore.s @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2006 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/platform/vkernel/i386/locore.s,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#include +#include "assym.s" + + .data + ALIGN_DATA /* just to be sure */ + + .text +NON_GPROF_ENTRY(btext) + + call initvkernel + call mi_startup +1: + hlt + jmp 1b + +#if 0 +/* + * Signal trampoline, copied to top of user stack + */ +NON_GPROF_ENTRY(sigcode) + call *SIGF_HANDLER(%esp) /* call signal handler */ + lea SIGF_UC(%esp),%eax /* get ucontext_t */ + pushl %eax + testl $PSL_VM,UC_EFLAGS(%eax) + jne 9f + movl UC_GS(%eax),%gs /* restore %gs */ +9: + movl $SYS_sigreturn,%eax + pushl %eax /* junk to fake return addr. */ + int $0x80 /* enter kernel with args */ +0: jmp 0b + + ALIGN_TEXT +esigcode: + + .data + .globl szsigcode +szsigcode: + .long esigcode - sigcode + +#endif + diff --git a/sys/platform/vkernel/include/globaldata.h b/sys/platform/vkernel/include/globaldata.h new file mode 100644 index 0000000000..c0fe764ec9 --- /dev/null +++ b/sys/platform/vkernel/include/globaldata.h @@ -0,0 +1,143 @@ +/*- + * Copyright (c) Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Only machine-dependant code should ever include this file. MI + * code and header files do NOT include this file. e.g. sys/globaldata.h + * should not include this file. + * + * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/include/globaldata.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#ifndef _MACHINE_GLOBALDATA_H_ +#define _MACHINE_GLOBALDATA_H_ + +#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) + +#ifndef _SYS_GLOBALDATA_H_ +#include /* struct globaldata */ +#endif +#ifndef _SYS_THREAD_H_ +#include /* struct thread */ +#endif +#ifndef _MACHINE_SEGMENTS_H_ +#include /* struct segment_descriptor */ +#endif +#ifndef _MACHINE_TSS_H_ +#include /* struct i386tss */ +#endif +#ifndef _MACHINE_NPX_H_ +#include +#endif + +/* + * Note on interrupt control. Pending interrupts not yet dispatched are + * marked in gd_fpending, gd_ipending, or gd_spending. Once dispatched + * the interrupt's pending bit is cleared and the interrupt is masked. + * Upon completion the interrupt is unmasked. + * + * For edge triggered interrupts interrupts may be enabled again at this + * point and if they occur before the interrupt service routine is complete + * the service routine will loop. + * + * The current thread's cpl is stored in the thread structure. + * + * Note: the embedded globaldata and/or the mdglobaldata structure + * may exceed the size of a page. + */ +struct mdglobaldata { + struct globaldata mi; + struct segment_descriptor gd_common_tssd; + struct segment_descriptor *gd_tss_gdt; + struct thread *gd_npxthread; + struct i386tss gd_common_tss; + union savefpu gd_savefpu; /* fast bcopy/zero temp fpu save area */ + int gd_fpu_lock; /* fast bcopy/zero cpu lock */ + int gd_fpending; /* fast interrupt pending */ + int gd_ipending; /* normal interrupt pending */ + int gd_spending; /* software interrupt pending */ + int gd_sdelayed; /* delayed software ints */ + int gd_currentldt; + int gd_private_tss; + u_int unused001; + u_int gd_other_cpus; + u_int gd_ss_eflags; + pt_entry_t *gd_CMAP1; + pt_entry_t *gd_CMAP2; + pt_entry_t *gd_CMAP3; + pt_entry_t *gd_PMAP1; + caddr_t gd_CADDR1; + caddr_t gd_CADDR2; + caddr_t gd_CADDR3; + unsigned *gd_PADDR1; + u_int gd_acpi_id; + u_int gd_apic_id; +}; + +#define MDGLOBALDATA_BASEALLOC_SIZE \ + ((sizeof(struct mdglobaldata) + PAGE_MASK) & ~PAGE_MASK) +#define MDGLOBALDATA_BASEALLOC_PAGES \ + (MDGLOBALDATA_BASEALLOC_SIZE / PAGE_SIZE) +#define MDGLOBALDATA_PAD \ + (MDGLOBALDATA_BASEALLOC_SIZE - sizeof(struct mdglobaldata)) + +/* + * This is the upper (0xff800000) address space layout that is per-cpu. + * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for + * each AP. genassym helps export this to the assembler code. + * + * WARNING! page-bounded fields and page table indexes are hardwired + * for SMPpt[] setup in i386/i386/mp_machdep.c and locore.s. + * + * WARNING! sizeof(privatespace[SMP_MAXCPU]) must fit in the KVA + * reserved for the SMPpt page table (typically one page table page). + * + * WARNING! This structure must be a multiple of PAGE_SIZE. + */ +struct privatespace { + /* main data page */ + struct mdglobaldata mdglobaldata; + char __filler0[MDGLOBALDATA_PAD]; + + /* mapping pages - CPAGE1,CPAGE2,CPAGE3,PPAGE1 */ + char CPAGE1[PAGE_SIZE]; /* SMPpt[n+0] */ + char CPAGE2[PAGE_SIZE]; /* SMPpt[n+1] */ + char CPAGE3[PAGE_SIZE]; /* SMPpt[n+2] */ + char PPAGE1[PAGE_SIZE]; /* SMPpt[n+3] */ + + /* idle stack (UPAGES pages) */ + char idlestack[UPAGES * PAGE_SIZE]; /* SMPpt[n+4] */ +}; +#define mdcpu ((struct mdglobaldata *)_get_mycpu()) + +#endif + +#ifdef _KERNEL + +extern struct privatespace CPU_prvspace[]; + +#endif + +#endif diff --git a/sys/platform/vkernel/include/lock.h b/sys/platform/vkernel/include/lock.h new file mode 100644 index 0000000000..bb65d86591 --- /dev/null +++ b/sys/platform/vkernel/include/lock.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2003-2006 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/lock.h,v 1.11.2.2 2000/09/30 02:49:34 ps Exp $ + * $DragonFly: src/sys/platform/vkernel/include/lock.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#ifndef _MACHINE_LOCK_H_ +#define _MACHINE_LOCK_H_ + +#ifndef _CPU_PSL_H_ +#include +#endif + +/* + * MP_FREE_LOCK is used by both assembly and C under SMP. + */ +#ifdef SMP +#define MP_FREE_LOCK 0xffffffff /* value of lock when free */ +#endif + +#ifndef LOCORE + +#if defined(_KERNEL) || defined(_UTHREAD) + +/* + * MP LOCK functions for SMP and UP. Under UP the MP lock does not exist + * but we leave a few functions intact as macros for convenience. + */ +#ifdef SMP + +void get_mplock(void); +int try_mplock(void); +void rel_mplock(void); +int cpu_try_mplock(void); +void cpu_get_initial_mplock(void); + +extern u_int mp_lock; + +#define MP_LOCK_HELD() (mp_lock == mycpu->gd_cpuid) +#define ASSERT_MP_LOCK_HELD(td) KASSERT(MP_LOCK_HELD(), ("MP_LOCK_HELD(): not held thread %p", td)) + +static __inline void +cpu_rel_mplock(void) +{ + mp_lock = MP_FREE_LOCK; +} + +static __inline int +owner_mplock(void) +{ + return (mp_lock); +} + +#else + +#define get_mplock() +#define try_mplock() 1 +#define rel_mplock() +#define owner_mplock() 0 /* always cpu 0 */ +#define ASSERT_MP_LOCK_HELD(td) + +#endif /* SMP */ +#endif /* _KERNEL || _UTHREAD */ +#endif /* LOCORE */ +#endif /* !_MACHINE_LOCK_H_ */ diff --git a/sys/cpu/i386/include/reloc.h b/sys/platform/vkernel/include/pcb.h similarity index 58% copy from sys/cpu/i386/include/reloc.h copy to sys/platform/vkernel/include/pcb.h index 2ef96887a7..ac1c39d236 100644 --- a/sys/cpu/i386/include/reloc.h +++ b/sys/platform/vkernel/include/pcb.h @@ -1,6 +1,9 @@ /*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,25 +33,49 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)reloc.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/i386/include/reloc.h,v 1.7 1999/08/28 00:44:23 peter Exp $ - * $DragonFly: src/sys/cpu/i386/include/reloc.h,v 1.3 2003/06/28 04:16:03 dillon Exp $ + * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 + * $FreeBSD: src/sys/i386/include/pcb.h,v 1.32.2.1 2001/08/15 01:23:52 peter Exp $ + * $DragonFly: src/sys/platform/vkernel/include/pcb.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#ifndef _MACHINE_PCB_H_ +#define _MACHINE_PCB_H_ + +/* + * Intel 386 process control block */ +#include -#ifndef _MACHINE_RELOC_H_ -#define _MACHINE_RELOC_H_ - -/* Relocation format. */ -struct relocation_info { - int r_address; /* offset in text or data segment */ - unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ - r_pcrel : 1, /* 1 if value should be pc-relative */ - r_length : 2, /* log base 2 of value's width */ - r_extern : 1, /* 1 if need to add symbol to value */ - r_baserel : 1, /* linkage table relative */ - r_jmptable : 1, /* relocate to jump table */ - r_relative : 1, /* load address relative */ - r_copy : 1; /* run time copy */ +struct pcb { + int pcb_cr3; + int pcb_edi; + int pcb_esi; + int pcb_ebp; + int pcb_esp; + int pcb_ebx; + int pcb_eip; + + int pcb_dr0; + int pcb_dr1; + int pcb_dr2; + int pcb_dr3; + int pcb_dr6; + int pcb_dr7; + + struct pcb_ldt *pcb_ldt; /* per process (user) LDT */ + union savefpu pcb_save; + u_char pcb_flags; +#define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */ +#define PCB_DBREGS 0x02 /* process using debug registers */ + caddr_t pcb_onfault; /* copyin/out fault recovery */ + int pcb_gs; + struct pcb_ext *pcb_ext; /* optional pcb extension */ + u_long __pcb_spare[3]; /* adjust to avoid core dump size changes */ }; +#ifdef _KERNEL + +void savectx (struct pcb *); #endif + +#endif /* _MACHINE_PCB_H_ */ diff --git a/sys/platform/vkernel/include/pmap.h b/sys/platform/vkernel/include/pmap.h new file mode 100644 index 0000000000..b805125099 --- /dev/null +++ b/sys/platform/vkernel/include/pmap.h @@ -0,0 +1,250 @@ +/* + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and William Jolitz of UUNET Technologies Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Derived from hp300 version by Mike Hibler, this version by William + * Jolitz uses a recursive map [a pde points to the page directory] to + * map the page tables using the pagetables themselves. This is done to + * reduce the impact on kernel virtual memory for lots of sparse address + * space, and to reduce the cost of memory to each process. + * + * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 + * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 + * $FreeBSD: src/sys/i386/include/pmap.h,v 1.65.2.3 2001/10/03 07:15:37 peter Exp $ + * $DragonFly: src/sys/platform/vkernel/include/pmap.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#ifndef _MACHINE_PMAP_H_ +#define _MACHINE_PMAP_H_ + +#include + +/* + * Size of Kernel address space. This is the number of page table pages + * (4MB each) to use for the kernel. 256 pages == 1 Gigabyte. + * This **MUST** be a multiple of 4 (eg: 252, 256, 260, etc). + */ +#ifndef KVA_PAGES +#define KVA_PAGES 256 +#endif + +/* + * Pte related macros + */ +#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)< KVA_PAGES - 2 +#error "Maximum NKPDE is KVA_PAGES - 2" +#endif + +/* + * The *PTDI values control the layout of virtual memory + * + * XXX This works for now, but I am not real happy with it, I'll fix it + * right after I fix locore.s and the magic 28K hole + * + * SMP_PRIVPAGES: The per-cpu address space is 0xff80000 -> 0xffbfffff + */ +#define APTDPTDI (NPDEPG-1) /* alt ptd entry that points to APTD */ +#define MPPTDI (APTDPTDI-1) /* per cpu ptd entry */ +#define KPTDI (MPPTDI-NKPDE) /* start of kernel virtual pde's */ +#define PTDPTDI (KPTDI-1) /* ptd entry that points to ptd! */ +#define UMAXPTDI (PTDPTDI-1) /* ptd entry for user space end */ +#define UMAXPTEOFF (NPTEPG) /* pte entry for user space end */ + +#ifndef LOCORE + +#ifndef _SYS_TYPES_H_ +#include +#endif +#ifndef _SYS_QUEUE_H_ +#include +#endif +#ifndef _MACHINE_TYPES_H_ +#include +#endif +#ifndef _MACHINE_PARAM_H_ +#include +#endif + +/* + * Address of current and alternate address space page table maps + * and directories. + */ +#ifdef _KERNEL +extern pt_entry_t PTmap[], APTmap[], Upte; +extern pd_entry_t PTD[], APTD[], PTDpde, APTDpde, Upde; + +extern pd_entry_t IdlePTD; /* physical address of "Idle" state directory */ +#endif + +#ifdef _KERNEL +/* + * virtual address to page table entry and + * to physical address. Likewise for alternate address space. + * Note: these work recursively, thus vtopte of a pte will give + * the corresponding pde that in turn maps it. + */ +#define vtopte(va) (PTmap + i386_btop(va)) + +#define avtopte(va) (APTmap + i386_btop(va)) + +/* + * Routine: pmap_kextract + * Function: + * Extract the physical page address associated + * kernel virtual address. + */ +static __inline vm_paddr_t +pmap_kextract(vm_offset_t va) +{ + vm_paddr_t pa; + + if ((pa = (vm_offset_t) PTD[va >> PDRSHIFT]) & PG_PS) { + pa = (pa & ~(NBPDR - 1)) | (va & (NBPDR - 1)); + } else { + pa = *(vm_offset_t *)vtopte(va); + pa = (pa & PG_FRAME) | (va & PAGE_MASK); + } + return pa; +} + +/* + * XXX + */ +#define vtophys(va) pmap_kextract(((vm_offset_t)(va))) +#define vtophys_pte(va) ((pt_entry_t)pmap_kextract(((vm_offset_t)(va)))) + +#define avtophys(va) (((vm_offset_t) (*avtopte(va))&PG_FRAME) | ((vm_offset_t)(va) & PAGE_MASK)) + +#endif + +/* + * Pmap stuff + */ +struct pv_entry; +struct vm_page; +struct vm_object; + +struct md_page { + int pv_list_count; + TAILQ_HEAD(,pv_entry) pv_list; +}; + +/* + * Each machine dependent implementation is expected to + * keep certain statistics. They may do this anyway they + * so choose, but are expected to return the statistics + * in the following structure. + */ +struct pmap_statistics { + long resident_count; /* # of pages mapped (total) */ + long wired_count; /* # of pages wired */ +}; +typedef struct pmap_statistics *pmap_statistics_t; + +struct pmap { + pd_entry_t *pm_pdir; /* KVA of page directory */ + struct vm_object *pm_pteobj; /* Container for pte's */ + TAILQ_ENTRY(pmap) pm_pmnode; /* list of pmaps */ + TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ + int pm_count; /* reference count */ + cpumask_t pm_active; /* active on cpus */ + struct pmap_statistics pm_stats; /* pmap statistics */ + struct vm_page *pm_ptphint; /* pmap ptp hint */ +}; + +#define pmap_resident_count(pmap) (pmap)->pm_stats.resident_count + +typedef struct pmap *pmap_t; + +#ifdef _KERNEL +extern pmap_t kernel_pmap; +#endif + +/* + * For each vm_page_t, there is a list of all currently valid virtual + * mappings of that page. An entry is a pv_entry_t, the list is pv_table. + */ +typedef struct pv_entry { + pmap_t pv_pmap; /* pmap where mapping lies */ + vm_offset_t pv_va; /* virtual address for mapping */ + TAILQ_ENTRY(pv_entry) pv_list; + TAILQ_ENTRY(pv_entry) pv_plist; + struct vm_page *pv_ptem; /* VM page for pte */ +} *pv_entry_t; + +#ifdef _KERNEL + +#define NPPROVMTRR 8 +#define PPRO_VMTRRphysBase0 0x200 +#define PPRO_VMTRRphysMask0 0x201 +struct ppro_vmtrr { + u_int64_t base, mask; +}; +extern struct ppro_vmtrr PPro_vmtrr[NPPROVMTRR]; + +extern caddr_t CADDR1; +extern pt_entry_t *CMAP1; +extern vm_paddr_t avail_end; +extern vm_paddr_t avail_start; +extern vm_offset_t clean_eva; +extern vm_offset_t clean_sva; +extern vm_paddr_t phys_avail[]; +extern char *ptvmmap; /* poor name! */ +extern vm_offset_t virtual_avail; +extern vm_offset_t virtual_end; + +void pmap_bootstrap ( vm_paddr_t, vm_paddr_t); +pmap_t pmap_kernel (void); +void *pmap_mapdev (vm_paddr_t, vm_size_t); +void pmap_unmapdev (vm_offset_t, vm_size_t); +unsigned *pmap_pte (pmap_t, vm_offset_t) __pure2; +struct vm_page *pmap_use_pt (pmap_t, vm_offset_t); +#ifdef SMP +void pmap_set_opt (void); +#endif + +#endif /* _KERNEL */ + +#endif /* !LOCORE */ + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/platform/vkernel/include/proc.h b/sys/platform/vkernel/include/proc.h new file mode 100644 index 0000000000..88d2ee626e --- /dev/null +++ b/sys/platform/vkernel/include/proc.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2006 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/platform/vkernel/include/proc.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#ifndef _MACHINE_PROC_H_ +#define _MACHINE_PROC_H_ + +/* + * When a trap or exception occurs the trap code stores the frame pointer + * in md_regs so emulation and other code can modify it for the return. + */ +struct trapframe; + +struct mdproc { + struct trapframe *md_regs; /* registers on current frame */ +}; + +#endif /* !_MACHINE_PROC_H_ */ diff --git a/sys/platform/vkernel/include/thread.h b/sys/platform/vkernel/include/thread.h new file mode 100644 index 0000000000..71f1076941 --- /dev/null +++ b/sys/platform/vkernel/include/thread.h @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2006 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/platform/vkernel/include/thread.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#ifndef _MACHINE_THREAD_H_ +#define _MACHINE_THREAD_H_ + +#ifndef _MACHINE_SEGMENTS_H_ +#include +#endif + +union savefpu; + +struct md_thread { + unsigned int mtd_unused; /* used to be mtd_cpl */ + union savefpu *mtd_savefpu; + struct segment_descriptor mtd_tls[NGTLS]; +}; + +#ifdef _KERNEL + +#define td_savefpu td_mach.mtd_savefpu +#define td_tls td_mach.mtd_tls + +/* + * mycpu() retrieves the base of the current cpu's globaldata structure. + * Note that it is *NOT* volatile, meaning that the value may be cached by + * GCC. We have to force a dummy memory reference so gcc does not cache + * the gd pointer across a procedure call (which might block and cause us + * to wakeup on a different cpu). + * + * Also note that in DragonFly a thread can be preempted, but only by an + * interrupt thread and the original thread will resume after the + * interrupt thread finishes or blocks. A thread cannot move to another + * cpu preemptively or at all, in fact, while you are in the kernel, even + * if you block. + */ + +struct globaldata; + +extern int __mycpu__dummy; + +static __inline +struct globaldata * +_get_mycpu(void) +{ + struct globaldata *gd; + + __asm ("movl %%fs:globaldata,%0" : "=r" (gd) : "m"(__mycpu__dummy)); + return(gd); +} + +#define mycpu _get_mycpu() + +#ifdef SMP +#define mycpuid (_get_mycpu()->gd_cpuid) +#else +#define mycpuid 0 +#endif + +/* + * note: curthread is never NULL, but curproc can be. Also note that + * that only processes really use the PCB. Threads fill in some fields + * but mostly store contextual data on the stack and do not use (much of) + * the PCB. + */ +#define curthread mycpu->gd_curthread +#define curproc curthread->td_proc + +#endif /* _KERNEL */ + +#endif /* !_MACHINE_THREAD_H_ */ diff --git a/sys/platform/vkernel/include/types.h b/sys/platform/vkernel/include/types.h new file mode 100644 index 0000000000..e116dc53c8 --- /dev/null +++ b/sys/platform/vkernel/include/types.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2006 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/platform/vkernel/include/types.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ +#ifndef _MACHINE_TYPES_H_ +#define _MACHINE_TYPES_H_ + +#include + +typedef __uint32_t intrmask_t; + +#endif /* !_MACHINE_TYPES_H_ */ + diff --git a/sys/platform/vkernel/include/vmparam.h b/sys/platform/vkernel/include/vmparam.h new file mode 100644 index 0000000000..0835143ea5 --- /dev/null +++ b/sys/platform/vkernel/include/vmparam.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2006 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/platform/vkernel/include/vmparam.h,v 1.1 2006/11/07 18:50:07 dillon Exp $ + */ + +#ifndef _MACHINE_VMPARAM_H_ +#define _MACHINE_VMPARAM_H_ + +/* + * Indicate that read access also means execution access (XXX newer PCs + * have a separate bit). + */ +#define VM_PROT_READ_IS_EXEC + +/* + * Virtual memory related constants, all in bytes + */ +#define MAXTSIZ (128UL*1024*1024) /* max text size */ +#ifndef DFLDSIZ +#define DFLDSIZ (128UL*1024*1024) /* initial data size limit */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (512UL*1024*1024) /* max data size */ +#endif +#ifndef DFLSSIZ +#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ +#endif +#ifndef MAXSSIZ +#define MAXSSIZ (64UL*1024*1024) /* max stack size */ +#endif +#ifndef SGROWSIZ +#define SGROWSIZ (128UL*1024) /* amount to grow stack */ +#endif + +/* + * After this period of time allow a process to become swappable. This + * parameter is mostly obsolete now. + */ +#define MAXSLP 20 + +/* + * For virtual kernels running as userland processes the user and kernel + * address spaces exist in different VM spaces and can overlap. + */ +#define KERNBASE 0x1000 + +#define VM_MIN_KERNEL_ADDRESS 0 +#define VM_MAX_KERNEL_ADDRESS 0xC0000000 + +#define VM_MIN_USER_ADDRESS 0x00000000 +#define VM_MAX_USER_ADDRESS 0xC0000000 /* XXX match to real kernel */ + +#define USRSTACK VM_MAX_USER_ADDRESS + +/* + * Initial memory map preload + */ +#ifndef VM_INITIAL_PAGEIN +#define VM_INITIAL_PAGEIN 16 +#endif + +#endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index 41bf8c3ecf..63b6079df8 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -1,3 +1,35 @@ +/*- + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ /* * Copyright (c) 1997, Stefan Esser * All rights reserved. @@ -24,7 +56,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/sys/interrupt.h,v 1.9.2.1 2001/10/14 20:05:50 luigi Exp $ - * $DragonFly: src/sys/sys/interrupt.h,v 1.16 2005/11/21 18:02:46 dillon Exp $ + * $FreeBSD: src/sys/i386/include/ipl.h,v 1.17.2.3 2002/12/17 18:04:02 sam Exp $ + * $DragonFly: src/sys/sys/interrupt.h,v 1.17 2006/11/07 18:50:07 dillon Exp $ */ #ifndef _SYS_INTERRUPT_H_ @@ -41,6 +74,33 @@ typedef void inthand2_t (void *, void *); +/* + * Software interrupt bit numbers in priority order. The priority only + * determines which swi will be dispatched next; a higher priority swi + * may be dispatched when a nested h/w interrupt handler returns. + */ +#define SWI_TTY (FIRST_SOFTINT + 0) +#define SWI_NET (FIRST_SOFTINT + 1) +#define SWI_CAMNET (FIRST_SOFTINT + 2) +#define SWI_CRYPTO SWI_CAMNET +#define SWI_CAMBIO (FIRST_SOFTINT + 3) +#define SWI_VM (FIRST_SOFTINT + 4) +#define SWI_TQ (FIRST_SOFTINT + 5) +#define SWI_CLOCK (FIRST_SOFTINT + 6) + +/* + * Corresponding interrupt-pending bits for spending. NOTE: i386 only + * supports 32 software interupts (due to its gd_spending mask). + */ +#define SWI_TTY_PENDING (1 << (SWI_TTY - FIRST_SOFTINT)) +#define SWI_NET_PENDING (1 << (SWI_NET - FIRST_SOFTINT)) +#define SWI_CAMNET_PENDING (1 << (SWI_CAMNET - FIRST_SOFTINT)) +#define SWI_CRYPTO_PENDING SWI_CAMNET_PENDING +#define SWI_CAMBIO_PENDING (1 << (SWI_CAMBIO - FIRST_SOFTINT)) +#define SWI_VM_PENDING (1 << (SWI_VM - FIRST_SOFTINT)) +#define SWI_TQ_PENDING (1 << (SWI_TQ - FIRST_SOFTINT)) +#define SWI_CLOCK_PENDING (1 << (SWI_CLOCK - FIRST_SOFTINT)) + #ifdef _KERNEL struct intrframe; -- 2.41.0