From ceb687b02964197133fd2236cdbc74bf3948d034 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 2 Mar 2015 18:16:15 +0100 Subject: No lazy allocation of kernel memory. Placeholder for pmem freeing routine. --- src/kernel/include/freemem.h | 7 +++++++ src/kernel/include/kmalloc.h | 3 +++ src/kernel/include/region.h | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/kernel/include/freemem.h (limited to 'src/kernel/include') diff --git a/src/kernel/include/freemem.h b/src/kernel/include/freemem.h new file mode 100644 index 0000000..d9c56a7 --- /dev/null +++ b/src/kernel/include/freemem.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +void free_some_memory(); // try to swap some pages and free some physical memory + +/* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/src/kernel/include/kmalloc.h b/src/kernel/include/kmalloc.h index d4a9272..17ea440 100644 --- a/src/kernel/include/kmalloc.h +++ b/src/kernel/include/kmalloc.h @@ -6,6 +6,9 @@ // Kernel memory allocator : one slab allocator for shared memory // Thread-safe. +// The normal malloc() call will try to free some memory when OOM and will loop +// a few times if it cannot. It may fail though. + void kmalloc_setup(); /* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/src/kernel/include/region.h b/src/kernel/include/region.h index a390e06..d5cba2d 100644 --- a/src/kernel/include/region.h +++ b/src/kernel/include/region.h @@ -24,8 +24,8 @@ region_info_t *find_region(void* addr); void region_free(void* addr); // some usefull PF handlers -// default_allocator_pf_handler : just allocates new frames on page faults -void default_allocator_pf_handler(pagedir_t *pd, struct region_info *r, void* addr); +void pf_handler_unexpected(pagedir_t *pd, struct region_info *r, void* addr); // Expects never to be called +void pf_handler_stackoverflow(pagedir_t *pd, struct region_info *r, void* addr); // Stack overflow detected // some functions for freeing regions and frames // region_free_unmap_free : deletes a region and frees all frames that were mapped in it -- cgit v1.2.3