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

Function ext_main_entry

kernel/integration/bf_vs_op_set_active.cpp:432–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430 /// microkernel speak the same ABI.
431 ///
432 extern "C" void
433 ext_main_entry(bsl::uint32 const version) noexcept
434 {
435 bsl::errc_type mut_ret{};
436
437 /// NOTE:
438 /// - Initialize the bf_syscall_t. This will validate the ABI version,
439 /// open a handle to the microkernel and register the required
440 /// callbacks. If this fails, we call bf_control_op_exit, which is
441 /// similar to exit() from POSIX, except that the return value is
442 /// always the same.
443 ///
444
445 mut_ret = g_mut_sys.initialize( // --
446 bsl::to_u32(version), // --
447 &bootstrap_entry, // --
448 &vmexit_entry, // --
449 &fail_entry); // --
450
451 if (bsl::unlikely(!mut_ret)) {
452 bsl::print<bsl::V>() << bsl::here();
453 return bf_control_op_exit();
454 }
455
456 mut_ret = gs_initialize(g_mut_gs, g_mut_sys, g_mut_intrinsic);
457 if (bsl::unlikely(!mut_ret)) {
458 bsl::print<bsl::V>() << bsl::here();
459 return bf_control_op_exit();
460 }
461
462 /// NOTE:
463 /// - Initialize the vp_pool_t. This will give all of our vp_t's
464 /// their IDs so that they can be allocated.
465 ///
466
467 g_mut_vp_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
468
469 /// NOTE:
470 /// - Initialize the vs_pool_t. This will give all of our vs_t's
471 /// their IDs so that they can be allocated.
472 ///
473
474 g_mut_vs_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
475
476 /// NOTE:
477 /// - Wait for callbacks. Note that this function does not return.
478 /// The next time the extension is executed, it will be the
479 /// bootstrap callback that was just previously registered, which
480 /// will be called on each PP that is online. Failure to call this
481 /// function leads to undefined behaviour (likely a page fault).
482 /// - This is similar to the wait() function from POSIX after having
483 /// just started some processes, with the difference being that
484 /// this will never return, so there is no need to pass in status
485 /// as there is nothing to process after this call.
486 ///
487
488 return bf_control_op_wait();
489 }

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