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

Function pmap_bootstrap

freebsd/arm/arm/pmap-v6.c:1170–1249  ·  view source on GitHub ↗

* Initialize kernel PMAP locks and lists, kernel_pmap itself, and * reserve various virtual spaces for temporary mappings. */

Source from the content-addressed store, hash-verified

1168 * reserve various virtual spaces for temporary mappings.
1169 */
1170void
1171pmap_bootstrap(vm_offset_t firstaddr)
1172{
1173 pt2_entry_t *unused __unused;
1174 struct pcpu *pc;
1175
1176 /*
1177 * Initialize the kernel pmap (which is statically allocated).
1178 */
1179 PMAP_LOCK_INIT(kernel_pmap);
1180 kernel_l1pa = (vm_paddr_t)kern_pt1; /* for libkvm */
1181 kernel_pmap->pm_pt1 = kern_pt1;
1182 kernel_pmap->pm_pt2tab = kern_pt2tab;
1183 CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */
1184 TAILQ_INIT(&kernel_pmap->pm_pvchunk);
1185
1186 /*
1187 * Initialize the global pv list lock.
1188 */
1189 rw_init(&pvh_global_lock, "pmap pv global");
1190
1191 LIST_INIT(&allpmaps);
1192
1193 /*
1194 * Request a spin mutex so that changes to allpmaps cannot be
1195 * preempted by smp_rendezvous_cpus().
1196 */
1197 mtx_init(&allpmaps_lock, "allpmaps", NULL, MTX_SPIN);
1198 mtx_lock_spin(&allpmaps_lock);
1199 LIST_INSERT_HEAD(&allpmaps, kernel_pmap, pm_list);
1200 mtx_unlock_spin(&allpmaps_lock);
1201
1202 /*
1203 * Reserve some special page table entries/VA space for temporary
1204 * mapping of pages.
1205 */
1206#define SYSMAP(c, p, v, n) do { \
1207 v = (c)pmap_preboot_reserve_pages(n); \
1208 p = pt2map_entry((vm_offset_t)v); \
1209 } while (0)
1210
1211 /*
1212 * Local CMAP1/CMAP2 are used for zeroing and copying pages.
1213 * Local CMAP2 is also used for data cache cleaning.
1214 */
1215 pc = get_pcpu();
1216 mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF);
1217 SYSMAP(caddr_t, pc->pc_cmap1_pte2p, pc->pc_cmap1_addr, 1);
1218 SYSMAP(caddr_t, pc->pc_cmap2_pte2p, pc->pc_cmap2_addr, 1);
1219 SYSMAP(vm_offset_t, pc->pc_qmap_pte2p, pc->pc_qmap_addr, 1);
1220
1221 /*
1222 * Crashdump maps.
1223 */
1224 SYSMAP(caddr_t, unused, crashdumpmap, MAXDUMPPGS);
1225
1226 /*
1227 * _tmppt is used for reading arbitrary physical pages via /dev/mem.

Callers 1

initarmFunction · 0.70

Calls 3

rw_initFunction · 0.85
mtx_initFunction · 0.85
get_pcpuFunction · 0.85

Tested by

no test coverage detected