* Returns the lowest valid pte block or table entry for a given virtual * address. If there are no valid entries return NULL and set the level to * the first invalid level. */
| 550 | * the first invalid level. |
| 551 | */ |
| 552 | static __inline pt_entry_t * |
| 553 | pmap_pte(pmap_t pmap, vm_offset_t va, int *level) |
| 554 | { |
| 555 | pd_entry_t *l1, *l2, desc; |
| 556 | pt_entry_t *l3; |
| 557 | |
| 558 | l1 = pmap_l1(pmap, va); |
| 559 | if (l1 == NULL) { |
| 560 | *level = 0; |
| 561 | return (NULL); |
| 562 | } |
| 563 | desc = pmap_load(l1) & ATTR_DESCR_MASK; |
| 564 | if (desc == L1_BLOCK) { |
| 565 | *level = 1; |
| 566 | return (l1); |
| 567 | } |
| 568 | |
| 569 | if (desc != L1_TABLE) { |
| 570 | *level = 1; |
| 571 | return (NULL); |
| 572 | } |
| 573 | |
| 574 | l2 = pmap_l1_to_l2(l1, va); |
| 575 | desc = pmap_load(l2) & ATTR_DESCR_MASK; |
| 576 | if (desc == L2_BLOCK) { |
| 577 | *level = 2; |
| 578 | return (l2); |
| 579 | } |
| 580 | |
| 581 | if (desc != L2_TABLE) { |
| 582 | *level = 2; |
| 583 | return (NULL); |
| 584 | } |
| 585 | |
| 586 | *level = 3; |
| 587 | l3 = pmap_l2_to_l3(l2, va); |
| 588 | if ((pmap_load(l3) & ATTR_DESCR_MASK) != L3_PAGE) |
| 589 | return (NULL); |
| 590 | |
| 591 | return (l3); |
| 592 | } |
| 593 | |
| 594 | bool |
| 595 | pmap_ps_enabled(pmap_t pmap __unused) |
no test coverage detected