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

Function ext_main_entry

kernel/integration/fast_fail_exit_from_vmexit.cpp:215–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 /// microkernel speak the same ABI.
214 ///
215 extern "C" void
216 ext_main_entry(bsl::uint32 const version) noexcept
217 {
218 bsl::errc_type mut_ret{};
219
220 /// NOTE:
221 /// - Initialize the bf_syscall_t. This will validate the ABI version,
222 /// open a handle to the microkernel and register the required
223 /// callbacks. If this fails, we call bf_control_op_exit, which is
224 /// similar to exit() from POSIX, except that the return value is
225 /// always the same.
226 ///
227
228 mut_ret = g_mut_sys.initialize( // --
229 bsl::to_u32(version), // --
230 &bootstrap_entry, // --
231 &vmexit_entry, // --
232 &fail_entry); // --
233
234 if (bsl::unlikely(!mut_ret)) {
235 bsl::print<bsl::V>() << bsl::here();
236 return bf_control_op_exit();
237 }
238
239 mut_ret = gs_initialize(g_mut_gs, g_mut_sys, g_mut_intrinsic);
240 if (bsl::unlikely(!mut_ret)) {
241 bsl::print<bsl::V>() << bsl::here();
242 return bf_control_op_exit();
243 }
244
245 /// NOTE:
246 /// - Initialize the vp_pool_t. This will give all of our vp_t's
247 /// their IDs so that they can be allocated.
248 ///
249
250 g_mut_vp_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
251
252 /// NOTE:
253 /// - Initialize the vs_pool_t. This will give all of our vs_t's
254 /// their IDs so that they can be allocated.
255 ///
256
257 g_mut_vs_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
258
259 /// NOTE:
260 /// - Wait for callbacks. Note that this function does not return.
261 /// The next time the extension is executed, it will be the
262 /// bootstrap callback that was just previously registered, which
263 /// will be called on each PP that is online. Failure to call this
264 /// function leads to undefined behaviour (likely a page fault).
265 /// - This is similar to the wait() function from POSIX after having
266 /// just started some processes, with the difference being that
267 /// this will never return, so there is no need to pass in status
268 /// as there is nothing to process after this call.
269 ///
270
271 return bf_control_op_wait();
272 }

Callers

nothing calls this directly

Calls 4

bf_control_op_exitFunction · 0.50
gs_initializeFunction · 0.50
bf_control_op_waitFunction · 0.50
initializeMethod · 0.45

Tested by

no test coverage detected