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

Function ext_main_entry

kernel/integration/bf_vm_op_create_vm.cpp:237–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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