Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/arm64/pmap.c
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | |||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/ktr.h> | #include <sys/ktr.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mman.h> | #include <sys/mman.h> | ||||
#include <sys/msgbuf.h> | #include <sys/msgbuf.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/physmem.h> | |||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/rwlock.h> | #include <sys/rwlock.h> | ||||
#include <sys/sbuf.h> | #include <sys/sbuf.h> | ||||
#include <sys/sx.h> | #include <sys/sx.h> | ||||
#include <sys/vmem.h> | #include <sys/vmem.h> | ||||
#include <sys/vmmeter.h> | #include <sys/vmmeter.h> | ||||
#include <sys/sched.h> | #include <sys/sched.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
Show All 13 Lines | |||||
#include <vm/vm_radix.h> | #include <vm/vm_radix.h> | ||||
#include <vm/vm_reserv.h> | #include <vm/vm_reserv.h> | ||||
#include <vm/uma.h> | #include <vm/uma.h> | ||||
#include <machine/machdep.h> | #include <machine/machdep.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
#include <arm/include/physmem.h> | |||||
#define PMAP_ASSERT_STAGE1(pmap) MPASS((pmap)->pm_stage == PM_STAGE1) | #define PMAP_ASSERT_STAGE1(pmap) MPASS((pmap)->pm_stage == PM_STAGE1) | ||||
#define NL0PG (PAGE_SIZE/(sizeof (pd_entry_t))) | #define NL0PG (PAGE_SIZE/(sizeof (pd_entry_t))) | ||||
#define NL1PG (PAGE_SIZE/(sizeof (pd_entry_t))) | #define NL1PG (PAGE_SIZE/(sizeof (pd_entry_t))) | ||||
#define NL2PG (PAGE_SIZE/(sizeof (pd_entry_t))) | #define NL2PG (PAGE_SIZE/(sizeof (pd_entry_t))) | ||||
#define NL3PG (PAGE_SIZE/(sizeof (pt_entry_t))) | #define NL3PG (PAGE_SIZE/(sizeof (pt_entry_t))) | ||||
#define NUL0E L0_ENTRIES | #define NUL0E L0_ENTRIES | ||||
▲ Show 20 Lines • Show All 695 Lines • ▼ Show 20 Lines | pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, | ||||
kernel_pmap->pm_l0_paddr = l0pt - kern_delta; | kernel_pmap->pm_l0_paddr = l0pt - kern_delta; | ||||
kernel_pmap->pm_cookie = COOKIE_FROM(-1, INT_MIN); | kernel_pmap->pm_cookie = COOKIE_FROM(-1, INT_MIN); | ||||
kernel_pmap->pm_stage = PM_STAGE1; | kernel_pmap->pm_stage = PM_STAGE1; | ||||
kernel_pmap->pm_asid_set = &asids; | kernel_pmap->pm_asid_set = &asids; | ||||
/* Assume the address we were loaded to is a valid physical address */ | /* Assume the address we were loaded to is a valid physical address */ | ||||
min_pa = KERNBASE - kern_delta; | min_pa = KERNBASE - kern_delta; | ||||
physmap_idx = arm_physmem_avail(physmap, nitems(physmap)); | physmap_idx = physmem_avail(physmap, nitems(physmap)); | ||||
physmap_idx /= 2; | physmap_idx /= 2; | ||||
/* | /* | ||||
* Find the minimum physical address. physmap is sorted, | * Find the minimum physical address. physmap is sorted, | ||||
* but may contain empty ranges. | * but may contain empty ranges. | ||||
*/ | */ | ||||
for (i = 0; i < (physmap_idx * 2); i += 2) { | for (i = 0; i < (physmap_idx * 2); i += 2) { | ||||
if (physmap[i] == physmap[i + 1]) | if (physmap[i] == physmap[i + 1]) | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | #define alloc_pages(var, np) \ | ||||
virtual_avail = preinit_map_va + PMAP_PREINIT_MAPPING_SIZE; | virtual_avail = preinit_map_va + PMAP_PREINIT_MAPPING_SIZE; | ||||
virtual_avail = roundup2(virtual_avail, L1_SIZE); | virtual_avail = roundup2(virtual_avail, L1_SIZE); | ||||
virtual_end = VM_MAX_KERNEL_ADDRESS - (PMAP_MAPDEV_EARLY_SIZE); | virtual_end = VM_MAX_KERNEL_ADDRESS - (PMAP_MAPDEV_EARLY_SIZE); | ||||
kernel_vm_end = virtual_avail; | kernel_vm_end = virtual_avail; | ||||
pa = pmap_early_vtophys(l1pt, freemempos); | pa = pmap_early_vtophys(l1pt, freemempos); | ||||
arm_physmem_exclude_region(start_pa, pa - start_pa, EXFLAG_NOALLOC); | physmem_exclude_region(start_pa, pa - start_pa, EXFLAG_NOALLOC); | ||||
cpu_tlb_flushID(); | cpu_tlb_flushID(); | ||||
} | } | ||||
/* | /* | ||||
* Initialize a vm_page's machine-dependent fields. | * Initialize a vm_page's machine-dependent fields. | ||||
*/ | */ | ||||
void | void | ||||
▲ Show 20 Lines • Show All 5,535 Lines • Show Last 20 Lines |