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

Function ext_main_entry

kernel/integration/bf_vs_op_destroy_vs.cpp:271–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269 /// microkernel speak the same ABI.
270 ///
271 extern "C" void
272 ext_main_entry(bsl::uint32 const version) noexcept
273 {
274 bsl::errc_type mut_ret{};
275
276 /// NOTE:
277 /// - Initialize the bf_syscall_t. This will validate the ABI version,
278 /// open a handle to the microkernel and register the required
279 /// callbacks. If this fails, we call bf_control_op_exit, which is
280 /// similar to exit() from POSIX, except that the return value is
281 /// always the same.
282 ///
283
284 mut_ret = g_mut_sys.initialize( // --
285 bsl::to_u32(version), // --
286 &bootstrap_entry, // --
287 &vmexit_entry, // --
288 &fail_entry); // --
289
290 if (bsl::unlikely(!mut_ret)) {
291 bsl::print<bsl::V>() << bsl::here();
292 return bf_control_op_exit();
293 }
294
295 mut_ret = gs_initialize(g_mut_gs, g_mut_sys, g_mut_intrinsic);
296 if (bsl::unlikely(!mut_ret)) {
297 bsl::print<bsl::V>() << bsl::here();
298 return bf_control_op_exit();
299 }
300
301 /// NOTE:
302 /// - Initialize the vp_pool_t. This will give all of our vp_t's
303 /// their IDs so that they can be allocated.
304 ///
305
306 g_mut_vp_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
307
308 /// NOTE:
309 /// - Initialize the vs_pool_t. This will give all of our vs_t's
310 /// their IDs so that they can be allocated.
311 ///
312
313 g_mut_vs_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
314
315 /// NOTE:
316 /// - Wait for callbacks. Note that this function does not return.
317 /// The next time the extension is executed, it will be the
318 /// bootstrap callback that was just previously registered, which
319 /// will be called on each PP that is online. Failure to call this
320 /// function leads to undefined behaviour (likely a page fault).
321 /// - This is similar to the wait() function from POSIX after having
322 /// just started some processes, with the difference being that
323 /// this will never return, so there is no need to pass in status
324 /// as there is nothing to process after this call.
325 ///
326
327 return bf_control_op_wait();
328 }

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