* 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)
| 3448 | * and start over. ASID zero is reserved for kernel use. |
| 3449 | */ |
| 3450 | static void |
| 3451 | pmap_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 | |
| 3472 | static pt_entry_t |
| 3473 | init_pte_prot(vm_page_t m, vm_prot_t access, vm_prot_t prot) |
no test coverage detected