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

Function ext_main_entry

kernel/integration/bf_vs_op_clear.cpp:256–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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