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