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