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

Function bootstrap_entry

kernel/integration/bf_vm_op_map_direct.cpp:108–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 /// @param ppid0 the physical process to bootstrap
107 ///
108 extern "C" void
109 bootstrap_entry(bsl::safe_u16::value_type const ppid0) noexcept
110 {
111 bsl::discard(ppid0);
112 bf_status_t mut_ret{};
113
114 // create with invalid handle
115 {
116 constexpr auto hndl{BF_INVALID_HANDLE};
117 constexpr auto phys{HYPERVISOR_PAGE_SIZE};
118 void *pmut_mut_p{};
119
120 mut_ret = bf_vm_op_map_direct_impl(hndl.get(), {}, phys.get(), &pmut_mut_p);
121 integration::require(mut_ret != BF_STATUS_SUCCESS);
122 }
123
124 // create with invalid vmid
125 {
126 constexpr auto phys{HYPERVISOR_PAGE_SIZE};
127 void *pmut_mut_p{};
128
129 // BF_INVALID_ID
130 mut_ret = bf_vm_op_map_direct_impl({}, BF_INVALID_ID.get(), phys.get(), &pmut_mut_p);
131 integration::require(mut_ret != BF_STATUS_SUCCESS);
132
133 // out of range
134 auto const oor{bsl::to_u16(HYPERVISOR_MAX_VMS + bsl::safe_u64::magic_1()).checked()};
135 mut_ret = bf_vm_op_map_direct_impl({}, oor.get(), phys.get(), &pmut_mut_p);
136 integration::require(mut_ret != BF_STATUS_SUCCESS);
137
138 // not yet created
139 auto const nyc{bsl::to_u16(HYPERVISOR_MAX_VMS - bsl::safe_u64::magic_1()).checked()};
140 mut_ret = bf_vm_op_map_direct_impl({}, nyc.get(), phys.get(), &pmut_mut_p);
141 integration::require(mut_ret != BF_STATUS_SUCCESS);
142 }
143
144 // create with invalid phys
145 {
146 void *pmut_mut_p{};
147
148 // nullptr
149 mut_ret = bf_vm_op_map_direct_impl({}, {}, {}, &pmut_mut_p);
150 integration::require(mut_ret != BF_STATUS_SUCCESS);
151
152 // out of range
153 auto const oor{0xFFFFFFFFFFFFF000_u64};
154 mut_ret = bf_vm_op_map_direct_impl({}, {}, oor.get(), &pmut_mut_p);
155 integration::require(mut_ret != BF_STATUS_SUCCESS);
156
157 // unaligned address
158 auto const uaa{0x42_u64};
159 mut_ret = bf_vm_op_map_direct_impl({}, {}, uaa.get(), &pmut_mut_p);
160 integration::require(mut_ret != BF_STATUS_SUCCESS);
161
162 /// TODO:
163 /// - Need to add a check for a phys mapped to HYPERVISOR_MK_STACK_ADDR
164 /// - Need to add a check for a phys mapped to HYPERVISOR_MK_CODE_ADDR
165 /// - Need to add a check for a phys mapped to HYPERVISOR_MK_PAGE_POOL_ADDR

Callers

nothing calls this directly

Calls 3

bf_vm_op_map_direct_implFunction · 0.85
requireFunction · 0.85
bf_control_op_exitFunction · 0.50

Tested by

no test coverage detected