Architectural Support: x86_64 (#37)
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / mm.h
index 2af2a9fb2f9272a77fe09d2e6c6d64e71aff858e..d72c405656a86a40c6c553335b19d16f748122f0 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef __LUNAIX_MM_H
 #define __LUNAIX_MM_H
 
-#include <lunaix/ds/llist.h>
-#include <lunaix/ds/mutex.h>
-#include <lunaix/fs.h>
 #include <lunaix/types.h>
+#include <lunaix/ds/llist.h>
+
+#include <sys/mm/memory.h>
 
 #include <usr/lunaix/mann_flags.h>
 
@@ -37,6 +37,7 @@
 #define REGION_EXEC PROT_EXEC
 #define REGION_ANON MAP_ANON
 #define REGION_RW REGION_READ | REGION_WRITE
+#define REGION_KERNEL (1 << 31)
 
 #define REGION_TYPE_CODE (1 << 16)
 #define REGION_TYPE_GENERAL (2 << 16)
@@ -44,8 +45,6 @@
 #define REGION_TYPE_STACK (4 << 16)
 #define REGION_TYPE_VARS (5 << 16)
 
-struct proc_mm;
-
 struct mm_region
 {
     struct llist_header head; // must be first field!
@@ -56,11 +55,11 @@ struct mm_region
     // mapped file offset
     off_t foff;
     // mapped file length
-    u32_t flen; // XXX it seems that we don't need this actually..
 
     ptr_t start;
     ptr_t end;
     u32_t attr;
+    size_t flen;
 
     void** index; // fast reference, to accelerate access to this very region.
 
@@ -71,21 +70,5 @@ struct mm_region
     void (*destruct_region)(struct mm_region*);
 };
 
-static inline void
-mm_index(void** index, struct mm_region* target)
-{
-    *index = (void*)target;
-    target->index = index;
-}
-
-typedef struct llist_header vm_regions_t;
-
-struct proc_mm
-{
-    vm_regions_t regions;
-    struct mm_region* heap;
-    struct mm_region* stack;
-    pid_t pid;
-};
 
 #endif /* __LUNAIX_MM_H */