From b981271c64cd5eab84e98b40ed0e7df9adaad29d Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Sun, 5 Nov 2017 08:08:33 +0000 Subject: [PATCH] Add function "memory_free_page" --- arch/memory.c | 11 +++++++++++ arch/memory.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/arch/memory.c b/arch/memory.c index e655464..3c099a5 100644 --- a/arch/memory.c +++ b/arch/memory.c @@ -45,6 +45,17 @@ unsigned long memory_alloc_page() return 0; } +void memory_free_page(const unsigned long addr) +{ + const unsigned long i = addr / PAGE_SIZE; + + if (i >= FRAMES_COUNT) { + return; + } + + frames[i] = 0; +} + void mark_used(const unsigned long base, const unsigned long limit) { const unsigned int start = base / PAGE_SIZE; diff --git a/arch/memory.h b/arch/memory.h index 0b0f139..bd60259 100644 --- a/arch/memory.h +++ b/arch/memory.h @@ -4,6 +4,8 @@ #include void memory_initialize(const struct KernelMQ_Info *kinfo); + unsigned long memory_alloc_page(); +void memory_free_page(unsigned long addr); #endif