| 318 | /// microkernel speak the same ABI. |
| 319 | /// |
| 320 | extern "C" void |
| 321 | ext_main_entry(bsl::uint32 const version) noexcept |
| 322 | { |
| 323 | bsl::errc_type mut_ret{}; |
| 324 | |
| 325 | /// NOTE: |
| 326 | /// - Initialize the bf_syscall_t. This will validate the ABI version, |
| 327 | /// open a handle to the microkernel and register the required |
| 328 | /// callbacks. If this fails, we call bf_control_op_exit, which is |
| 329 | /// similar to exit() from POSIX, except that the return value is |
| 330 | /// always the same. |
| 331 | /// |
| 332 | |
| 333 | mut_ret = g_mut_sys.initialize( // -- |
| 334 | bsl::to_u32(version), // -- |
| 335 | &bootstrap_entry, // -- |
| 336 | &vmexit_entry, // -- |
| 337 | &fail_entry); // -- |
| 338 | |
| 339 | if (bsl::unlikely(!mut_ret)) { |
| 340 | bsl::print<bsl::V>() << bsl::here(); |
| 341 | return bf_control_op_exit(); |
| 342 | } |
| 343 | |
| 344 | mut_ret = gs_initialize(g_mut_gs, g_mut_sys, g_mut_intrinsic); |
| 345 | if (bsl::unlikely(!mut_ret)) { |
| 346 | bsl::print<bsl::V>() << bsl::here(); |
| 347 | return bf_control_op_exit(); |
| 348 | } |
| 349 | |
| 350 | /// NOTE: |
| 351 | /// - Initialize the vp_pool_t. This will give all of our vp_t's |
| 352 | /// their IDs so that they can be allocated. |
| 353 | /// |
| 354 | |
| 355 | g_mut_vp_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic); |
| 356 | |
| 357 | /// NOTE: |
| 358 | /// - Initialize the vs_pool_t. This will give all of our vs_t's |
| 359 | /// their IDs so that they can be allocated. |
| 360 | /// |
| 361 | |
| 362 | g_mut_vs_pool.initialize(g_mut_gs, g_mut_tls, g_mut_sys, g_mut_intrinsic); |
| 363 | |
| 364 | /// NOTE: |
| 365 | /// - Wait for callbacks. Note that this function does not return. |
| 366 | /// The next time the extension is executed, it will be the |
| 367 | /// bootstrap callback that was just previously registered, which |
| 368 | /// will be called on each PP that is online. Failure to call this |
| 369 | /// function leads to undefined behaviour (likely a page fault). |
| 370 | /// - This is similar to the wait() function from POSIX after having |
| 371 | /// just started some processes, with the difference being that |
| 372 | /// this will never return, so there is no need to pass in status |
| 373 | /// as there is nothing to process after this call. |
| 374 | /// |
| 375 | |
| 376 | return bf_control_op_wait(); |
| 377 | } |
nothing calls this directly
no test coverage detected