summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-05-26 12:47:46 +0200
committerRichard Braun <rbraun@sceen.net>2013-05-26 12:47:46 +0200
commit1a2afc00f24b1e7c05fc5dbcf77dd71b43aab1db (patch)
tree3a7d5819e652a5cd8a5824d1ecab8bd7f67f2c97
parent10009078462ac758a15e65a4e890933e6e51669a (diff)
vm/vm_kmem: check that kernel space doesn't start at 0
Address 0 is commonly used to report allocation errors, in particular to the kmem module, which itself returns NULL on failure.
-rw-r--r--vm/vm_kmem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/vm/vm_kmem.h b/vm/vm_kmem.h
index feaf0b16..f2296ec3 100644
--- a/vm/vm_kmem.h
+++ b/vm/vm_kmem.h
@@ -21,6 +21,14 @@
#include <kern/types.h>
/*
+ * The kernel space is required not to start at address 0, which is used to
+ * report allocation errors.
+ */
+#if VM_MIN_KERNEL_ADDRESS == 0
+#error "kernel space must not start at address 0"
+#endif
+
+/*
* Special kernel addresses.
*/
extern char _text;