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

Function ext_main_entry

kernel/integration/bf_vs_op_run.cpp:227–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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