X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/59ecf21e36b2332f6adf2a568ef555283d8c119a..11b423249f224e3c9b7d940862c3cae310f81a23:/lunaix-os/kernel/mm/cake.c?ds=inline diff --git a/lunaix-os/kernel/mm/cake.c b/lunaix-os/kernel/mm/cake.c index e4ceef4..9707d52 100644 --- a/lunaix-os/kernel/mm/cake.c +++ b/lunaix-os/kernel/mm/cake.c @@ -28,11 +28,11 @@ struct llist_header piles = { .next = &piles, .prev = &piles }; void* __alloc_cake(unsigned int cake_pg) { - ptr_t pa = (ptr_t)pmm_alloc_cpage(KERNEL_PID, cake_pg, 0); + ptr_t pa = (ptr_t)pmm_alloc_cpage(cake_pg, 0); if (!pa) { return NULL; } - return vmap(pa, cake_pg * PG_SIZE, PG_PREM_RW, 0); + return (void*)vmap(pa, cake_pg * PAGE_SIZE, KERNEL_DATA); } struct cake_s* @@ -86,7 +86,7 @@ __init_pile(struct cake_pile* pile, *pile = (struct cake_pile){ .piece_size = piece_size, .cakes_count = 0, .pieces_per_cake = - (pg_per_cake * PG_SIZE) / + (pg_per_cake * PAGE_SIZE) / (piece_size + sizeof(piece_index_t)), .pg_per_cake = pg_per_cake }; @@ -206,6 +206,8 @@ found: llist_append(&pile->partial, &pos->cakes); } + *((unsigned int*)area) = DEADCAKE_MARK; + return 1; }