summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-25 00:16:26 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-25 00:16:26 +0200
commit9e1c5185ee157f4b0b155c0a788bcd0557c44623 (patch)
treea46c9e4d6b63ec4c1e30f31c69ce1270de54439c
parent9fb3131dbde508526dcbec29aac166ca425cd352 (diff)
Remove the param module
Move the page properties into the new x86/page module, and the virtual memory layout macros into the x86/pmap module.
-rw-r--r--Makefrag.am1
-rw-r--r--arch/x86/Makefrag.am2
-rw-r--r--arch/x86/machine/biosmem.c3
-rw-r--r--arch/x86/machine/boot.c2
-rw-r--r--arch/x86/machine/boot.h7
-rw-r--r--arch/x86/machine/boot_asm.S2
-rw-r--r--arch/x86/machine/cga.c1
-rw-r--r--arch/x86/machine/cpu.c2
-rw-r--r--arch/x86/machine/lapic.c1
-rw-r--r--arch/x86/machine/page.h (renamed from kern/param.h)16
-rw-r--r--arch/x86/machine/param.h99
-rw-r--r--arch/x86/machine/pmap.c35
-rw-r--r--arch/x86/machine/pmap.h66
-rw-r--r--arch/x86/machine/tcb.h2
-rw-r--r--arch/x86/machine/trap.c1
-rw-r--r--arch/x86/machine/trap.h5
-rw-r--r--arch/x86/x15.lds.S5
-rw-r--r--doc/intro.9.txt2
-rw-r--r--doc/style.9.txt6
-rw-r--r--kern/kmem.c2
-rw-r--r--kern/macros.h3
-rw-r--r--kern/sref.c1
-rw-r--r--kern/thread.c2
-rw-r--r--test/test_llsync_defer.c2
-rw-r--r--test/test_pmap_update_mp.c2
-rw-r--r--test/test_vm_page_fill.c1
-rw-r--r--vm/vm_kmem.c2
-rw-r--r--vm/vm_kmem.h6
-rw-r--r--vm/vm_map.c6
-rw-r--r--vm/vm_page.c2
-rw-r--r--vm/vm_page.h10
31 files changed, 133 insertions, 164 deletions
diff --git a/Makefrag.am b/Makefrag.am
index 1607f3cc..886ec1f5 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -54,7 +54,6 @@ x15_SOURCES += \
kern/mutex_types.h \
kern/panic.c \
kern/panic.h \
- kern/param.h \
kern/percpu.c \
kern/percpu.h \
kern/plist.c \
diff --git a/arch/x86/Makefrag.am b/arch/x86/Makefrag.am
index 964d1338..cf536987 100644
--- a/arch/x86/Makefrag.am
+++ b/arch/x86/Makefrag.am
@@ -50,7 +50,7 @@ x15_SOURCES += \
arch/x86/machine/lapic.c \
arch/x86/machine/lapic.h \
arch/x86/machine/multiboot.h \
- arch/x86/machine/param.h \
+ arch/x86/machine/page.h \
arch/x86/machine/pic.c \
arch/x86/machine/pic.h \
arch/x86/machine/pit.c \
diff --git a/arch/x86/machine/biosmem.c b/arch/x86/machine/biosmem.c
index 5d510595..64482c60 100644
--- a/arch/x86/machine/biosmem.c
+++ b/arch/x86/machine/biosmem.c
@@ -25,11 +25,12 @@
#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <machine/biosmem.h>
#include <machine/boot.h>
#include <machine/cpu.h>
#include <machine/multiboot.h>
+#include <machine/page.h>
+#include <machine/pmap.h>
#include <machine/pmem.h>
#include <machine/types.h>
#include <vm/vm_kmem.h>
diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c
index df7a2066..63fcaf0a 100644
--- a/arch/x86/machine/boot.c
+++ b/arch/x86/machine/boot.c
@@ -56,7 +56,6 @@
#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/percpu.h>
#include <kern/sleepq.h>
#include <kern/sref.h>
@@ -70,6 +69,7 @@
#include <machine/cpu.h>
#include <machine/elf.h>
#include <machine/multiboot.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <machine/strace.h>
#include <machine/trap.h>
diff --git a/arch/x86/machine/boot.h b/arch/x86/machine/boot.h
index c2070593..7a4d85d0 100644
--- a/arch/x86/machine/boot.h
+++ b/arch/x86/machine/boot.h
@@ -19,7 +19,8 @@
#define _X86_BOOT_H
#include <kern/macros.h>
-#include <machine/param.h>
+#include <machine/page.h>
+#include <machine/pmap.h>
/*
* Size of the stack used when booting a processor.
@@ -36,7 +37,7 @@
/*
* The kernel is physically loaded at BOOT_OFFSET by the boot loader. It
* is divided in two parts: the .boot section which uses physical addresses
- * and the main kernel code and data at VM_KERNEL_OFFSET.
+ * and the main kernel code and data at PMAP_KERNEL_OFFSET.
*
* See the linker script for more information.
*/
@@ -45,7 +46,7 @@
/*
* Virtual to physical address translation macro.
*/
-#define BOOT_VTOP(addr) ((addr) - VM_KERNEL_OFFSET)
+#define BOOT_VTOP(addr) ((addr) - PMAP_KERNEL_OFFSET)
/*
* Address where the MP trampoline code is copied and run at.
diff --git a/arch/x86/machine/boot_asm.S b/arch/x86/machine/boot_asm.S
index 4393c133..0aaf342e 100644
--- a/arch/x86/machine/boot_asm.S
+++ b/arch/x86/machine/boot_asm.S
@@ -19,7 +19,7 @@
#include <machine/cpu.h>
#include <machine/boot.h>
#include <machine/multiboot.h>
-#include <machine/param.h>
+#include <machine/page.h>
#include <machine/pmap.h>
/*
diff --git a/arch/x86/machine/cga.c b/arch/x86/machine/cga.c
index b59c40f5..3ce4032c 100644
--- a/arch/x86/machine/cga.c
+++ b/arch/x86/machine/cga.c
@@ -25,7 +25,6 @@
#include <kern/cbuf.h>
#include <kern/console.h>
#include <kern/macros.h>
-#include <kern/param.h>
#include <machine/io.h>
#include <machine/cga.h>
#include <vm/vm_page.h>
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index 6baff620..6263e185 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -24,7 +24,6 @@
#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/percpu.h>
#include <kern/thread.h>
#include <kern/xcall.h>
@@ -34,6 +33,7 @@
#include <machine/cpu.h>
#include <machine/io.h>
#include <machine/lapic.h>
+#include <machine/page.h>
#include <machine/pic.h>
#include <machine/pit.h>
#include <machine/pmap.h>
diff --git a/arch/x86/machine/lapic.c b/arch/x86/machine/lapic.c
index e513688c..a0eee852 100644
--- a/arch/x86/machine/lapic.c
+++ b/arch/x86/machine/lapic.c
@@ -24,7 +24,6 @@
#include <kern/log.h>
#include <kern/macros.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/thread.h>
#include <machine/cpu.h>
#include <machine/lapic.h>
diff --git a/kern/param.h b/arch/x86/machine/page.h
index d0061728..43ab237a 100644
--- a/kern/param.h
+++ b/arch/x86/machine/page.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Richard Braun.
+ * Copyright (c) 2017 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -13,11 +13,17 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ * This file is a top header in the inclusion hierarchy, and shouldn't include
+ * other headers that may cause circular dependencies.
*/
-#ifndef _KERN_PARAM_H
-#define _KERN_PARAM_H
+#ifndef _X86_PAGE_H
+#define _X86_PAGE_H
-#include <machine/param.h>
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
-#endif /* _KERN_PARAM_H */
+#endif /* _X86_PAGE_H */
diff --git a/arch/x86/machine/param.h b/arch/x86/machine/param.h
deleted file mode 100644
index 7f1fc2e4..00000000
--- a/arch/x86/machine/param.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2010-2014 Richard Braun.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- * This file is a top header in the inclusion hierarchy, and shouldn't include
- * other headers that may cause circular dependencies.
- */
-
-#ifndef _X86_PARAM_H
-#define _X86_PARAM_H
-
-#include <kern/macros.h>
-
-/*
- * 4 KiB pages.
- */
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-/*
- * Virtual memory properties.
- */
-
-/*
- * User space boundaries.
- */
-#define VM_MIN_ADDRESS DECL_CONST(0, UL)
-
-#ifdef __LP64__
-#define VM_MAX_ADDRESS DECL_CONST(0x800000000000, UL)
-#else /* __LP64__ */
-#define VM_MAX_ADDRESS DECL_CONST(0xc0000000, UL)
-#endif/* __LP64__ */
-
-/*
- * Kernel space boundaries.
- */
-#ifdef __LP64__
-#define VM_MIN_KERNEL_ADDRESS DECL_CONST(0xffff800000000000, UL)
-#define VM_MAX_KERNEL_ADDRESS DECL_CONST(0xfffffffffffff000, UL)
-#else /* __LP64__ */
-#define VM_MIN_KERNEL_ADDRESS VM_MAX_ADDRESS
-#define VM_MAX_KERNEL_ADDRESS DECL_CONST(0xfffff000, UL)
-#endif /* __LP64__ */
-
-/*
- * Direct physical mapping boundaries.
- */
-#ifdef __LP64__
-#define VM_MIN_DIRECTMAP_ADDRESS VM_MIN_KERNEL_ADDRESS
-#define VM_MAX_DIRECTMAP_ADDRESS DECL_CONST(0xffffc00000000000, UL)
-#else /* __LP64__ */
-#define VM_MIN_DIRECTMAP_ADDRESS VM_MAX_ADDRESS
-#define VM_MAX_DIRECTMAP_ADDRESS DECL_CONST(0xf8000000, UL)
-#endif /* __LP64__ */
-
-/*
- * Kernel mapping offset.
- *
- * On 32-bits systems, the kernel is linked at addresses included in the
- * direct physical mapping, whereas on 64-bits systems, it is linked at
- * -2 GiB because the "kernel" memory model is used when compiling (see
- * the -mcmodel=kernel gcc option).
- */
-#ifdef __LP64__
-#define VM_KERNEL_OFFSET DECL_CONST(0xffffffff80000000, UL)
-#else /* __LP64__ */
-#define VM_KERNEL_OFFSET VM_MIN_DIRECTMAP_ADDRESS
-#endif /* __LP64__ */
-
-/*
- * Kernel virtual space boundaries.
- *
- * In addition to the direct physical mapping, the kernel has its own virtual
- * memory space.
- */
-#define VM_MIN_KMEM_ADDRESS VM_MAX_DIRECTMAP_ADDRESS
-
-#ifdef __LP64__
-#define VM_MAX_KMEM_ADDRESS VM_KERNEL_OFFSET
-#else /* __LP64__ */
-#define VM_MAX_KMEM_ADDRESS VM_MAX_KERNEL_ADDRESS
-#endif /* __LP64__ */
-
-#endif /* _X86_PARAM_H */
diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c
index 0520c132..628a9d93 100644
--- a/arch/x86/machine/pmap.c
+++ b/arch/x86/machine/pmap.c
@@ -31,7 +31,6 @@
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/percpu.h>
#include <kern/spinlock.h>
#include <kern/syscnt.h>
@@ -40,6 +39,7 @@
#include <machine/boot.h>
#include <machine/cpu.h>
#include <machine/lapic.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <machine/trap.h>
#include <machine/types.h>
@@ -447,11 +447,12 @@ pmap_setup_paging(void)
directmap_end = biosmem_directmap_end();
- if (directmap_end > (VM_MAX_DIRECTMAP_ADDRESS - VM_MIN_DIRECTMAP_ADDRESS)) {
+ if (directmap_end > (PMAP_MAX_DIRECTMAP_ADDRESS
+ - PMAP_MIN_DIRECTMAP_ADDRESS)) {
boot_panic(pmap_panic_directmap_msg);
}
- va = VM_MIN_DIRECTMAP_ADDRESS;
+ va = PMAP_MIN_DIRECTMAP_ADDRESS;
pa = 0;
for (i = 0; i < directmap_end; i += pgsize) {
@@ -464,7 +465,7 @@ pmap_setup_paging(void)
/*
* On 64-bits systems, the kernel isn't linked at addresses included
* in the direct mapping, which requires the creation of an additional
- * mapping for it. See param.h for more details.
+ * mapping for it.
*/
va = P2ALIGN((uintptr_t)&_init, pgsize);
pa = BOOT_VTOP(va);
@@ -509,14 +510,14 @@ pmap_ap_setup_paging(void)
#define pmap_assert_range(pmap, start, end) \
MACRO_BEGIN \
assert((start) < (end)); \
- assert(((end) <= VM_MIN_DIRECTMAP_ADDRESS) \
- || ((start) >= VM_MAX_DIRECTMAP_ADDRESS)); \
+ assert(((end) <= PMAP_MIN_DIRECTMAP_ADDRESS) \
+ || ((start) >= PMAP_MAX_DIRECTMAP_ADDRESS)); \
\
if ((pmap) == kernel_pmap) { \
- assert(((start) >= VM_MIN_KMEM_ADDRESS) \
- && ((end) <= VM_MAX_KMEM_ADDRESS)); \
+ assert(((start) >= PMAP_MIN_KMEM_ADDRESS) \
+ && ((end) <= PMAP_MAX_KMEM_ADDRESS)); \
} else { \
- assert((end) <= VM_MAX_ADDRESS); \
+ assert((end) <= PMAP_MAX_ADDRESS); \
} \
MACRO_END
@@ -583,7 +584,7 @@ pmap_walk_vas(uintptr_t start, uintptr_t end, pmap_walk_fn_t walk_fn)
assert(vm_page_aligned(start));
assert(start < end);
#ifdef __LP64__
- assert((start < VM_MAX_ADDRESS) || (start >= VM_MIN_KERNEL_ADDRESS));
+ assert((start < PMAP_MAX_ADDRESS) || (start >= PMAP_MIN_KERNEL_ADDRESS));
#endif /* __LP64__ */
va = start;
@@ -592,8 +593,8 @@ pmap_walk_vas(uintptr_t start, uintptr_t end, pmap_walk_fn_t walk_fn)
do {
#ifdef __LP64__
/* Handle long mode canonical form */
- if (va == VM_MAX_ADDRESS) {
- va = VM_MIN_KERNEL_ADDRESS;
+ if (va == PMAP_MAX_ADDRESS) {
+ va = PMAP_MIN_KERNEL_ADDRESS;
}
#endif /* __LP64__ */
@@ -641,7 +642,7 @@ pmap_setup_global_page(phys_addr_t ptp_pa, unsigned int index,
static void __init
pmap_setup_global_pages(void)
{
- pmap_walk_vas(VM_MIN_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS,
+ pmap_walk_vas(PMAP_MIN_KERNEL_ADDRESS, PMAP_MAX_KERNEL_ADDRESS,
pmap_setup_global_page);
pmap_pt_levels[0].mask |= PMAP_PTE_G;
cpu_enable_global_pages();
@@ -900,7 +901,7 @@ pmap_setup_set_ptp_type(phys_addr_t ptp_pa, unsigned int index,
static void __init
pmap_setup_fix_ptps(void)
{
- pmap_walk_vas(VM_MIN_ADDRESS, VM_MAX_KERNEL_ADDRESS,
+ pmap_walk_vas(PMAP_MIN_ADDRESS, PMAP_MAX_KERNEL_ADDRESS,
pmap_setup_set_ptp_type);
}
@@ -946,8 +947,8 @@ pmap_copy_cpu_table_recursive(const pmap_pte_t *sptp, unsigned int level,
i++, va = P2END(va, 1UL << pt_level->skip)) {
#ifdef __LP64__
/* Handle long mode canonical form */
- if (va == VM_MAX_ADDRESS) {
- va = VM_MIN_KERNEL_ADDRESS;
+ if (va == PMAP_MAX_ADDRESS) {
+ va = PMAP_MIN_KERNEL_ADDRESS;
}
#endif /* __LP64__ */
@@ -1006,7 +1007,7 @@ pmap_copy_cpu_table(unsigned int cpu)
dptp = vm_page_direct_ptr(page);
#endif /* X15_X86_PAE */
- pmap_copy_cpu_table_recursive(sptp, level, dptp, VM_MIN_ADDRESS);
+ pmap_copy_cpu_table_recursive(sptp, level, dptp, PMAP_MIN_ADDRESS);
}
void __init
diff --git a/arch/x86/machine/pmap.h b/arch/x86/machine/pmap.h
index 9c76f5d8..2b23126d 100644
--- a/arch/x86/machine/pmap.h
+++ b/arch/x86/machine/pmap.h
@@ -24,6 +24,71 @@
#include <kern/macros.h>
/*
+ * Virtual memory layout.
+ */
+
+/*
+ * User space boundaries.
+ */
+#define PMAP_MIN_ADDRESS DECL_CONST(0, UL)
+
+#ifdef __LP64__
+#define PMAP_MAX_ADDRESS DECL_CONST(0x800000000000, UL)
+#else /* __LP64__ */
+#define PMAP_MAX_ADDRESS DECL_CONST(0xc0000000, UL)
+#endif/* __LP64__ */
+
+/*
+ * Kernel space boundaries.
+ */
+#ifdef __LP64__
+#define PMAP_MIN_KERNEL_ADDRESS DECL_CONST(0xffff800000000000, UL)
+#define PMAP_MAX_KERNEL_ADDRESS DECL_CONST(0xfffffffffffff000, UL)
+#else /* __LP64__ */
+#define PMAP_MIN_KERNEL_ADDRESS PMAP_MAX_ADDRESS
+#define PMAP_MAX_KERNEL_ADDRESS DECL_CONST(0xfffff000, UL)
+#endif /* __LP64__ */
+
+/*
+ * Direct physical mapping boundaries.
+ */
+#ifdef __LP64__
+#define PMAP_MIN_DIRECTMAP_ADDRESS PMAP_MIN_KERNEL_ADDRESS
+#define PMAP_MAX_DIRECTMAP_ADDRESS DECL_CONST(0xffffc00000000000, UL)
+#else /* __LP64__ */
+#define PMAP_MIN_DIRECTMAP_ADDRESS PMAP_MAX_ADDRESS
+#define PMAP_MAX_DIRECTMAP_ADDRESS DECL_CONST(0xf8000000, UL)
+#endif /* __LP64__ */
+
+/*
+ * Kernel mapping offset.
+ *
+ * On 32-bits systems, the kernel is linked at addresses included in the
+ * direct physical mapping, whereas on 64-bits systems, it is linked at
+ * -2 GiB because the "kernel" memory model is used when compiling (see
+ * the -mcmodel=kernel gcc option).
+ */
+#ifdef __LP64__
+#define PMAP_KERNEL_OFFSET DECL_CONST(0xffffffff80000000, UL)
+#else /* __LP64__ */
+#define PMAP_KERNEL_OFFSET PMAP_MIN_DIRECTMAP_ADDRESS
+#endif /* __LP64__ */
+
+/*
+ * Kernel virtual space boundaries.
+ *
+ * In addition to the direct physical mapping, the kernel has its own virtual
+ * memory space.
+ */
+#define PMAP_MIN_KMEM_ADDRESS PMAP_MAX_DIRECTMAP_ADDRESS
+
+#ifdef __LP64__
+#define PMAP_MAX_KMEM_ADDRESS PMAP_KERNEL_OFFSET
+#else /* __LP64__ */
+#define PMAP_MAX_KMEM_ADDRESS PMAP_MAX_KERNEL_ADDRESS
+#endif /* __LP64__ */
+
+/*
* Page table entry flags.
*/
#define PMAP_PTE_P 0x00000001
@@ -103,7 +168,6 @@
#include <kern/mutex.h>
#include <kern/thread.h>
#include <machine/cpu.h>
-#include <machine/trap.h>
#include <machine/types.h>
/*
diff --git a/arch/x86/machine/tcb.h b/arch/x86/machine/tcb.h
index 0bb900c6..b5b20bfc 100644
--- a/arch/x86/machine/tcb.h
+++ b/arch/x86/machine/tcb.h
@@ -25,8 +25,8 @@
#include <stdint.h>
#include <kern/macros.h>
-#include <kern/param.h>
#include <machine/cpu.h>
+#include <machine/page.h>
/*
* Thread stack size.
diff --git a/arch/x86/machine/trap.c b/arch/x86/machine/trap.c
index 59502314..19ddaf70 100644
--- a/arch/x86/machine/trap.c
+++ b/arch/x86/machine/trap.c
@@ -26,7 +26,6 @@
#include <kern/atomic.h>
#include <kern/init.h>
#include <kern/macros.h>
-#include <kern/param.h>
#include <kern/spinlock.h>
#include <kern/thread.h>
#include <machine/cpu.h>
diff --git a/arch/x86/machine/trap.h b/arch/x86/machine/trap.h
index 94639c0f..646eda30 100644
--- a/arch/x86/machine/trap.h
+++ b/arch/x86/machine/trap.h
@@ -16,12 +16,15 @@
*
*
* Trap (interrupt and exception) handling.
+ *
+ * This file is a top header in the inclusion hierarchy, and shouldn't include
+ * other headers that may cause circular dependencies.
*/
#ifndef _X86_TRAP_H
#define _X86_TRAP_H
-#include <kern/param.h>
+#include <machine/page.h>
/*
* Architecture defined traps.
diff --git a/arch/x86/x15.lds.S b/arch/x86/x15.lds.S
index b5400c45..0bf809b9 100644
--- a/arch/x86/x15.lds.S
+++ b/arch/x86/x15.lds.S
@@ -10,7 +10,8 @@ ENTRY(_start)
#include <machine/boot.h>
#include <machine/cpu.h>
-#include <machine/param.h>
+#include <machine/page.h>
+#include <machine/pmap.h>
PHDRS
{
@@ -37,7 +38,7 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
_boot_end = .;
- . += VM_KERNEL_OFFSET;
+ . += PMAP_KERNEL_OFFSET;
_init = .;
.init ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.init))) {
diff --git a/doc/intro.9.txt b/doc/intro.9.txt
index 37691a18..e3eb4ee2 100644
--- a/doc/intro.9.txt
+++ b/doc/intro.9.txt
@@ -219,8 +219,6 @@ module:arch/atomic::
Architecture-specific support for atomic instructions.
module:arch/cpu::
Processor interface.
-module:arch/param::
- Miscellaneous parameters.
module:arch/pmap::
Physical mappings, the MMU driver.
module:arch/strace::
diff --git a/doc/style.9.txt b/doc/style.9.txt
index 1f8b23e5..51ff0432 100644
--- a/doc/style.9.txt
+++ b/doc/style.9.txt
@@ -387,12 +387,6 @@ kmem_cache_alloc(struct kmem_cache *cache)
void kmem_info(void);
--------------------------------------------------------------------------------
-There is currently one exception to the naming rules, which is the
-module:arch/param module. The only API changes allowed on this module
-are removals, in order to move certain symbols where they should be,
-and renames using the param namespace, for symbols that actually belong
-to the module.
-
FUNCTIONS
---------
diff --git a/kern/kmem.c b/kern/kmem.c
index 90557310..572df4fe 100644
--- a/kern/kmem.c
+++ b/kern/kmem.c
@@ -57,10 +57,10 @@
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/shell.h>
#include <kern/thread.h>
#include <machine/cpu.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <vm/vm_kmem.h>
#include <vm/vm_page.h>
diff --git a/kern/macros.h b/kern/macros.h
index 63ded053..743bdc0d 100644
--- a/kern/macros.h
+++ b/kern/macros.h
@@ -16,6 +16,9 @@
*
*
* Helper macros.
+ *
+ * This file is a top header in the inclusion hierarchy, and shouldn't include
+ * other headers that may cause circular dependencies.
*/
#ifndef _KERN_MACROS_H
diff --git a/kern/sref.c b/kern/sref.c
index bc3f9e98..7c4f14e1 100644
--- a/kern/sref.c
+++ b/kern/sref.c
@@ -53,7 +53,6 @@
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/percpu.h>
#include <kern/spinlock.h>
#include <kern/sref.h>
diff --git a/kern/thread.c b/kern/thread.c
index cd0717c4..eb0f1eb5 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -99,7 +99,6 @@
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/percpu.h>
#include <kern/shell.h>
#include <kern/sleepq.h>
@@ -111,6 +110,7 @@
#include <kern/turnstile.h>
#include <kern/work.h>
#include <machine/cpu.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <machine/tcb.h>
#include <vm/vm_map.h>
diff --git a/test/test_llsync_defer.c b/test/test_llsync_defer.c
index 26747998..249c53a5 100644
--- a/test/test_llsync_defer.c
+++ b/test/test_llsync_defer.c
@@ -39,9 +39,9 @@
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/thread.h>
#include <kern/work.h>
+#include <machine/page.h>
#include <test/test.h>
#include <vm/vm_kmem.h>
diff --git a/test/test_pmap_update_mp.c b/test/test_pmap_update_mp.c
index 5588ce83..c058323a 100644
--- a/test/test_pmap_update_mp.c
+++ b/test/test_pmap_update_mp.c
@@ -33,8 +33,8 @@
#include <kern/error.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/thread.h>
+#include <machine/page.h>
#include <test/test.h>
#include <vm/vm_kmem.h>
diff --git a/test/test_vm_page_fill.c b/test/test_vm_page_fill.c
index fe351038..2b7f1130 100644
--- a/test/test_vm_page_fill.c
+++ b/test/test_vm_page_fill.c
@@ -30,6 +30,7 @@
#include <kern/error.h>
#include <kern/list.h>
#include <kern/thread.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <test/test.h>
#include <vm/vm_kmem.h>
diff --git a/vm/vm_kmem.c b/vm/vm_kmem.c
index 8139ddb1..488ae30d 100644
--- a/vm/vm_kmem.c
+++ b/vm/vm_kmem.c
@@ -26,7 +26,7 @@
#include <kern/init.h>
#include <kern/macros.h>
#include <kern/panic.h>
-#include <kern/param.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <machine/types.h>
#include <vm/vm_adv.h>
diff --git a/vm/vm_kmem.h b/vm/vm_kmem.h
index 30c7cd32..3628a690 100644
--- a/vm/vm_kmem.h
+++ b/vm/vm_kmem.h
@@ -20,16 +20,16 @@
#include <stdint.h>
-#include <kern/param.h>
+#include <machine/pmap.h>
#include <machine/types.h>
/*
* The kernel space is required not to start at address 0, which is used to
* report allocation errors.
*/
-#if VM_MIN_KMEM_ADDRESS == 0
+#if PMAP_MIN_KMEM_ADDRESS == 0
#error "kernel space must not start at address 0"
-#endif /* VM_MIN_KMEM_ADDRESS == 0 */
+#endif /* PMAP_MIN_KMEM_ADDRESS == 0 */
/*
* Special kernel addresses.
diff --git a/vm/vm_map.c b/vm/vm_map.c
index abe2aa83..389678b6 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -31,10 +31,10 @@
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/rbtree.h>
#include <kern/shell.h>
#include <kern/task.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <vm/vm_adv.h>
#include <vm/vm_inherit.h>
@@ -734,7 +734,7 @@ void __init
vm_map_setup(void)
{
vm_map_init(kernel_map, kernel_pmap,
- VM_MIN_KMEM_ADDRESS, VM_MAX_KMEM_ADDRESS);
+ PMAP_MIN_KMEM_ADDRESS, PMAP_MAX_KMEM_ADDRESS);
kmem_cache_init(&vm_map_entry_cache, "vm_map_entry",
sizeof(struct vm_map_entry), 0, NULL,
KMEM_CACHE_PAGE_ONLY);
@@ -763,7 +763,7 @@ vm_map_create(struct vm_map **mapp)
goto error_pmap;
}
- vm_map_init(map, pmap, VM_MIN_ADDRESS, VM_MAX_ADDRESS);
+ vm_map_init(map, pmap, PMAP_MIN_ADDRESS, PMAP_MAX_ADDRESS);
*mapp = map;
return 0;
diff --git a/vm/vm_page.c b/vm/vm_page.c
index 2c48a0dd..caa8c98c 100644
--- a/vm/vm_page.c
+++ b/vm/vm_page.c
@@ -41,10 +41,10 @@
#include <kern/macros.h>
#include <kern/mutex.h>
#include <kern/panic.h>
-#include <kern/param.h>
#include <kern/shell.h>
#include <kern/thread.h>
#include <machine/cpu.h>
+#include <machine/page.h>
#include <machine/pmem.h>
#include <machine/types.h>
#include <vm/vm_page.h>
diff --git a/vm/vm_page.h b/vm/vm_page.h
index 86ab5277..026c1180 100644
--- a/vm/vm_page.h
+++ b/vm/vm_page.h
@@ -28,7 +28,7 @@
#include <kern/list.h>
#include <kern/log2.h>
#include <kern/macros.h>
-#include <kern/param.h>
+#include <machine/page.h>
#include <machine/pmap.h>
#include <machine/pmem.h>
#include <machine/types.h>
@@ -107,15 +107,15 @@ static inline uintptr_t
vm_page_direct_va(phys_addr_t pa)
{
assert(pa < PMEM_DIRECTMAP_LIMIT);
- return ((uintptr_t)pa + VM_MIN_DIRECTMAP_ADDRESS);
+ return ((uintptr_t)pa + PMAP_MIN_DIRECTMAP_ADDRESS);
}
static inline phys_addr_t
vm_page_direct_pa(uintptr_t va)
{
- assert(va >= VM_MIN_DIRECTMAP_ADDRESS);
- assert(va < VM_MAX_DIRECTMAP_ADDRESS);
- return (va - VM_MIN_DIRECTMAP_ADDRESS);
+ assert(va >= PMAP_MIN_DIRECTMAP_ADDRESS);
+ assert(va < PMAP_MAX_DIRECTMAP_ADDRESS);
+ return (va - PMAP_MIN_DIRECTMAP_ADDRESS);
}
static inline void *