MCPcopy Create free account
hub / github.com/Bareflank/hypervisor / map_mk_stack

Function map_mk_stack

loader/src/map_mk_stack.c:47–71  ·  view source on GitHub ↗

* <!-- description --> * @brief This function maps the microkernel's stack into the microkernel's * root page tables. * * <!-- inputs/outputs --> * @param stack a pointer to a span_t that stores the stack * being mapped * @param virt provide the virtual address that the stack * should be mapped to. * @param pmut_rpt the root page table to map the stack into * @retur

Source from the content-addressed store, hash-verified

45 * @return LOADER_SUCCESS on success, LOADER_FAILURE on failure.
46 */
47NODISCARD int64_t
48map_mk_stack(
49 struct span_t const *const stack,
50 uint64_t const virt,
51 root_page_table_t *const pmut_rpt) NOEXCEPT
52{
53 uint64_t mut_i;
54
55 for (mut_i = ((uint64_t)0); mut_i < stack->size; mut_i += HYPERVISOR_PAGE_SIZE) {
56 uint64_t const phys = platform_virt_to_phys(stack->addr + mut_i);
57 if (((uint64_t)0) == phys) {
58 bferror("platform_virt_to_phys failed");
59 return LOADER_FAILURE;
60 }
61
62 if (map_4k_page_rw((void *)(virt + mut_i), phys, pmut_rpt)) {
63 bferror("map_4k_page_rw failed");
64 return LOADER_FAILURE;
65 }
66
67 bf_touch();
68 }
69
70 return LOADER_SUCCESS;
71}

Callers 1

start_vmm_per_cpuFunction · 0.85

Calls 4

map_4k_page_rwFunction · 0.85
bf_touchFunction · 0.85
platform_virt_to_physFunction · 0.50
bferrorFunction · 0.50

Tested by

no test coverage detected