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

Function ext_main_entry

example/default/src/main.cpp:240–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

behavior.cppFile · 0.50

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