kernel/arm/pmap.c
/*
 * Unmaps a segment from the address space pointed to by pmap.
 */
Unmaps a segment from the address space pointed to by pmap.
Unmaps a segment from the address space pointed to by pmap .
int PmapCacheRemove(vm_addr va) {
  uint32_t *pt, *phys_pt;
  int pde_idx, pte_idx;
  vm_addr current_paddr;
  struct Pageframe *pf;
  struct PmapVPTE *vpte;
  struct PmapVPTE *vpte_base;
  pde_idx = (va & L1_ADDR_BITS) >> L1_IDX_SHIFT;
  phys_pt = (uint32_t *)(root_pagedir[pde_idx] & L1_C_ADDR_MASK);
  pt = (uint32_t *)PmapPaToVa((vm_addr)phys_pt);
  pte_idx = (va & L2_ADDR_BITS) >> L2_IDX_SHIFT;
  current_paddr = pt[pte_idx] & L2_ADDR_MASK;
  vpte_base = (struct PmapVPTE *)((uint8_t *)pt + VPTE_TABLE_OFFS);
  vpte = vpte_base + pte_idx;
  pf = PmapPaToPf(current_paddr);
  LIST_REM_ENTRY(&pf->pmap_pageframe.vpte_list, vpte, link);
  vpte->flags = 0;
  pt[pte_idx] = L2_TYPE_INV;
  return 0;
}
int PmapCacheRemove ( vm_addr va ) { uint32_t * pt , * phys_pt ; int pde_idx , pte_idx ; vm_addr current_paddr ; struct Pageframe * pf ; struct PmapVPTE * vpte ; struct PmapVPTE * vpte_base ; pde_idx = ( va & L1_ADDR_BITS ) >> L1_IDX_SHIFT ; phys_pt = ( uint32_t * ) ( root_pagedir [ pde_idx ] & L1_C_ADDR_MASK ) ; pt = ( uint32_t * ) PmapPaToVa ( ( vm_addr ) phys_pt ) ; pte_idx = ( va & L2_ADDR_BITS ) >> L2_IDX_SHIFT ; current_paddr = pt [ pte_idx ] & L2_ADDR_MASK ; vpte_base = ( struct PmapVPTE * ) ( ( uint8_t * ) pt + VPTE_TABLE_OFFS ) ; vpte = vpte_base + pte_idx ; pf = PmapPaToPf ( current_paddr ) ; LIST_REM_ENTRY ( & pf -> pmap_pageframe . vpte_list , vpte , link ) ; vpte -> flags = 0 ; pt [ pte_idx ] = L2_TYPE_INV ; return 0 ; }
Unmaps a segment from the address space pointed to by pmap.
Unmaps a segment from the address space pointed to by pmap .
// TODO: Increment/Decrement pf reference cnt or not?