Created
March 25, 2011 05:56
-
-
Save klange/886417 to your computer and use it in GitHub Desktop.
toaru's internal sbrk()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void * | |
sbrk( | |
uintptr_t increment | |
) { | |
ASSERT(increment % 0x1000 == 0); | |
ASSERT(heap_end % 0x1000 == 0); | |
uintptr_t address = heap_end; | |
heap_end += increment; | |
uintptr_t i; | |
for (i = address; i < heap_end; i += 0x1000) { | |
get_page(i, 1, kernel_directory); | |
alloc_frame(get_page(i, 1, kernel_directory), 0, 1); | |
} | |
return (void *)address; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment