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