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

Function ext_main_entry

kernel/integration/bf_vs_op_promote.cpp:258–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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