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

Function ext_main_entry

kernel/integration/bf_mem_op_alloc_page.cpp:247–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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