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

Function ext_main_entry

kernel/integration/bf_vs_op_create_vs.cpp:278–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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