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

Function pmap_bootstrap

freebsd/mips/mips/pmap.c:490–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490void
491pmap_bootstrap(void)
492{
493 int i;
494
495 /* Sort. */
496again:
497 for (i = 0; phys_avail[i + 1] != 0; i += 2) {
498 /*
499 * Keep the memory aligned on page boundary.
500 */
501 phys_avail[i] = round_page(phys_avail[i]);
502 phys_avail[i + 1] = trunc_page(phys_avail[i + 1]);
503
504 if (i < 2)
505 continue;
506 if (phys_avail[i - 2] > phys_avail[i]) {
507 vm_paddr_t ptemp[2];
508
509 ptemp[0] = phys_avail[i + 0];
510 ptemp[1] = phys_avail[i + 1];
511
512 phys_avail[i + 0] = phys_avail[i - 2];
513 phys_avail[i + 1] = phys_avail[i - 1];
514
515 phys_avail[i - 2] = ptemp[0];
516 phys_avail[i - 1] = ptemp[1];
517 goto again;
518 }
519 }
520
521 /*
522 * In 32 bit, we may have memory which cannot be mapped directly.
523 * This memory will need temporary mapping before it can be
524 * accessed.
525 */
526 if (!MIPS_DIRECT_MAPPABLE(phys_avail[i - 1] - 1))
527 need_local_mappings = 1;
528
529 /*
530 * Copy the phys_avail[] array before we start stealing memory from it.
531 */
532 for (i = 0; phys_avail[i + 1] != 0; i += 2) {
533 physmem_desc[i] = phys_avail[i];
534 physmem_desc[i + 1] = phys_avail[i + 1];
535 }
536
537 Maxmem = atop(phys_avail[i - 1]);
538
539 if (bootverbose) {
540 printf("Physical memory chunk(s):\n");
541 for (i = 0; phys_avail[i + 1] != 0; i += 2) {
542 vm_paddr_t size;
543
544 size = phys_avail[i + 1] - phys_avail[i];
545 printf("%#08jx - %#08jx, %ju bytes (%ju pages)\n",
546 (uintmax_t) phys_avail[i],
547 (uintmax_t) phys_avail[i + 1] - 1,

Callers 9

mips_initFunction · 0.50
platform_startFunction · 0.50
platform_startFunction · 0.50
platform_startFunction · 0.50
mips_initFunction · 0.50
mips_initFunction · 0.50
mips_initFunction · 0.50
mips_initFunction · 0.50
mips_initFunction · 0.50

Calls 7

pmap_steal_memoryFunction · 0.85
msgbufinitFunction · 0.85
mips_pcpu_tlb_initFunction · 0.85
pmap_alloc_lmem_mapFunction · 0.85
rw_initFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected