FreeBSD/sys/arm/arm/pmap-v6.c
/*
 *  Pre-bootstrap epoch page mapping(s) with attributes.
 */
Pre-bootstrap epoch page mapping(s) with attributes.
Pre - bootstrap epoch page mapping ( s ) with attributes .
void
pmap_preboot_map_attr(vm_paddr_t pa, vm_offset_t va, vm_size_t size,
    vm_prot_t prot, vm_memattr_t attr)
{
	u_int num;
	u_int l1_attr, l1_prot, l2_prot, l2_attr;
	pt1_entry_t *pte1p;
	pt2_entry_t *pte2p;
	l2_prot = prot & VM_PROT_WRITE ? PTE2_AP_KRW : PTE2_AP_KR;
	l2_prot |= (prot & VM_PROT_EXECUTE) ? PTE2_X : PTE2_NX;
	l2_attr = vm_memattr_to_pte2(attr);
	l1_prot = ATTR_TO_L1(l2_prot);
	l1_attr = ATTR_TO_L1(l2_attr);
	num = round_page(size);
	while (num > 0) {
		if ((((va | pa) & PTE1_OFFSET) == 0) && (num >= PTE1_SIZE)) {
			pte1p = kern_pte1(va);
			pte1_store(pte1p, PTE1_KERN(pa, l1_prot, l1_attr));
			va += PTE1_SIZE;
			pa += PTE1_SIZE;
			num -= PTE1_SIZE;
		} else {
			pte2p = pmap_preboot_vtopte2(va);
			pte2_store(pte2p, PTE2_KERN(pa, l2_prot, l2_attr));
			va += PAGE_SIZE;
			pa += PAGE_SIZE;
			num -= PAGE_SIZE;
		}
	}
}
void pmap_preboot_map_attr ( vm_paddr_t pa , vm_offset_t va , vm_size_t size , vm_prot_t prot , vm_memattr_t attr ) { u_int num ; u_int l1_attr , l1_prot , l2_prot , l2_attr ; pt1_entry_t * pte1p ; pt2_entry_t * pte2p ; l2_prot = prot & VM_PROT_WRITE ? PTE2_AP_KRW : PTE2_AP_KR ; l2_prot |= ( prot & VM_PROT_EXECUTE ) ? PTE2_X : PTE2_NX ; l2_attr = vm_memattr_to_pte2 ( attr ) ; l1_prot = ATTR_TO_L1 ( l2_prot ) ; l1_attr = ATTR_TO_L1 ( l2_attr ) ; num = round_page ( size ) ; while ( num > 0 ) { if ( ( ( ( va | pa ) & PTE1_OFFSET ) == 0 ) && ( num >= PTE1_SIZE ) ) { pte1p = kern_pte1 ( va ) ; pte1_store ( pte1p , PTE1_KERN ( pa , l1_prot , l1_attr ) ) ; va += PTE1_SIZE ; pa += PTE1_SIZE ; num -= PTE1_SIZE ; } else { pte2p = pmap_preboot_vtopte2 ( va ) ; pte2_store ( pte2p , PTE2_KERN ( pa , l2_prot , l2_attr ) ) ; va += PAGE_SIZE ; pa += PAGE_SIZE ; num -= PAGE_SIZE ; } } }
Pre-bootstrap epoch page mapping(s) with attributes.
Pre - bootstrap epoch page mapping ( s ) with attributes .
/* Map all the pages. */