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

Function ext_main_entry

kernel/integration/bf_vs_op_migrate.cpp:283–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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