|
| 1 | +/// @copyright |
| 2 | +/// Copyright (C) 2020 Assured Information Security, Inc. |
| 3 | +/// |
| 4 | +/// @copyright |
| 5 | +/// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +/// of this software and associated documentation files (the "Software"), to deal |
| 7 | +/// in the Software without restriction, including without limitation the rights |
| 8 | +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +/// copies of the Software, and to permit persons to whom the Software is |
| 10 | +/// furnished to do so, subject to the following conditions: |
| 11 | +/// |
| 12 | +/// @copyright |
| 13 | +/// The above copyright notice and this permission notice shall be included in |
| 14 | +/// all copies or substantial portions of the Software. |
| 15 | +/// |
| 16 | +/// @copyright |
| 17 | +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | +/// SOFTWARE. |
| 24 | + |
| 25 | +#include <integration_utils.hpp> |
| 26 | +#include <ioctl_t.hpp> |
| 27 | +#include <shim_platform_interface.hpp> |
| 28 | + |
| 29 | +#include <bsl/convert.hpp> |
| 30 | +#include <bsl/enable_color.hpp> |
| 31 | +#include <bsl/exit_code.hpp> |
| 32 | +#include <bsl/safe_integral.hpp> |
| 33 | + |
| 34 | +/// <!-- description --> |
| 35 | +/// @brief Provides the main entry point for this application. |
| 36 | +/// |
| 37 | +/// <!-- inputs/outputs --> |
| 38 | +/// @return bsl::exit_success on success, bsl::exit_failure otherwise. |
| 39 | +/// |
| 40 | +[[nodiscard]] auto |
| 41 | +main() noexcept -> bsl::exit_code |
| 42 | +{ |
| 43 | + bsl::enable_color(); |
| 44 | + integration::ioctl_t mut_system_ctl{shim::DEVICE_NAME}; |
| 45 | + auto const vmfd{mut_system_ctl.send(shim::KVM_CREATE_VM)}; |
| 46 | + integration::ioctl_t mut_vm{bsl::to_i32(vmfd)}; |
| 47 | + auto const vcpufd{mut_vm.send(shim::KVM_CREATE_VCPU)}; |
| 48 | + integration::ioctl_t mut_vcpu{bsl::to_i32(vcpufd)}; |
| 49 | + constexpr auto mut_ret{0_i64}; |
| 50 | + { |
| 51 | + auto const irqline{mut_vcpu.send(shim::KVM_IRQ_LINE)}; |
| 52 | + integration::verify(irqline.is_pos()); |
| 53 | + integration::verify(irqline >= mut_ret.get()); |
| 54 | + } |
| 55 | + return bsl::exit_success; |
| 56 | +} |
0 commit comments