Merge pull request #958 from rianquinn/master

Small bug fixes to support MicroV
This commit is contained in:
Rian Quinn 2021-09-10 20:20:17 -06:00 committed by GitHub
commit e4eea8ceea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
316 changed files with 75 additions and 118 deletions

View file

@ -23,8 +23,6 @@ Checks:
'
-*,
bsl-*,
-bsl-literals-user-defined,
-bsl-template-generic-param,
bugprone-*,
-bugprone-branch-clone,
cert-*,
@ -32,13 +30,13 @@ Checks:
-cert-oop54-cpp,
clang-analyzer-*,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-cplusplus.NewDelete,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-non-const-global-variables,
hicpp-*,
misc-*,
-misc-misplaced-const,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-use-default-member-init,
performance-*,

View file

@ -22,7 +22,7 @@
FetchContent_Declare(
bsl
GIT_REPOSITORY https://github.com/bareflank/bsl.git
GIT_TAG d38fc7d36659c05437f6d9b0a65d8b4c656291d2
GIT_TAG 2e38e58e0f5d828e70428ae90481aedf5cefc785
)
FetchContent_GetProperties(bsl)

View file

@ -23,14 +23,16 @@ Checks:
'
-*,
bsl-*,
-bsl-literals-user-defined,
-bsl-template-generic-param,
bugprone-*,
-bugprone-branch-clone,
cert-*,
-cert-dcl21-cpp,
-cert-oop54-cpp,
clang-analyzer-*,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-cplusplus.NewDelete,
cppcoreguidelines-*,
hicpp-*,
misc-*,

View file

@ -84,7 +84,7 @@ namespace example
/// plan to add guest support with your extensions.
///
auto const vmid{syscall::BF_ROOT_VMID};
constexpr auto vmid{syscall::BF_ROOT_VMID};
/// NOTE:
/// - The VP in this simple example does nothing, but we still need

View file

