summaryrefslogtreecommitdiff
path: root/kc/core/memory.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2021-12-29 01:58:00 +0000
committerAda Christine <adachristine18@gmail.com>2021-12-29 01:58:00 +0000
commitf3c640714ab30ab413046b2608defc0c5dd9c91d (patch)
treef7e6fa42ba9e85effedf1d406795e73b9af55d61 /kc/core/memory.c
parentce3114115c1553ec645c6344020ff2608b904ffa (diff)
add memory_init() again
Diffstat (limited to 'kc/core/memory.c')
-rw-r--r--kc/core/memory.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kc/core/memory.c b/kc/core/memory.c
index 0e989fd..dda1fb6 100644
--- a/kc/core/memory.c
+++ b/kc/core/memory.c
@@ -13,6 +13,7 @@
* 1. kernel virtual space is 2GiB in size on 2GiB alignment.
* 2. mappings begin at +0x7fc00000. this mapping space is sparse and its
* own mapping tables begin at +0x7fffe000.
+ * 3. There is at least 64KiB of mapped pages following the kc_image_end symbol.
*/
#define kpm1_index(v) (((uint64_t)v >> pte_index_bits(1)) & 0x7ffff)
@@ -325,6 +326,11 @@ static void *page_map_at(void *vaddr,
return (char *)vaddr + offset;
}
+void memory_init(struct memory_range *ranges, size_t count)
+{
+ init_create_page_array(ranges, count);
+}
+
void *page_map(phys_addr_t paddr, enum page_map_flags flags)
{
return page_map_at(get_virtual_page(flags), paddr, flags);