Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump Reinstate the blanket pmap.h for archs which do not...



details:   https://anonhg.NetBSD.org/src/rev/86f1b673ac62
branches:  trunk
changeset: 755684:86f1b673ac62
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Jun 16 11:45:21 2010 +0000

description:
Reinstate the blanket pmap.h for archs which do not conform to the
kernel ABI (i.e. not i386 or amd64).  Due to the "half function,
half macro, all noodles" nature of pmap.h, it's too entangling and
too brittle to keep up with an ifdeffy MI implementation.

diffstat:

 sys/rump/include/machine/pmap.h                    |   35 +++
 sys/rump/librump/rumpkern/Makefile.rumpkern        |    7 +-
 sys/rump/librump/rumpkern/arch/i386/Makefile.inc   |    4 +-
 sys/rump/librump/rumpkern/arch/i386/pmap_x86.c     |  104 +++++++++++
 sys/rump/librump/rumpkern/arch/x86_64/Makefile.inc |    4 +-
 sys/rump/librump/rumpkern/pmap_stub.c              |  192 +--------------------
 6 files changed, 156 insertions(+), 190 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r f091c6d53920 -r 86f1b673ac62 sys/rump/include/machine/pmap.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/include/machine/pmap.h   Wed Jun 16 11:45:21 2010 +0000
@@ -0,0 +1,35 @@
+/*     $NetBSD: pmap.h,v 1.5 2010/06/16 11:45:21 pooka Exp $   */
+
+/*
+ * Copyright (c) 2010 Antti Kantee.  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 ``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.
+ */
+
+#ifndef _SYS_RUMP_PMAP_H_
+#define _SYS_RUMP_PMAP_H_
+
+#define pmap_update(v)
+#define pmap_is_modified(a) (true)
+#define pmap_is_referenced(a) (true)
+
+#endif /* _SYS_RUMP_PMAP_H_ */
diff -r f091c6d53920 -r 86f1b673ac62 sys/rump/librump/rumpkern/Makefile.rumpkern
--- a/sys/rump/librump/rumpkern/Makefile.rumpkern       Wed Jun 16 06:40:52 2010 +0000
+++ b/sys/rump/librump/rumpkern/Makefile.rumpkern       Wed Jun 16 11:45:21 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.rumpkern,v 1.90 2010/06/13 15:17:02 pooka Exp $
+#      $NetBSD: Makefile.rumpkern,v 1.91 2010/06/16 11:45:21 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -30,9 +30,10 @@
 SRCS+=         vers.c
 CLEANFILES+=   vers.c version
 
-# stubs
-#
+# use MI pmap for archs not conforming to kernel ABI
+.ifndef RUMPKMOD
 SRCS+= pmap_stub.c
+.endif
 
 # autogenerated
 #
diff -r f091c6d53920 -r 86f1b673ac62 sys/rump/librump/rumpkern/arch/i386/Makefile.inc
--- a/sys/rump/librump/rumpkern/arch/i386/Makefile.inc  Wed Jun 16 06:40:52 2010 +0000
+++ b/sys/rump/librump/rumpkern/arch/i386/Makefile.inc  Wed Jun 16 11:45:21 2010 +0000
@@ -1,7 +1,7 @@
-#      $NetBSD: Makefile.inc,v 1.5 2010/05/31 22:31:07 pooka Exp $
+#      $NetBSD: Makefile.inc,v 1.6 2010/06/16 11:45:21 pooka Exp $
 #
 
-SRCS+= rumpcpu.c rumpspl.c cpu_counter.c spinlock.c
+SRCS+= rumpcpu.c rumpspl.c cpu_counter.c spinlock.c pmap_x86.c
 
 .PATH: ${RUMPTOP}/../arch/i386/i386
 SRCS+= kobj_machdep.c
