-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a802c42
commit 549fb81
Showing
10 changed files
with
200 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/// @copyright | ||
/// Copyright (C) 2020 Assured Information Security, Inc. | ||
/// | ||
/// @copyright | ||
/// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
/// of this software and associated documentation files (the "Software"), to deal | ||
/// in the Software without restriction, including without limitation the rights | ||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
/// copies of the Software, and to permit persons to whom the Software is | ||
/// furnished to do so, subject to the following conditions: | ||
/// | ||
/// @copyright | ||
/// The above copyright notice and this permission notice shall be included in | ||
/// all copies or substantial portions of the Software. | ||
/// | ||
/// @copyright | ||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
/// SOFTWARE. | ||
|
||
#ifndef KVM_MSI_HPP | ||
#define KVM_MSI_HPP | ||
|
||
#include <bsl/array.hpp> | ||
#include <bsl/convert.hpp> | ||
#include <bsl/safe_integral.hpp> | ||
|
||
#pragma pack(push, 1) | ||
|
||
namespace shim | ||
{ | ||
/// @brief defines the size of the padding field | ||
constexpr auto PAD_SIZE_MSI{16_umx}; | ||
/// @struct kvm_msi | ||
/// | ||
/// <!-- description --> | ||
/// @brief see /include/uapi/linux/kvm.h in Linux for more details. | ||
/// | ||
struct kvm_msi final | ||
{ | ||
/** @brief For PCI, this is a BFD identifier in the lower 16 bits. */ | ||
bsl::uint32 address_lo; | ||
/** @brief address_hi bits 31-8 provide bits 31-8 of the destination id. Bits 7-0 of | ||
address_hi must be zero. */ | ||
bsl::uint32 address_hi; | ||
/** @brief a MSI message*/ | ||
bsl::uint32 data; | ||
/** @brief A Flag to indicate valid or invalid data */ | ||
bsl::uint32 flags; | ||
/** @brief TODO */ | ||
bsl::array<bsl::uint8, PAD_SIZE_MSI.get()> pad; | ||
}; | ||
} | ||
|
||
#pragma pack(pop) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/// @copyright | ||
/// Copyright (C) 2020 Assured Information Security, Inc. | ||
/// | ||
/// @copyright | ||
/// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
/// of this software and associated documentation files (the "Software"), to deal | ||
/// in the Software without restriction, including without limitation the rights | ||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
/// copies of the Software, and to permit persons to whom the Software is | ||
/// furnished to do so, subject to the following conditions: | ||
/// | ||
/// @copyright | ||
/// The above copyright notice and this permission notice shall be included in | ||
/// all copies or substantial portions of the Software. | ||
/// | ||
/// @copyright | ||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
/// SOFTWARE. | ||
|
||
#include <integration_utils.hpp> | ||
#include <ioctl_t.hpp> | ||
#include <shim_platform_interface.hpp> | ||
|
||
#include <bsl/convert.hpp> | ||
#include <bsl/enable_color.hpp> | ||
#include <bsl/exit_code.hpp> | ||
#include <bsl/safe_integral.hpp> | ||
|
||
/// <!-- description --> | ||
/// @brief Provides the main entry point for this application. | ||
/// | ||
/// <!-- inputs/outputs --> | ||
/// @return bsl::exit_success on success, bsl::exit_failure otherwise. | ||
/// | ||
[[nodiscard]] auto | ||
main() noexcept -> bsl::exit_code | ||
{ | ||
bsl::enable_color(); | ||
integration::ioctl_t mut_system_ctl{shim::DEVICE_NAME}; | ||
auto const vmfd{mut_system_ctl.send(shim::KVM_CREATE_VM)}; | ||
integration::ioctl_t mut_vm{bsl::to_i32(vmfd)}; | ||
auto const vcpufd{mut_vm.send(shim::KVM_CREATE_VCPU)}; | ||
integration::ioctl_t mut_vcpu{bsl::to_i32(vcpufd)}; | ||
constexpr auto mut_ret{0_i64}; | ||
{ | ||
auto const signalmsi{mut_vcpu.send(shim::KVM_SIGNAL_MSI)}; | ||
integration::verify(signalmsi.is_pos()); | ||
integration::verify(signalmsi >= mut_ret.get()); | ||
} | ||
return bsl::exit_success; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters