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

Function ext_main_entry

kernel/integration/bf_vm_op_destroy_vm.cpp:270–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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