MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pmap_init

Function pmap_init

freebsd/arm64/arm64/pmap.c:1078–1173  ·  view source on GitHub ↗

* Initialize the pmap module. * Called by vm_init, to initialize any structures that the pmap * system needs to map virtual memory. */

Source from the content-addressed store, hash-verified

1076 * system needs to map virtual memory.
1077 */
1078void
1079pmap_init(void)
1080{
1081 struct vm_phys_seg *seg, *next_seg;
1082 struct md_page *pvh;
1083 vm_size_t s;
1084 uint64_t mmfr1;
1085 int i, pv_npg, vmid_bits;
1086
1087 /*
1088 * Are large page mappings enabled?
1089 */
1090 TUNABLE_INT_FETCH("vm.pmap.superpages_enabled", &superpages_enabled);
1091 if (superpages_enabled) {
1092 KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0,
1093 ("pmap_init: can't assign to pagesizes[1]"));
1094 pagesizes[1] = L2_SIZE;
1095 KASSERT(MAXPAGESIZES > 2 && pagesizes[2] == 0,
1096 ("pmap_init: can't assign to pagesizes[2]"));
1097 pagesizes[2] = L1_SIZE;
1098 }
1099
1100 /*
1101 * Initialize the ASID allocator.
1102 */
1103 pmap_init_asids(&asids,
1104 (READ_SPECIALREG(tcr_el1) & TCR_ASID_16) != 0 ? 16 : 8);
1105
1106 if (has_hyp()) {
1107 mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
1108 vmid_bits = 8;
1109
1110 if (ID_AA64MMFR1_VMIDBits_VAL(mmfr1) ==
1111 ID_AA64MMFR1_VMIDBits_16)
1112 vmid_bits = 16;
1113 pmap_init_asids(&vmids, vmid_bits);
1114 }
1115
1116 /*
1117 * Initialize the pv chunk list mutex.
1118 */
1119 mtx_init(&pv_chunks_mutex, "pmap pv chunk list", NULL, MTX_DEF);
1120
1121 /*
1122 * Initialize the pool of pv list locks.
1123 */
1124 for (i = 0; i < NPV_LIST_LOCKS; i++)
1125 rw_init(&pv_list_locks[i], "pmap pv list");
1126
1127 /*
1128 * Calculate the size of the pv head table for superpages.
1129 */
1130 pv_npg = 0;
1131 for (i = 0; i < vm_phys_nsegs; i++) {
1132 seg = &vm_phys_segs[i];
1133 pv_npg += pmap_l2_pindex(roundup2(seg->end, L2_SIZE)) -
1134 pmap_l2_pindex(seg->start);
1135 }

Callers

nothing calls this directly

Calls 5

pmap_init_asidsFunction · 0.85
has_hypFunction · 0.85
mtx_initFunction · 0.85
rw_initFunction · 0.85
kmem_mallocFunction · 0.50

Tested by

no test coverage detected