Skip to content

Commit

Permalink
Fix broken exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
GrieferAtWork committed Jul 14, 2024
1 parent baf7c67 commit 8ac1773
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions kos/src/kernel/core/arch/i386/memory/paging64.c.inl
Original file line number Diff line number Diff line change
Expand Up @@ -565,16 +565,16 @@ again:

/* Allocate vectors. */
e3_vector = page_mallocone_noblock_for_paging();
if unlikely(!e3_vector)
if unlikely(e3_vector == PHYSPAGE_INVALID)
goto err;
e2_vector = page_mallocone_noblock_for_paging();
if unlikely(!e2_vector) {
if unlikely(e2_vector == PHYSPAGE_INVALID) {
err_e3_vector:
page_freeone_for_paging(e3_vector);
goto err;
}
e1_vector = page_mallocone_noblock_for_paging();
if unlikely(!e1_vector) {
if unlikely(e1_vector == PHYSPAGE_INVALID) {
page_freeone_for_paging(e2_vector);
goto err_e3_vector;
}
Expand Down
2 changes: 1 addition & 1 deletion kos/src/kernel/core/memory/mman/mcoreheap.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ NOTHROW(FCALL mcoreheap_alloc_locked_nx)(void) {
ccstate_t ccstate = CCSTATE_INIT;
do {
if (!system_cc_s_noblock(&ccstate))
THROW(E_BADALLOC_INSUFFICIENT_HEAP_MEMORY, sizeof(*result));
return NULL;
result = mcoreheap_alloc_locked_nx_nocc();
} while (!result);
}
Expand Down
5 changes: 3 additions & 2 deletions kos/src/kernel/moddbx/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ NOTHROW(FCALL allocate_physical_memory)(PAGEDIR_PAGEALIGNED void *addr,
fail:
while (i) {
physaddr_t phys;
byte_t *vaddr = (byte_t *)addr + i;
byte_t *vaddr;
i -= PAGESIZE;
phys = pagedir_translate(vaddr);
vaddr = (byte_t *)addr + i;
phys = pagedir_translate(vaddr);
pagedir_unmapone(vaddr);
page_freeone(physaddr2page(phys));
}
Expand Down
2 changes: 1 addition & 1 deletion kos/src/libdebuginfo/cfi_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ NOTHROW_NCX(CC run_entry_value_emulator)(unwind_emulator_t *__restrict self,
ce = cfientry_alloc(unwind_rega);
ce->_ce_unwind_rega = unwind_rega;
ce->ce_unwind_regc = 0;
ce->ce_emulator = self; /* Initialize "ce_emulator" here because `cfientry_init()' might need it. */

/* Initialize the CFI-entry controller. */
result = cfientry_init(ce, self->ue_regget, self->ue_regget_arg);
Expand All @@ -1094,7 +1095,6 @@ NOTHROW_NCX(CC run_entry_value_emulator)(unwind_emulator_t *__restrict self,
/* Fill in the callee-register accessor callback of `ce' */
ce->ce_regget = self->ue_regget;
ce->ce_regget_arg = self->ue_regget_arg;
ce->ce_emulator = self;
ce->ce_module = NULL;

/* Re-configure `self' for execution. */
Expand Down

0 comments on commit 8ac1773

Please sign in to comment.