]> git.corax.cc Git - corax/commitdiff
Make page frame allocations available to other kernel functions; move ALIGNED() and...
authorMatthias Kruk <m@m10k.eu>
Mon, 16 Sep 2019 14:14:32 +0000 (23:14 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 16 Sep 2019 14:14:32 +0000 (23:14 +0900)
kernel/arch/paging.c
kernel/arch/paging.h

index 3f191a62766ed34d777a282db05ab0b19cc87391..2a9a206045d3b02480649fb9f7fed5c704886d10 100644 (file)
@@ -42,9 +42,6 @@ static const char *_str_pg_mode[] = {
     "Intel64 mode"
 };
 
-#define ALIGNED(_v, _a) (!((_v) & (((_a) - 1))))
-#define ALIGN(_v, _a)   (ALIGNED((_v), (_a)) ? (_v) : (((_v) & ~((_a) - 1)) + (_a)))
-
 static void* _phys_alloc(u32_t size, u32_t align)
 {
     extern u32_t _mem_start;
@@ -67,7 +64,7 @@ static void* _phys_alloc(u32_t size, u32_t align)
     return(addr);
 }
 
-static void* _frame_alloc_start(void)
+void* pg_frame_alloc_start(void)
 {
        u32_t frm;
 
@@ -91,7 +88,7 @@ static void* _frame_alloc_start(void)
        return(NULL);
 }
 
-static void* _frame_alloc_end(void)
+void* pg_frame_alloc_end(void)
 {
        u32_t frm;
 
index 0d7b5b62df4aea1ab0c4962d4b391a3ebd2ea070..963c27c0cd200a6c3d13868d5fb571c7ea614a4e 100644 (file)
@@ -60,6 +60,9 @@ struct pae_page_table {
     u64_t ppt_entries[512];
 } __attribute__((packed));
 
+#define ALIGNED(_v, _a) (!((_v) & (((_a) - 1))))
+#define ALIGN(_v, _a)   (ALIGNED((_v), (_a)) ? (_v) : (((_v) & ~((_a) - 1)) + (_a)))
+
 #define PDPT_ALIGN          32
 #define PAGE_ALIGN          0x1000
 #define ARCH_ALIGN         sizeof(void*)
@@ -80,6 +83,9 @@ struct pae_page_table {
 #define PAGE_ATTR_GLOBAL            (1 << 8)
 #define PAGE_ATTR_NO_EXEC           (1 << 63)
 
+void* pg_frame_alloc_start(void);
+void* pg_frame_alloc_end(void);
+
 int   pagedir_init(struct pagedir*);
 void* pagedir_map_pages(struct pagedir*);
 int   pagedir_free(struct pagedir*);