Minor comments.

This commit is contained in:
Philippe Pittoli 2025-02-14 08:05:35 +01:00
parent 4fdf4028a4
commit ddb1b65d61
2 changed files with 3 additions and 3 deletions

View file

@ -38,7 +38,7 @@ proc_mapstacks(pagetable_t kpgtbl)
char *pa = kalloc();
if(pa == 0)
panic("kalloc");
uint64 va = KSTACK((int) (p - proc));
uint64 va = KSTACK((int) (p - proc)); // p-proc = to get an index (0 to 7)
kvmmap(kpgtbl, va, (uint64)pa, PGSIZE, PTE_R | PTE_W);
}
}

View file

@ -158,9 +158,9 @@ mappages(pagetable_t pagetable, uint64 va, uint64 size, uint64 pa, int perm)
a = va;
last = va + size - PGSIZE;
for(;;){
if((pte = walk(pagetable, a, 1)) == 0)
if((pte = walk(pagetable, a, 1)) == 0) // In case the PTE hasn't been allocated.
return -1;
if(*pte & PTE_V)
if(*pte & PTE_V) // In case the PTE already was allocated to someone else (it is valid).
panic("mappages: remap");
*pte = PA2PTE(pa) | perm | PTE_V;
if(a == last)