@ -99,11 +99,6 @@ namespace example
syscall::bf_syscall_t const &sys,
intrinsic_t const &intrinsic) noexcept
{
/// NOTE:
/// - Initialize all of the vp_t's in the pool and give them
/// each a unique ID.
///
for (bsl::safe_idx mut_i{}; mut_i < m_pool.size(); ++mut_i) {
m_pool.at_if(mut_i)->initialize(gs, tls, sys, intrinsic, bsl::to_u16(mut_i));
}
@ -125,10 +120,6 @@ namespace example
syscall::bf_syscall_t const &sys,
intrinsic_t const &intrinsic) noexcept
{
/// NOTE:
/// - Release all of the vp_t's in the pool
///
for (auto &mut_vp : m_pool) {
mut_vp.release(gs, tls, sys, intrinsic);
}

View file

@ -22,8 +22,8 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#ifndef MOCKS_VP_T_HPP
#define MOCKS_VP_T_HPP
#ifndef VP_T_HPP
#define VP_T_HPP
#include <allocated_status_t.hpp>
#include <bf_syscall_t.hpp>

View file

@ -99,11 +99,6 @@ namespace example
syscall::bf_syscall_t const &sys,
intrinsic_t const &intrinsic) noexcept
{
/// NOTE:
/// - Initialize all of the vs_t's in the pool and give them
/// each a unique ID.
///
for (bsl::safe_idx mut_i{}; mut_i < m_pool.size(); ++mut_i) {
m_pool.at_if(mut_i)->initialize(gs, tls, sys, intrinsic, bsl::to_u16(mut_i));
}
@ -125,10 +120,6 @@ namespace example
syscall::bf_syscall_t const &sys,
intrinsic_t const &intrinsic) noexcept
{
/// NOTE:
/// - Release all of the vs_t's in the pool
///
for (auto &mut_vs : m_pool) {
mut_vs.release(gs, tls, sys, intrinsic);
}

View file

@ -23,17 +23,20 @@ Checks:
'
-*,
bsl-*,
-bsl-literals-user-defined,
-bsl-template-generic-param,
bugprone-*,
-bugprone-branch-clone,
cert-*,
-cert-dcl21-cpp,
-cert-oop54-cpp,
clang-analyzer-*,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-cplusplus.NewDelete,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-avoid-non-const-global-variables,
hicpp-*,
-hicpp-function-size,
misc-*,

View file

@ -44,8 +44,7 @@ namespace example
/// @param vsid the ID of the VS that generated the VMExit
/// @param exit_reason the exit reason associated with the VMExit
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
vmexit_entry(bsl::uint16 const vsid, bsl::uint64 const exit_reason) noexcept
{
vmexit(g_handle, vsid, exit_reason);
@ -67,8 +66,7 @@ namespace example
/// <!-- inputs/outputs -->
/// @param fail_reason the exit reason associated with the fail
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
fail_entry(syscall::bf_status_t::value_type const fail_reason) noexcept
{
bsl::discard(fail_reason);
@ -113,8 +111,7 @@ namespace example
/// <!-- inputs/outputs -->
/// @param ppid the physical process to bootstrap
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
bootstrap_entry(bsl::uint16 const ppid) noexcept
{
bsl::errc_type ret{};

View file

@ -1,8 +0,0 @@
/* ---- AUTO GENERATED ---- */
use crate::debug_levels;
pub const BSL_RELEASE_MODE:bool = false;
pub const ENABLE_COLOR:bool = true;
pub const BSL_DEBUG_LEVEL:u64 = debug_levels::V;
pub const BSL_ASSERT_FAST_FAILS:bool = true;

View file

@ -42,8 +42,7 @@ namespace integration
/// <!-- inputs/outputs -->
/// @param ppid the physical process to bootstrap
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
bootstrap_entry(bsl::uint16 const ppid) noexcept
{
bsl::discard(ppid);

View file

@ -42,8 +42,7 @@ namespace integration
/// <!-- inputs/outputs -->
/// @param fail_reason the exit reason associated with the fail
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
fail_entry(syscall::bf_status_t::value_type const fail_reason) noexcept
{
bsl::discard(fail_reason);

View file

@ -43,8 +43,7 @@ namespace integration
/// @param vsid the ID of the VS that generated the VMExit
/// @param exit_reason the exit reason associated with the VMExit
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
vmexit_entry(bsl::uint16 const vsid, bsl::uint64 const exit_reason) noexcept
{
bsl::discard(vsid);

View file

@ -43,8 +43,7 @@ namespace integration
/// @param vsid the ID of the VS that generated the VMExit
/// @param exit_reason the exit reason associated with the VMExit
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
vmexit_entry(bsl::uint16 const vsid, bsl::uint64 const exit_reason) noexcept
{
bsl::discard(vsid);
@ -59,8 +58,7 @@ namespace integration
/// <!-- inputs/outputs -->
/// @param fail_reason the exit reason associated with the fail
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
fail_entry(syscall::bf_status_t::value_type const fail_reason) noexcept
{
bsl::discard(fail_reason);
@ -73,8 +71,7 @@ namespace integration
/// <!-- inputs/outputs -->
/// @param ppid the physical process to bootstrap
///
void
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
extern "C" void
bootstrap_entry(bsl::uint16 const ppid) noexcept
{
bsl::discard(ppid);

View file

@ -37,37 +37,22 @@ namespace mk
extern "C"
{
/// @brief stores a pointer to the debug ring provided by the loader
// NOLINTNEXTLINE(bsl-var-braced-init)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern loader::debug_ring_t *g_pmut_mut_debug_ring;
}
/// NOTE:
/// - There are a lot of Clang Tidy exceptions here. The rules that have
/// exceptions are all self imposed to ensure that safe integrals are
/// used wherever possible as the compiler will remove the overhead
/// when it is not needed, so they are almost zero cost. In this case
/// however, the debug ring implements the debugging logic that the
/// safe integral relies on, which means that it cannot use safe
/// integrals in it's implementation. This is, however, still compliant
/// as fixed types are used and overflow has been checked and verified
/// to never occur.
///
/// <!-- description -->
/// @brief Outputs a character to the serial port.
///
/// <!-- inputs/outputs -->
/// @param c the character to output
///
constexpr void
extern "C" constexpr void
debug_ring_write(bsl::char_type const c) noexcept
{
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
bsl::uintmx mut_epos{g_pmut_mut_debug_ring->epos};
// NOLINTNEXTLINE(bsl-non-safe-integral-types-are-forbidden)
bsl::uintmx mut_spos{g_pmut_mut_debug_ring->spos};
// NOLINTNEXTLINE(bsl-types-fixed-width-ints-arithmetic-check)
if (!(g_pmut_mut_debug_ring->buf.size() > mut_epos)) {
mut_epos = {};
}
@ -78,7 +63,6 @@ namespace mk
*g_pmut_mut_debug_ring->buf.at_if(mut_epos) = c;
++mut_epos;
// NOLINTNEXTLINE(bsl-types-fixed-width-ints-arithmetic-check)
if (!(g_pmut_mut_debug_ring->buf.size() > mut_epos)) {
mut_epos = {};
}
@ -89,7 +73,6 @@ namespace mk
if (mut_epos == mut_spos) {
++mut_spos;
// NOLINTNEXTLINE(bsl-types-fixed-width-ints-arithmetic-check)
if (!(g_pmut_mut_debug_ring->buf.size() > mut_spos)) {
mut_spos = {};
}

View file

@ -46,39 +46,51 @@
namespace mk
{
/// @brief stores the TLS blocks used by the microkernel.
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern "C" constinit bsl::array<tls_t, HYPERVISOR_MAX_PPS.get()> g_mut_tls_blocks{};
/// @brief stores a pointer to the debug ring provided by the loader
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
extern "C" constinit loader::debug_ring_t *g_pmut_mut_debug_ring{};
/// @brief stores the vmexit log used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline vmexit_log_t g_mut_vmexit_log{};
/// @brief stores the page_pool_t used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline page_pool_t g_mut_page_pool{};
/// @brief stores the huge pool used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline huge_pool_t g_mut_huge_pool{};
/// @brief stores the intrinsics used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline intrinsic_t g_mut_intrinsic{};
/// @brief stores the vm_pool_t used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline vm_pool_t g_mut_vm_pool{};
/// @brief stores the vp_pool_t used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline vp_pool_t g_mut_vp_pool{};
/// @brief stores the vs_pool_t used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline vs_pool_t g_mut_vs_pool{};
/// @brief stores the ext pool used by the microkernel
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline ext_pool_t g_mut_ext_pool{};
/// @brief stores the system RPT provided by the loader
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline root_page_table_t g_mut_system_rpt{};
/// @brief stores the microkernel's main class
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
constinit inline mk_main_t g_mut_mk_main{};
/// <!-- description -->

View file

@ -23,9 +23,6 @@ Checks:
'
-*,
bsl-*,
-bsl-lambda-implicit-capture,
-bsl-literals-user-defined,
-bsl-template-generic-param,
bugprone-*,
-bugprone-branch-clone,
cert-*,
@ -37,12 +34,13 @@ Checks:
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-cplusplus.NewDelete,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-avoid-non-const-global-variables,
hicpp-*,
-hicpp-function-size,
misc-*,
-misc-misplaced-const,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-use-default-member-init,
performance-*,
@ -50,7 +48,8 @@ Checks:
-readability-redundant-member-init,
-readability-avoid-const-params-in-decls,
-readability-static-accessed-through-instance,
-readability-function-size
-readability-function-size,
-readability-magic-numbers
'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/huge_pool_t.hpp"
#include "../../../mocks/huge_pool_t.hpp"
#include <bsl/convert.hpp>
#include <bsl/ut.hpp>

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/huge_pool_t.hpp"
#include "../../../mocks/huge_pool_t.hpp"
#include <page_t.hpp>

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/lock_guard_t.hpp"
#include "../../../mocks/lock_guard_t.hpp"
#include <spinlock_t.hpp>

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/lock_guard_t.hpp"
#include "../../../mocks/lock_guard_t.hpp"
#include <spinlock_t.hpp>

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/page_pool_t.hpp"
#include "../../../mocks/page_pool_t.hpp"
#include <ext_tcb_t.hpp>
#include <page_t.hpp>

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/page_pool_t.hpp"
#include "../../../mocks/page_pool_t.hpp"
#include <page_t.hpp>

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/spinlock_t.hpp"
#include "../../../mocks/spinlock_t.hpp"
#include <bsl/ut.hpp>

View file

@ -22,7 +22,7 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#include "../../../MOCK/spinlock_t.hpp"
#include "../../../mocks/spinlock_t.hpp"
#include <bsl/discard.hpp>
#include <bsl/ut.hpp>

View file

@ -23,10 +23,6 @@ Checks:
'
-*,
bsl-*,
-bsl-lambda-implicit-capture,
-bsl-decl-forbidden,
-bsl-literals-user-defined,
-bsl-template-generic-param,
bugprone-*,
-bugprone-branch-clone,
cert-*,
@ -38,13 +34,13 @@ Checks:
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-cplusplus.NewDelete,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-avoid-non-const-global-variables,
hicpp-*,
-hicpp-function-size,
misc-*,
-misc-misplaced-const,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-use-default-member-init,
performance-*,
@ -52,7 +48,8 @@ Checks:
-readability-redundant-member-init,
-readability-avoid-const-params-in-decls,
-readability-static-accessed-through-instance,
-readability-function-size
-readability-function-size,
-readability-magic-numbers
'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'

View file

@ -42,7 +42,7 @@ namespace lib
bsl::uint16 ppid;
/// @brief stores a pointer to the active root page table
void *active_rpt;
/// @brief tells certain MOCK when to fail
/// @brief tells certain mocks when to fail
bsl::errc_type test_ret;
};
}

View file

@ -23,8 +23,6 @@ Checks:
'
-*,
bsl-*,
-bsl-literals-user-defined,
-bsl-template-generic-param,
bugprone-*,
-bugprone-branch-clone,
cert-*,
@ -32,23 +30,26 @@ Checks:
-cert-oop54-cpp,
clang-analyzer-*,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-core.NullDereference,
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-cplusplus.NewDelete,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-avoid-non-const-global-variables,
hicpp-*,
-hicpp-function-size,
-hicpp-deprecated-headers,,
misc-*,
-misc-misplaced-const,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-use-default-member-init,
-modernize-deprecated-headers,
performance-*,
readability-*,
-readability-redundant-member-init,
-readability-avoid-const-params-in-decls,
-readability-static-accessed-through-instance,
-readability-function-size
-readability-function-size,
-readability-magic-numbers
'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'

Some files were not shown because too many files have changed in this diff Show more