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

Function ext_main_entry

kernel/integration/fast_fail_exit_from_fail.cpp:224–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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