Compare commits
No commits in common. "9944f79b2e3fa0cd2d8d3c410223a932df1f066a" and "da804296c6f45c8bf7c6d29570552df43da3c853" have entirely different histories.
9944f79b2e
...
da804296c6
22
src/kernel.c
22
src/kernel.c
@ -69,25 +69,11 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
|
||||
// PRINT_PTR(alloc_frame());
|
||||
if (false) {
|
||||
void *start = alloc_pages(1);
|
||||
int *ptr;
|
||||
uint32_t i;
|
||||
for (i = 1; (ptr = alloc_pages(PAGE_SIZE)); i++) {
|
||||
*ptr = i;
|
||||
if (i == 4096)
|
||||
break;
|
||||
void *ptr;
|
||||
while ((ptr = alloc_pages(PAGE_SIZE * 1))) {
|
||||
if (ptr)
|
||||
memset(ptr, ~0, PAGE_SIZE * 1);
|
||||
}
|
||||
uint16_t bozo = 0;
|
||||
for (uint32_t j = 1; j < i - 1; j++) {
|
||||
ptr = start + j * PAGE_SIZE;
|
||||
if (*ptr != j) {
|
||||
bozo++;
|
||||
if (bozo == 12)
|
||||
break;
|
||||
}
|
||||
kprintf("j=%d %p: %d\n", j, ptr, *ptr);
|
||||
}
|
||||
|
||||
} else {
|
||||
while (vmalloc(10))
|
||||
;
|
||||
|
@ -90,8 +90,7 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
|
||||
*/
|
||||
if (KERNEL_START <= start_addr && KERNEL_END > start_addr &&
|
||||
KERNEL_END <= end_addr) {
|
||||
len = ROUND_CEIL(len - (KERNEL_END - start_addr), PAGE_SIZE) -
|
||||
PAGE_SIZE; // cringe but ROUND_FLOOR is un poquito crampte
|
||||
len = len - (KERNEL_END - start_addr);
|
||||
start_addr = ROUND_CEIL(KERNEL_END, PAGE_SIZE);
|
||||
}
|
||||
end_addr = ROUND_CEIL(start_addr + len, PAGE_SIZE);
|
||||
|
@ -17,7 +17,7 @@ static int16_t find_next_block(size_t nb_pages, uint16_t *pd_index_ptr,
|
||||
}
|
||||
*page_table_ptr =
|
||||
(uint32_t *)GET_PAGE_ADDR(0, *pd_index_ptr + PT_START);
|
||||
for (uint16_t i = 0; i + nb_pages - 1 < PT_SIZE; i++) {
|
||||
for (uint16_t i = 0; i + nb_pages < PT_SIZE; i++) {
|
||||
uint16_t j;
|
||||
for (j = 0; (*page_table_ptr)[i + j] >> 12 == i + j &&
|
||||
j < nb_pages;
|
||||
|
Loading…
Reference in New Issue
Block a user