summaryrefslogtreecommitdiff
path: root/kc
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-01-17 11:40:01 +0000
committerAda Christine <adachristine18@gmail.com>2022-01-17 11:40:01 +0000
commitdc7152c1cc6412871e1120ed53fb94ed386613cc (patch)
tree5568277a30ff54f95496831f6191ee2787ccc371 /kc
parent8fe5dedec3c03a59809d8970362200a1f7b033ce (diff)
initialize outside of the check
Diffstat (limited to 'kc')
-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;