]> git.ameliathe1st.gay Git - voyage-au-centre-des-fichiers.git/commitdiff
Added a special case for deallocating a 0-sized block, and remove the unimplemented...
authorAmelia Coutard <eliottulio.coutard@gmail.com>
Sat, 7 May 2022 15:29:38 +0000 (17:29 +0200)
committerAmelia Coutard <eliottulio.coutard@gmail.com>
Sat, 7 May 2022 15:29:38 +0000 (17:29 +0200)
src/paging.cpp
src/paging.hpp

index f3b45cd3ee3acbee32c8080e0e755c7060e6b2bb..d84150933a45826f2867cc92ae766de5f22dc278 100644 (file)
@@ -18,7 +18,6 @@ void os::paging::page_allocator::print_all() const {
        }
 }
 
-// void os::paging::page_allocator::mark_as_used(block b);
 os::paging::page_allocator::block os::paging::page_allocator::allocate(std::uint64_t count) {
        for (auto it = begin(); it != end(); it = it->next) {
                if (count == it->size) {
@@ -38,6 +37,7 @@ os::paging::page_allocator::block os::paging::page_allocator::allocate(std::uint
        return { .ptr = nullptr, .size = 0 };
 }
 void os::paging::page_allocator::deallocate(block b) {
+       if (b.size == 0) { return; }
        const phys_ptr<page> b_it{b.ptr.get_phys_addr()};
        auto it = begin();
        while (it != end() && it < b_it) { it = it->next; }
index 779e4cce63ed3c7f447d30acfc9e83abe5ec0206..76024d7ec45843e6827cf9de2191b20468bcfa46 100644 (file)
@@ -156,7 +156,6 @@ public:
        page_allocator(phys_ptr<paging::page> one_past_end_page);
        void print_all() const;
 
-       void mark_as_used(block b);
        block allocate(std::uint64_t page_count);
        void deallocate(block b);