MCPcopy Create free account
hub / github.com/Bareflank/hypervisor / bootstrap_entry

Function bootstrap_entry

kernel/integration/bf_vp_op_create_vp.cpp:107–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 bsl::safe_u16 mut_id{};
116 constexpr auto hndl{BF_INVALID_HANDLE};
117
118 mut_ret = bf_vp_op_create_vp_impl(hndl.get(), {}, mut_id.data());
119 integration::require(mut_ret != BF_STATUS_SUCCESS);
120 }
121
122 // create with invalid vmid
123 {
124 bsl::safe_u16 mut_id{};
125
126 // BF_INVALID_ID
127 mut_ret = bf_vp_op_create_vp_impl({}, BF_INVALID_ID.get(), mut_id.data());
128 integration::require(mut_ret != BF_STATUS_SUCCESS);
129
130 // out of range
131 auto const oor{bsl::to_u16(HYPERVISOR_MAX_VMS + bsl::safe_u64::magic_1()).checked()};
132 mut_ret = bf_vp_op_create_vp_impl({}, oor.get(), mut_id.data());
133 integration::require(mut_ret != BF_STATUS_SUCCESS);
134
135 // not yet created
136 auto const nyc{bsl::to_u16(HYPERVISOR_MAX_VMS - bsl::safe_u64::magic_1()).checked()};
137 mut_ret = bf_vp_op_create_vp_impl({}, nyc.get(), mut_id.data());
138 integration::require(mut_ret != BF_STATUS_SUCCESS);
139 }
140
141 // create all and prove that creating one more will fail
142 {
143 for (bsl::safe_idx mut_i{}; mut_i < HYPERVISOR_MAX_VPS; ++mut_i) {
144 auto const vpid{g_mut_sys.bf_vp_op_create_vp({})};
145 integration::require(vpid.is_valid());
146 }
147
148 auto const vpid{g_mut_sys.bf_vp_op_create_vp({})};
149 integration::require(vpid.is_invalid());
150 }
151
152 bsl::debug() << "success. remaining backtrace is expected\n" << bsl::here();
153 return bf_control_op_exit();
154 }
155
156 /// <!-- description -->
157 /// @brief Implements the fast fail entry function. This is registered

Callers

nothing calls this directly

Calls 5

bf_vp_op_create_vp_implFunction · 0.85
requireFunction · 0.85
bf_control_op_exitFunction · 0.50
dataMethod · 0.45
bf_vp_op_create_vpMethod · 0.45

Tested by

no test coverage detected