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

Function pmap_asid_alloc

freebsd/mips/mips/pmap.c:3450–3470  ·  view source on GitHub ↗

* Allocate TLB address space tag (called ASID or TLBPID) and return it. * It takes almost as much or more time to search the TLB for a * specific ASID and flush those entries as it does to flush the entire TLB. * Therefore, when we allocate a new ASID, we just take the next number. When * we run out of numbers, we flush the TLB, increment the generation count * and start over. ASID zero is re

(pmap)

Source from the content-addressed store, hash-verified

3448 * and start over. ASID zero is reserved for kernel use.
3449 */
3450static void
3451pmap_asid_alloc(pmap)
3452 pmap_t pmap;
3453{
3454 if (pmap->pm_asid[PCPU_GET(cpuid)].asid != PMAP_ASID_RESERVED &&
3455 pmap->pm_asid[PCPU_GET(cpuid)].gen == PCPU_GET(asid_generation));
3456 else {
3457 if (PCPU_GET(next_asid) == pmap_max_asid) {
3458 tlb_invalidate_all_user(NULL);
3459 PCPU_SET(asid_generation,
3460 (PCPU_GET(asid_generation) + 1) & ASIDGEN_MASK);
3461 if (PCPU_GET(asid_generation) == 0) {
3462 PCPU_SET(asid_generation, 1);
3463 }
3464 PCPU_SET(next_asid, 1); /* 0 means invalid */
3465 }
3466 pmap->pm_asid[PCPU_GET(cpuid)].asid = PCPU_GET(next_asid);
3467 pmap->pm_asid[PCPU_GET(cpuid)].gen = PCPU_GET(asid_generation);
3468 PCPU_SET(next_asid, PCPU_GET(next_asid) + 1);
3469 }
3470}
3471
3472static pt_entry_t
3473init_pte_prot(vm_page_t m, vm_prot_t access, vm_prot_t prot)

Callers 1

pmap_activateFunction · 0.85

Calls 1

tlb_invalidate_all_userFunction · 0.85

Tested by

no test coverage detected