diff src/memlayout.h @ 0:83c23a36980d

Init
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Fri, 26 May 2017 23:11:05 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/memlayout.h	Fri May 26 23:11:05 2017 +0900
@@ -0,0 +1,22 @@
+// Memory layout
+
+// Key addresses for address space layout (see kmap in vm.c for layout)
+#define EXTMEM	  		0x20000
+#define KERNBASE  		0x80000000         // First kernel virtual address
+#define KERNLINK  		(KERNBASE+EXTMEM)  // Address where kernel is linked
+
+// we first map 1MB low memory containing kernel code.
+#define INIT_KERNMAP 	0x100000
+
+#ifndef __ASSEMBLER__
+
+static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
+static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
+
+#endif
+
+#define V2P(a) (((uint) (a)) - KERNBASE)
+#define P2V(a) (((void *) (a)) + KERNBASE)
+
+#define V2P_WO(x) ((x) - KERNBASE)    // same as V2P, but without casts
+#define P2V_WO(x) ((x) + KERNBASE)    // same as V2P, but without casts