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

Function bootstrap_entry

kernel/integration/bf_vs_op_destroy_vs.cpp:107–169  ·  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 auto const vpid{g_mut_sys.bf_vp_op_create_vp({})};
114 integration::require(vpid.is_valid());
115
116 // create with invalid handle
117 {
118 constexpr auto hndl{BF_INVALID_HANDLE};
119
120 mut_ret = bf_vs_op_destroy_vs_impl(hndl.get(), {});
121 integration::require(mut_ret != BF_STATUS_SUCCESS);
122 }
123
124 // create with invalid vsid
125 {
126 // BF_INVALID_ID
127 mut_ret = bf_vs_op_destroy_vs_impl({}, BF_INVALID_ID.get());
128 integration::require(mut_ret != BF_STATUS_SUCCESS);
129
130 // out of range
131 auto const oor{bsl::to_u16(HYPERVISOR_MAX_VPS + bsl::safe_u64::magic_1()).checked()};
132 mut_ret = bf_vs_op_destroy_vs_impl({}, oor.get());
133 integration::require(mut_ret != BF_STATUS_SUCCESS);
134
135 // not yet created
136 auto const nyc{bsl::to_u16(HYPERVISOR_MAX_VPS - bsl::safe_u64::magic_1()).checked()};
137 mut_ret = bf_vs_op_destroy_vs_impl({}, nyc.get());
138 integration::require(mut_ret != BF_STATUS_SUCCESS);
139 }
140
141 // create all and and then make sure we can destroy them all
142 {
143 for (bsl::safe_idx mut_i{}; mut_i < HYPERVISOR_MAX_VPS; ++mut_i) {
144 auto const vsid{g_mut_sys.bf_vs_op_create_vs({}, {})};
145 integration::require(vsid.is_valid());
146 }
147
148 for (bsl::safe_idx mut_i{}; mut_i < HYPERVISOR_MAX_VPS; ++mut_i) {
149 auto const ret{g_mut_sys.bf_vs_op_destroy_vs(bsl::to_u16(mut_i))};
150 integration::require(ret);
151 }
152 }
153
154 // do it again to make sure that after destroy, create still works
155 {
156 for (bsl::safe_idx mut_i{}; mut_i < HYPERVISOR_MAX_VPS; ++mut_i) {
157 auto const vsid{g_mut_sys.bf_vs_op_create_vs({}, {})};
158 integration::require(vsid.is_valid());
159 }
160
161 for (bsl::safe_idx mut_i{}; mut_i < HYPERVISOR_MAX_VPS; ++mut_i) {
162 auto const ret{g_mut_sys.bf_vs_op_destroy_vs(bsl::to_u16(mut_i))};
163 integration::require(ret);
164 }

Callers

nothing calls this directly

Calls 6

requireFunction · 0.85
bf_vs_op_destroy_vs_implFunction · 0.85
bf_control_op_exitFunction · 0.50
bf_vp_op_create_vpMethod · 0.45
bf_vs_op_create_vsMethod · 0.45
bf_vs_op_destroy_vsMethod · 0.45

Tested by

no test coverage detected