summaryrefslogtreecommitdiff
path: root/kc/core/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'kc/core/memory.c')
-rw-r--r--kc/core/memory.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kc/core/memory.c b/kc/core/memory.c
index 8feab88..9956bfd 100644
--- a/kc/core/memory.c
+++ b/kc/core/memory.c
@@ -516,9 +516,9 @@ void *vm_alloc_at(void *address, size_t size)
void *vm_alloc(size_t size)
{
// TODO: gap-finding algorithm for failed allocations
- void *address;
+ void *address = vm_alloc_at(vm_next_free, size);
- if (NULL != (address = vm_alloc_at(vm_next_free, size)))
+ if (address)
{
vm_next_free = (char *)address + size;
return address;
@@ -616,6 +616,14 @@ int page_fault_handler(uint32_t code, void *address)
return 0;
}
+int general_protection_handler(uint32_t code)
+{
+ //TODO: implement #gp handler
+ (void)code;
+ panic(UNHANDLED_FAULT);
+ return 0;
+}
+
static int core_image_handler(uint32_t code, void *address)
{
(void) code;