| 105 | /// @param ppid0 the physical process to bootstrap |
| 106 | /// |
| 107 | extern "C" void |
| 108 | bootstrap_entry(bsl::safe_u16::value_type const ppid0) noexcept |
| 109 | { |
| 110 | bsl::discard(ppid0); |
| 111 | bf_status_t mut_ret{}; |
| 112 | |
| 113 | // create with invalid handle |
| 114 | { |
| 115 | constexpr auto hndl{BF_INVALID_HANDLE}; |
| 116 | |
| 117 | mut_ret = bf_vm_op_destroy_vm_impl(hndl.get(), {}); |
| 118 | integration::require(mut_ret != BF_STATUS_SUCCESS); |
| 119 | } |
| 120 | |
| 121 | // create with invalid vmid |
| 122 | { |
| 123 | // BF_INVALID_ID |
| 124 | mut_ret = bf_vm_op_destroy_vm_impl({}, BF_INVALID_ID.get()); |
| 125 | integration::require(mut_ret != BF_STATUS_SUCCESS); |
| 126 | |
| 127 | // out of range |
| 128 | auto const oor{bsl::to_u16(HYPERVISOR_MAX_VMS + bsl::safe_u64::magic_1()).checked()}; |
| 129 | mut_ret = bf_vm_op_destroy_vm_impl({}, oor.get()); |
| 130 | integration::require(mut_ret != BF_STATUS_SUCCESS); |
| 131 | |
| 132 | // not yet created |
| 133 | auto const nyc{bsl::to_u16(HYPERVISOR_MAX_VMS - bsl::safe_u64::magic_1()).checked()}; |
| 134 | mut_ret = bf_vm_op_destroy_vm_impl({}, nyc.get()); |
| 135 | integration::require(mut_ret != BF_STATUS_SUCCESS); |
| 136 | } |
| 137 | |
| 138 | // create all and and then make sure we can destroy them all |
| 139 | { |
| 140 | constexpr auto one{bsl::safe_idx::magic_1()}; |
| 141 | for (bsl::safe_idx mut_i{one}; mut_i < HYPERVISOR_MAX_VMS; ++mut_i) { |
| 142 | auto const vmid{g_mut_sys.bf_vm_op_create_vm()}; |
| 143 | integration::require(vmid.is_valid()); |
| 144 | } |
| 145 | |
| 146 | for (bsl::safe_idx mut_i{one}; mut_i < HYPERVISOR_MAX_VMS; ++mut_i) { |
| 147 | auto const ret{g_mut_sys.bf_vm_op_destroy_vm(bsl::to_u16(mut_i))}; |
| 148 | integration::require(ret); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | // do it again to make sure that after destroy, create still works |
| 153 | { |
| 154 | constexpr auto one{bsl::safe_idx::magic_1()}; |
| 155 | for (bsl::safe_idx mut_i{one}; mut_i < HYPERVISOR_MAX_VMS; ++mut_i) { |
| 156 | auto const vmid{g_mut_sys.bf_vm_op_create_vm()}; |
| 157 | integration::require(vmid.is_valid()); |
| 158 | } |
| 159 | |
| 160 | for (bsl::safe_idx mut_i{one}; mut_i < HYPERVISOR_MAX_VMS; ++mut_i) { |
| 161 | auto const ret{g_mut_sys.bf_vm_op_destroy_vm(bsl::to_u16(mut_i))}; |
| 162 | integration::require(ret); |
| 163 | } |
| 164 | } |
nothing calls this directly
no test coverage detected