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

Function ext_main_entry

kernel/integration/bf_vm_op_unmap_direct.cpp:377–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375 /// microkernel speak the same ABI.
376 ///
377 extern "C" void
378 ext_main_entry(bsl::uint32 const version) noexcept
379 {
380 bsl::errc_type mut_ret{};
381
382 /// NOTE:
383 /// - Initialize the bf_syscall_t. This will validate the ABI version,
384 /// open a handle to the microkernel and register the required
385 /// callbacks. If this fails, we call bf_control_op_exit, which is
386 /// similar to exit() from POSIX, except that the return value is
387 /// always the same.
388 ///
389
390 mut_ret = g_mut_sys.initialize( // --
391 bsl::to_u32(version), // --
392 &bootstrap_entry, // --
393 &vmexit_entry, // --
394 &fail_entry); // --
395
396 if (bsl::unlikely(!mut_ret)) {
397 bsl::print<bsl::V>() << bsl::here();
398 return bf_control_op_exit();
399 }
400
401 mut_ret = gs_initialize(g_mut_gs, g_mut_sys, g_mut_intrinsic);
402 if (bsl::unlikely(!mut_ret)) {
403 bsl::print<bsl::V>() << bsl::here();
404 return bf_control_op_exit();
405 }
406
407 /// NOTE:
408 /// - Initialize the vp_pool_t. This will give all of our vp_t's
409 /// their IDs so that they can be allocated.
410 ///
411
412 g_mut_vp_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
413
414 /// NOTE:
415 /// - Initialize the vs_pool_t. This will give all of our vs_t's
416 /// their IDs so that they can be allocated.
417 ///
418
419 g_mut_vs_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic);
420
421 /// NOTE:
422 /// - Wait for callbacks. Note that this function does not return.
423 /// The next time the extension is executed, it will be the
424 /// bootstrap callback that was just previously registered, which
425 /// will be called on each PP that is online. Failure to call this
426 /// function leads to undefined behaviour (likely a page fault).
427 /// - This is similar to the wait() function from POSIX after having
428 /// just started some processes, with the difference being that
429 /// this will never return, so there is no need to pass in status
430 /// as there is nothing to process after this call.
431 ///
432
433 return bf_control_op_wait();
434 }

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