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

Function ext_main_entry

kernel/integration/bf_debug_op_dump_ext.cpp:234–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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