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

Function pmap_pat_index

freebsd/amd64/amd64/pmap.c:2588–2621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2586}
2587
2588static int
2589pmap_pat_index(pmap_t pmap, pt_entry_t pte, bool is_pde)
2590{
2591 int pat_flag, pat_idx;
2592
2593 pat_idx = 0;
2594 switch (pmap->pm_type) {
2595 case PT_X86:
2596 case PT_RVI:
2597 /* The PAT bit is different for PTE's and PDE's. */
2598 pat_flag = is_pde ? X86_PG_PDE_PAT : X86_PG_PTE_PAT;
2599
2600 if ((pte & pat_flag) != 0)
2601 pat_idx |= 0x4;
2602 if ((pte & PG_NC_PCD) != 0)
2603 pat_idx |= 0x2;
2604 if ((pte & PG_NC_PWT) != 0)
2605 pat_idx |= 0x1;
2606 break;
2607 case PT_EPT:
2608 if ((pte & EPT_PG_IGNORE_PAT) != 0)
2609 panic("EPT PTE %#lx has no PAT memory type", pte);
2610 pat_idx = (pte & EPT_PG_MEMORY_TYPE(0x7)) >> 3;
2611 break;
2612 }
2613
2614 /* See pmap_init_pat(). */
2615 if (pat_idx == 4)
2616 pat_idx = 0;
2617 if (pat_idx == 7)
2618 pat_idx = 3;
2619
2620 return (pat_idx);
2621}
2622
2623bool
2624pmap_ps_enabled(pmap_t pmap)

Callers 2

sysctl_kmaps_dumpFunction · 0.70
sysctl_kmaps_matchFunction · 0.70

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected