From 782fddf606b9020f70ba4add6b7751f48767e3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Quei=C3=9Fner?= Date: Tue, 3 May 2016 00:43:14 +0200 Subject: [PATCH] Adds stub class for physical memory managment. --- prototypes/base/Makefile | 5 ++++- prototypes/base/include/pmm.hpp | 28 ++++++++++++++++++++++++++++ prototypes/base/src/pmm.cpp | 16 ++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 prototypes/base/include/pmm.hpp create mode 100644 prototypes/base/src/pmm.cpp diff --git a/prototypes/base/Makefile b/prototypes/base/Makefile index 3692e6d..27c76cc 100644 --- a/prototypes/base/Makefile +++ b/prototypes/base/Makefile @@ -38,4 +38,7 @@ kernel-base.ker: $(OBJS) run: qemu-system-i386 -kernel kernel-base.ker -bnr: kernel-base.ker run \ No newline at end of file +bnr: kernel-base.ker run + +deploy: kernel-base.ker + cp kernel-base.ker /srv/tftp/kernel-base.ker \ No newline at end of file diff --git a/prototypes/base/include/pmm.hpp b/prototypes/base/include/pmm.hpp new file mode 100644 index 0000000..c3c45c8 --- /dev/null +++ b/prototypes/base/include/pmm.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +/** + * Physical memory management tool. + */ +class PMM +{ +private: + PMM() = delete; +public: + /** + * Marks a page as occupied by external memory management. + * @returns true if the page was previously free, false if it was already allocated. + */ + static bool markOccupied(void *page); + + /** + * Allocates a single page. + */ + static void* alloc(); + + /** + * Frees a given page by pointer. + */ + static void free(void *page); +}; \ No newline at end of file diff --git a/prototypes/base/src/pmm.cpp b/prototypes/base/src/pmm.cpp new file mode 100644 index 0000000..e0c5834 --- /dev/null +++ b/prototypes/base/src/pmm.cpp @@ -0,0 +1,16 @@ +#include "pmm.hpp" + +bool PMM::markOccupied(void *page) +{ + return false; +} + +void *PMM::alloc() +{ + return nullptr; +} + +void PMM::free(void *page) +{ + +} \ No newline at end of file