diff -r f091c6d53920 -r 86f1b673ac62 sys/rump/librump/rumpkern/arch/i386/pmap_x86.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/librump/rumpkern/arch/i386/pmap_x86.c    Wed Jun 16 11:45:21 2010 +0000
@@ -0,0 +1,104 @@
+/*     $NetBSD: pmap_x86.c,v 1.1 2010/06/16 11:45:21 pooka Exp $       */
+
+/*
+ * Copyright (c) 2010 Antti Kantee.  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 ``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.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: pmap_x86.c,v 1.1 2010/06/16 11:45:21 pooka Exp $");
+
+#include <sys/param.h>
+
+#include <uvm/uvm_extern.h>
+
+struct pmap *const kernel_pmap_ptr = (struct pmap *const)-1;
+
+void
+pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int fl)
+{
+
+       panic("%s: unavailable", __func__);
+}
+
+void
+pmap_kremove(vaddr_t va, vsize_t size)
+{
+
+       panic("%s: unavailable", __func__);
+}
+
+int
+pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
+{
+
+       panic("%s: unavailable", __func__);
+}
+
+bool
+pmap_clear_attrs(struct vm_page *pg, unsigned what)
+{
+
+       return false;
+}
+
+void
+pmap_page_remove(struct vm_page *pg)
+{
+
+}
+
+bool
+pmap_test_attrs(struct vm_page *pg, unsigned what)
+{
+
+       return true;
+}
+
+paddr_t
+vtophys(vaddr_t va)
+{
+
+       return (paddr_t)va;
+}
+
+void
+pmap_update(pmap_t pmap)
+{
+
+}
+
+void
+pmap_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva)
+{
+
+       panic("%s: unavailable", __func__);
+}
+
+bool
+pmap_extract(pmap_t pmap, vaddr_t va, paddr_t *pap)
+{
+
+       *pap = va;
+       return true;
+}
diff -r f091c6d53920 -r 86f1b673ac62 sys/rump/librump/rumpkern/arch/x86_64/Makefile.inc
--- a/sys/rump/librump/rumpkern/arch/x86_64/Makefile.inc        Wed Jun 16 06:40:52 2010 +0000
+++ b/sys/rump/librump/rumpkern/arch/x86_64/Makefile.inc        Wed Jun 16 11:45:21 2010 +0000
@@ -1,8 +1,8 @@
-#      $NetBSD: Makefile.inc,v 1.6 2010/05/31 22:31:07 pooka Exp $
+#      $NetBSD: Makefile.inc,v 1.7 2010/06/16 11:45:21 pooka Exp $
 #
 
 .PATH: ${ARCHDIR}/../i386
-SRCS+= rumpcpu.c rumpspl.c cpu_counter.c spinlock.c
+SRCS+= rumpcpu.c rumpspl.c cpu_counter.c spinlock.c pmap_x86.c
 
 .PATH: ${RUMPTOP}/../arch/amd64/amd64
 SRCS+= kobj_machdep.c
diff -r f091c6d53920 -r 86f1b673ac62 sys/rump/librump/rumpkern/pmap_stub.c
--- a/sys/rump/librump/rumpkern/pmap_stub.c     Wed Jun 16 06:40:52 2010 +0000
+++ b/sys/rump/librump/rumpkern/pmap_stub.c     Wed Jun 16 11:45:21 2010 +0000
@@ -1,10 +1,7 @@
-/*     $NetBSD: pmap_stub.c,v 1.23 2009/11/09 14:35:38 nakayama Exp $  */
+/*     $NetBSD: pmap_stub.c,v 1.24 2010/06/16 11:45:21 pooka Exp $     */
 
 /*
- * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
- *
- * Development of this software was supported by the
- * Finnish Cultural Foundation.
+ * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,65 +26,20 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_stub.c,v 1.23 2009/11/09 14:35:38 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_stub.c,v 1.24 2010/06/16 11:45:21 pooka Exp $");
 
 #include <sys/param.h>
 
 #include <uvm/uvm_extern.h>
 
-/* get your kicks on pmap 66 */
-struct pmap *const kernel_pmap_ptr = (struct pmap *const)0x66;
-
 /*
- * Provide a userspace pmap with the headers the kernel gives us.
- * This results in some arch-specific frobbling which
- * cannot really be easily avoided until the pmap interface is
- * specified with something else than a .h and autogenerated into C.
+ * This is the MI pmap implementation for rump.  It's used only by
+ * architectures which do not conform to the kernel ABI.  The kernel
+ * ABI conformant architectures provide their own pmap under librump/arch
+ * (due to various messiness with macros in the pmap "interface").
  */
 
-#if defined(__sparc__) && !defined(__sparc_v9__)
-#undef pmap_is_modified
-#undef pmap_clear_modify
-#undef pmap_kenter_pa
-#undef pmap_kremove
-#undef pmap_page_protect
-#undef pmap_extract
-#undef pmap_enter
-
-bool pmap_is_modified(struct vm_page *);
-bool pmap_clear_modify(struct vm_page *);
-void pmap_kenter_pa(vaddr_t, paddr_t, vm_prot_t, u_int);
-void pmap_kremove(vaddr_t, vsize_t);
-void pmap_page_protect(struct vm_page *, vm_prot_t);
-bool pmap_extract(pmap_t, vaddr_t, paddr_t *);
-int pmap_enter(pmap_t, vaddr_t, paddr_t, vm_prot_t, u_int);
-#endif
-
-#if !defined(pmap_is_modified) && !defined(__vax__)
-bool
-pmap_is_modified(struct vm_page *pg)
-{
-
-       return true;
-}
-#endif
-
-#if !defined(pmap_clear_modify) && !defined(__vax__)
-bool
-pmap_clear_modify(struct vm_page *pg)
-{
-
-       return true;
-}
-#endif
-
-#ifndef pmap_update
-void
-pmap_update(pmap_t pmap)
-{
-
-}
-#endif
+struct pmap *const kernel_pmap_ptr = (struct pmap *const)-1;
 
 void
 pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int fl)
@@ -110,11 +62,6 @@
        panic("%s: unavailable", __func__);
 }
 
-/*
- * It's a brave new world.
- */
-#if !defined(__vax__)
-
 void
 pmap_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva)
 {
@@ -130,137 +77,16 @@
        return true;
 }
 



Home | Main Index | Thread Index | Old Index