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

Function alloc_mk_stack

loader/src/alloc_mk_stack.c:44–60  ·  view source on GitHub ↗

* <!-- description --> * @brief Allocates a chunk of memory for the stack used by the * microkernel. Note that the "size" parameter is in total pages and * not in bytes. If the provided size is 0, this function will allocate * a default number of pages. * * <!-- inputs/outputs --> * @param pmut_stack the span_t to store the stack addr/size. * @return LOADER_SUCCESS on suc

Source from the content-addressed store, hash-verified

42 * @return LOADER_SUCCESS on success, LOADER_FAILURE on failure.
43 */
44NODISCARD int64_t
45alloc_mk_stack(struct span_t *const pmut_stack) NOEXCEPT
46{
47 pmut_stack->size = HYPERVISOR_MK_STACK_SIZE;
48 pmut_stack->addr = (uint8_t *)platform_alloc(pmut_stack->size);
49 if (NULLPTR == pmut_stack->addr) {
50 bferror("platform_alloc failed");
51 goto platform_alloc_failed;
52 }
53
54 return LOADER_SUCCESS;
55
56platform_alloc_failed:
57
58 platform_memset(pmut_stack, ((uint8_t)0), sizeof(struct span_t));
59 return LOADER_FAILURE;
60}

Callers 1

start_vmm_per_cpuFunction · 0.85

Calls 3

platform_allocFunction · 0.50
bferrorFunction · 0.50
platform_memsetFunction · 0.50

Tested by

no test coverage detected