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

Function pmap_cache_bits

freebsd/amd64/amd64/pmap.c:2530–2566  ·  view source on GitHub ↗

* Determine the appropriate bits to set in a PTE or PDE for a specified * caching mode. */

Source from the content-addressed store, hash-verified

2528 * caching mode.
2529 */
2530int
2531pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde)
2532{
2533 int cache_bits, pat_flag, pat_idx;
2534
2535 if (!pmap_is_valid_memattr(pmap, mode))
2536 panic("Unknown caching mode %d\n", mode);
2537
2538 switch (pmap->pm_type) {
2539 case PT_X86:
2540 case PT_RVI:
2541 /* The PAT bit is different for PTE's and PDE's. */
2542 pat_flag = is_pde ? X86_PG_PDE_PAT : X86_PG_PTE_PAT;
2543
2544 /* Map the caching mode to a PAT index. */
2545 pat_idx = pat_index[mode];
2546
2547 /* Map the 3-bit index value into the PAT, PCD, and PWT bits. */
2548 cache_bits = 0;
2549 if (pat_idx & 0x4)
2550 cache_bits |= pat_flag;
2551 if (pat_idx & 0x2)
2552 cache_bits |= PG_NC_PCD;
2553 if (pat_idx & 0x1)
2554 cache_bits |= PG_NC_PWT;
2555 break;
2556
2557 case PT_EPT:
2558 cache_bits = EPT_PG_IGNORE_PAT | EPT_PG_MEMORY_TYPE(mode);
2559 break;
2560
2561 default:
2562 panic("unsupported pmap type %d", pmap->pm_type);
2563 }
2564
2565 return (cache_bits);
2566}
2567
2568static int
2569pmap_cache_mask(pmap_t pmap, boolean_t is_pde)

Callers 15

efi_create_1t1_mapFunction · 0.70
pmap_kenter_attrFunction · 0.70
pmap_qenterFunction · 0.70
pmap_pinit_pml5Function · 0.70
pmap_pinit_pml5_ptiFunction · 0.70
pmap_enterFunction · 0.70
pmap_enter_2mpageFunction · 0.70
pmap_enter_quick_lockedFunction · 0.70
pmap_object_init_ptFunction · 0.70
pmap_change_props_lockedFunction · 0.70
pmap_map_io_transientFunction · 0.70

Calls 2

pmap_is_valid_memattrFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected