Merge branch 'master' of github.com:Minep/lunaix-os
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / dmm.h
index 22b0539391248ba746236e7f9422f821654c2e68..346c4794d9ecad2edba4358245d5e9f34cd83bec 100644 (file)
@@ -2,6 +2,8 @@
 #define __LUNAIX_DMM_H
 // Dynamic Memory (i.e., heap) Manager
 
 #define __LUNAIX_DMM_H
 // Dynamic Memory (i.e., heap) Manager
 
+#include <lunaix/mm/mm.h>
+#include <lunaix/process.h>
 #include <stddef.h>
 
 #define M_ALLOCATED 0x1
 #include <stddef.h>
 
 #define M_ALLOCATED 0x1
 
 #define PACK(size, flags) (((size) & ~0x3) | (flags))
 
 
 #define PACK(size, flags) (((size) & ~0x3) | (flags))
 
-#define SW(p, w) (*((uint32_t*)(p)) = w)
-#define LW(p) (*((uint32_t*)(p)))
+#define SW(p, w) (*((u32_t*)(p)) = w)
+#define LW(p) (*((u32_t*)(p)))
 
 
-#define HPTR(bp) ((uint32_t*)(bp)-1)
+#define HPTR(bp) ((u32_t*)(bp)-1)
 #define BPTR(bp) ((uint8_t*)(bp) + WSIZE)
 #define BPTR(bp) ((uint8_t*)(bp) + WSIZE)
-#define FPTR(hp, size) ((uint32_t*)(hp + size - WSIZE))
+#define FPTR(hp, size) ((u32_t*)(hp + size - WSIZE))
 #define NEXT_CHK(hp) ((uint8_t*)(hp) + CHUNK_S(LW(hp)))
 
 #define BOUNDARY 4
 #define NEXT_CHK(hp) ((uint8_t*)(hp) + CHUNK_S(LW(hp)))
 
 #define BOUNDARY 4
 
 #define HEAP_INIT_SIZE 4096
 
 
 #define HEAP_INIT_SIZE 4096
 
-typedef struct 
-{
-    void* start;
-    void* brk;
-    void* max_addr;
-} heap_context_t;
-
-
 int
 dmm_init(heap_context_t* heap);
 
 int
 int
 dmm_init(heap_context_t* heap);
 
 int
-lxsbrk(heap_context_t* heap, void* addr);
+lxbrk(heap_context_t* heap, void* addr, int user);
+
 void*
 void*
-lxbrk(heap_context_t* heap, size_t size);
+lxsbrk(heap_context_t* heap, size_t size, int user);
 
 void*
 lx_malloc_internal(heap_context_t* heap, size_t size);
 
 void*
 lx_malloc_internal(heap_context_t* heap, size_t size);