- // if next do require new pages to be allocated
- if (!vmm_alloc_pages(__current->pid, (void*)(PG_ALIGN(current_brk) + PG_SIZE),
- diff,
- PG_PREM_RW, 0)) {
- __current->k_status = LXHEAPFULL;
- return NULL;
+ // if next do require new pages to be mapped
+ for (size_t i = 0; i < diff; i += PG_SIZE) {
+ vmm_set_mapping(PD_REFERENCED,
+ PG_ALIGN(current_brk) + PG_SIZE + i,
+ 0,
+ PG_WRITE | user,
+ VMAP_NULL);