diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-09 18:04:59 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-09 18:04:59 +0100 |
commit | caf842864bdc0794e387f9580af96ab1036996f4 (patch) | |
tree | 92b1e05e5ed79628132e320dcaa84a25eebd0dd7 /src/kernel/core/paging.c | |
parent | 3b03f1e41558131ca2f83a460f4d2e289cbedac0 (diff) | |
download | kogata-caf842864bdc0794e387f9580af96ab1036996f4.tar.gz kogata-caf842864bdc0794e387f9580af96ab1036996f4.zip |
Change semantics of pd_map_page to return true on success, false on error.
Diffstat (limited to 'src/kernel/core/paging.c')
-rw-r--r-- | src/kernel/core/paging.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/kernel/core/paging.c b/src/kernel/core/paging.c index e60ca53..25113ca 100644 --- a/src/kernel/core/paging.c +++ b/src/kernel/core/paging.c @@ -171,7 +171,7 @@ uint32_t pd_get_frame(void* vaddr) { return current_pt[pt].page[page] >> PTE_FRAME_SHIFT; } -int pd_map_page(void* vaddr, uint32_t frame_id, bool rw) { +bool pd_map_page(void* vaddr, uint32_t frame_id, bool rw) { uint32_t pt = PT_OF_ADDR(vaddr); uint32_t page = PAGE_OF_ADDR(vaddr); @@ -186,7 +186,7 @@ int pd_map_page(void* vaddr, uint32_t frame_id, bool rw) { uint32_t new_pt_frame = frame_alloc(1); if (new_pt_frame == 0) { mutex_unlock(&pdd->mutex); - return 1; // OOM + return false; // OOM } current_pd->page[pt] = pd->page[pt] = @@ -201,7 +201,7 @@ int pd_map_page(void* vaddr, uint32_t frame_id, bool rw) { invlpg(vaddr); mutex_unlock(&pdd->mutex); - return 0; + return true; } void pd_unmap_page(void* vaddr) { @@ -239,8 +239,8 @@ pagedir_t *create_pagedir() { temp = region_alloc(PAGE_SIZE, 0, 0); if (temp == 0) goto error; - int error = pd_map_page(temp, pd_phys, true); - if (error) goto error; + bool map_ok = pd_map_page(temp, pd_phys, true); + if (!map_ok) goto error; pd->phys_addr = pd_phys * PAGE_SIZE; pd->mutex = MUTEX_UNLOCKED; |