mirror of
https://github.com/Bareflank/hypervisor
synced 2026-08-17 06:23:04 -04:00
This patch enables the ability to launch the VMM on AMD on a single core. It uses an old hack to deal with a lack of our own CR3, which will be removed once we have the CR3 part added, and as a result, it only works on single core. It also cannot be stopped, as that logic is really specific to the way that the VMM was launched which will change once all of this code is moved to C++, so that functionality will come later as well.
122 lines
4.1 KiB
C
122 lines
4.1 KiB
C
/**
|
|
* @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 LOADER_H
|
|
#define LOADER_H
|
|
|
|
#include <loader_types.h>
|
|
|
|
/**
|
|
* @brief Returned by a loader function when an error occurs. Note that
|
|
* functions that are responsible for stopping the hypervisor, in general,
|
|
* should never return an error.
|
|
*/
|
|
#define LOADER_FAILURE (-1)
|
|
|
|
/**
|
|
* <!-- description -->
|
|
* @brief This function contains all of the code that is common between
|
|
* all archiectures and all platforms that is needed for initializing
|
|
* the loader. This function will call platform and architecture specific
|
|
* functions as needed.
|
|
*
|
|
* <!-- inputs/outputs -->
|
|
* @return Returns 0 on success
|
|
*/
|
|
int64_t loader_init(void);
|
|
|
|
/**
|
|
* <!-- description -->
|
|
* @brief This function contains all of the code that is common between
|
|
* all archiectures and all platforms that is needed for finalizing
|
|
* the loader. This function will call platform and architecture specific
|
|
* functions as needed.
|
|
*
|
|
* <!-- inputs/outputs -->
|
|
* @return Returns 0 on success
|
|
*/
|
|
int64_t loader_fini(void);
|
|
|
|
/**
|
|
* <!-- description -->
|
|
* @brief This function contains all of the code that is common between
|
|
* all archiectures and all platforms for starting the VMM. This function
|
|
* will call platform and architecture specific functions as needed.
|
|
*
|
|
* <!-- inputs/outputs -->
|
|
* @return Returns 0 on success
|
|
*/
|
|
int64_t start_vmm(void);
|
|
|
|
/**
|
|
* <!-- description -->
|
|
* @brief This function contains all of the code that is common between
|
|
* all archiectures and all platforms for starting the VMM. This function
|
|
* will call platform and architecture specific functions as needed.
|
|
* Unlike start_vmm, this function is called on each CPU.
|
|
*
|
|
* <!-- inputs/outputs -->
|
|
* @param cpu the id of the cpu to start
|
|
* @return Returns 0 on success
|
|
*/
|
|
int64_t start_vmm_per_cpu(uint32_t const cpu);
|
|
|
|
/**
|
|
* <!-- description -->
|
|
* @brief This function contains all of the code that is common between
|
|
* all archiectures and all platforms for stoping the VMM. This function
|
|
* will call platform and architecture specific functions as needed.
|
|
*
|
|
* <!-- inputs/outputs -->
|
|
* @return Returns 0 on success
|
|
*/
|
|
int64_t stop_vmm(void);
|
|
|
|
/**
|
|
* <!-- description -->
|
|
* @brief This function contains all of the code that is common between
|
|
* all archiectures and all platforms for stopping the VMM. This function
|
|
* will call platform and architecture specific functions as needed.
|
|
* Unlike stop_vmm, this function is called on each CPU.
|
|
*
|
|
* <!-- inputs/outputs -->
|
|
* @param cpu the id of the cpu to stop
|
|
* @return Returns 0 on success
|
|
*/
|
|
int64_t stop_vmm_per_cpu(uint32_t const cpu);
|
|
|
|
/**
|
|
* <!-- description -->
|
|
* @brief This function contains all of the code that is common between
|
|
* all archiectures and all platforms for dumping the VMM. This function
|
|
* will call platform and architecture specific functions as needed.
|
|
*
|
|
* <!-- inputs/outputs -->
|
|
* @return Returns 0 on success
|
|
*/
|
|
int64_t dump_vmm(void);
|
|
|
|
#endif
|