<!-- description --> @brief Adds an exteneion's fail stack for a specific PP to the provided root page table at the provided address. <!-- inputs/outputs --> @param mut_tls the current TLS block @param mut_page_pool the page_pool_t to use @param mut_rpt the root page table to add too @param addr the address of where to put the stack @return Returns bsl::errc_success on success, bsl::errc_failure
| 571 | /// and friends otherwise |
| 572 | /// |
| 573 | [[nodiscard]] static constexpr auto |
| 574 | add_fail_stack( |
| 575 | tls_t &mut_tls, |
| 576 | page_pool_t &mut_page_pool, |
| 577 | root_page_table_t &mut_rpt, |
| 578 | bsl::safe_u64 const &addr) noexcept -> bsl::errc_type |
| 579 | { |
| 580 | constexpr auto size{HYPERVISOR_EXT_FAIL_STACK_SIZE}; |
| 581 | for (bsl::safe_idx mut_i{}; mut_i < size; mut_i += bsl::to_idx(HYPERVISOR_PAGE_SIZE)) { |
| 582 | auto const virt{(addr + bsl::to_u64(mut_i)).checked()}; |
| 583 | |
| 584 | /// NOTE: |
| 585 | /// - The virtual address provided to allocate_page cannot |
| 586 | /// overflow because add_fail_stacks ensures that this is not |
| 587 | /// possible, which is why it is marked as checked. |
| 588 | /// |
| 589 | |
| 590 | auto const *const page{ |
| 591 | mut_rpt.allocate_page<page_4k_t>(mut_tls, mut_page_pool, virt, MAP_PAGE_RW)}; |
| 592 | |
| 593 | if (bsl::unlikely(nullptr == page)) { |
| 594 | bsl::print<bsl::V>() << bsl::here(); |
| 595 | return bsl::errc_failure; |
| 596 | } |
| 597 | |
| 598 | bsl::touch(); |
| 599 | } |
| 600 | |
| 601 | return bsl::errc_success; |
| 602 | } |
| 603 | |
| 604 | /// <!-- description --> |
| 605 | /// @brief Adds the exteneion's fail stacks to the provided |