Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Adjust coding style of include path #429

Merged
merged 4 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions core/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "../include/hax.h"
#include "include/memory.h"
#include "../include/hax_host_mem.h"
#include "include/paging.h"
#include "memory.h"

#include "hax.h"
#include "hax_host_mem.h"

#include "paging.h"

int chunk_alloc(uint64_t base_uva, uint64_t size, hax_chunk **chunk)
{
Expand Down
20 changes: 10 additions & 10 deletions core/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "../include/hax.h"
#include "include/ia32_defs.h"
#include "include/cpu.h"
#include "include/cpuid.h"
#include "include/vcpu.h"
#include "include/debug.h"
#include "include/dump.h"
#include "include/name.h"
#include "include/intr.h"
#include "include/ept.h"
#include "cpu.h"

#include "hax.h"

#include "cpuid.h"
#include "dump.h"
#include "ia32_defs.h"
#include "intr.h"
#include "name.h"
#include "vcpu.h"

static void cpu_vmentry_failed(struct vcpu_t *vcpu, vmx_result_t result);
static int cpu_vmexit_handler(struct vcpu_t *vcpu, exit_reason_t exit_reason,
Expand Down
6 changes: 4 additions & 2 deletions core/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/cpuid.h"
#include "include/hax_driver.h"
#include "cpuid.h"

#include "driver.h"
#include "ia32.h"

#define CPUID_CACHE_SIZE 6
#define CPUID_FEATURE_SET_SIZE 2
Expand Down
11 changes: 6 additions & 5 deletions core/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/compiler.h"
#include "include/name.h"
#include "include/vmx.h"
#include "include/dump.h"
#include "../include/hax.h"
#include "dump.h"

#include "hax.h"

#include "compiler.h"
#include "name.h"

static uint32_t dump_vmcs_list[] = {
VMX_PIN_CONTROLS,
Expand Down
2 changes: 1 addition & 1 deletion core/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/emulate.h"
#include "emulate.h"

/* Instruction flags */
/* Instruction does not read from destination */
Expand Down
5 changes: 3 additions & 2 deletions core/ept.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
* mapping.
*/

#include "include/ept.h"
#include "include/cpu.h"
#include "ept.h"

#include "cpu.h"

static uint64_t ept_capabilities;

Expand Down
9 changes: 5 additions & 4 deletions core/ept2.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/ept2.h"
#include "ept2.h"

#include "../include/hax.h"
#include "include/paging.h"
#include "../include/hax_host_mem.h"
#include "hax.h"
#include "hax_host_mem.h"

#include "paging.h"

void ept_handle_mapping_removed(hax_gpa_space_listener *listener,
uint64_t start_gfn, uint64_t npages, uint64_t uva,
Expand Down
9 changes: 5 additions & 4 deletions core/ept_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/ept2.h"
#include "ept2.h"

#include "../include/hax.h"
#include "../include/hax_host_mem.h"
#include "include/paging.h"
#include "hax.h"
#include "hax_host_mem.h"

#include "paging.h"

static hax_epte INVALID_EPTE = {
.pfn = INVALID_PFN
Expand Down
9 changes: 5 additions & 4 deletions core/gpa_space.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/memory.h"
#include "memory.h"

#include "../include/hax.h"
#include "include/paging.h"
#include "../include/hax_host_mem.h"
#include "hax.h"
#include "hax_host_mem.h"

#include "paging.h"

int gpa_space_init(hax_gpa_space *gpa_space)
{
Expand Down
16 changes: 7 additions & 9 deletions core/hax.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/ia32_defs.h"
#include "include/vmx.h"

#include "include/cpu.h"
#include "include/config.h"
#include "include/hax_driver.h"
#include "include/vm.h"
#include "../include/hax.h"
#include "../include/hax_release_ver.h"
#include "hax.h"

#include "hax_release_ver.h"

#include "cpu.h"
#include "driver.h"
#include "ia32_defs.h"

/* deal with module parameter */
struct config_t config = {
Expand Down
2 changes: 1 addition & 1 deletion core/ia32.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "include/ia32.h"
#include "ia32.h"

struct qword_val {
uint32_t low;
Expand Down
2 changes: 0 additions & 2 deletions core/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
#ifndef HAX_CORE_CONFIG_H_
#define HAX_CORE_CONFIG_H_

#include "../../include/hax_types.h"

struct config_t {
int memory_pass_through;
int disable_ept;
Expand Down
6 changes: 3 additions & 3 deletions core/include/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
#ifndef HAX_CORE_CPU_H_
#define HAX_CORE_CPU_H_

#include "vmx.h"
#include "segments.h"
#include "config.h"
#include "vm.h"
#include "pmu.h"
#include "segments.h"
#include "vm.h"
#include "vmx.h"

#define VMXON_SUCCESS 0x0
#define VMXON_FAIL 0x1
Expand Down
3 changes: 2 additions & 1 deletion core/include/cpuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
#ifndef HAX_CORE_CPUID_H_
#define HAX_CORE_CPUID_H_

#include "../../include/hax.h"
#include "hax.h"

#include "types.h"

#define CPUID_REG_EAX 0
Expand Down
8 changes: 4 additions & 4 deletions core/include/hax_driver.h → core/include/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef HAX_CORE_HAX_DRIVER_H_
#define HAX_CORE_HAX_DRIVER_H_
#ifndef HAX_CORE_DRIVER_H_
#define HAX_CORE_DRIVER_H_

#include "vm.h"
#include "pmu.h"

#define CONFIG_VM_NUM 16

struct hax_t {
Expand Down Expand Up @@ -63,4 +63,4 @@ struct hax_t {

uint64_t hax_get_memory_threshold(void);
extern struct hax_t *hax;
#endif // HAX_CORE_HAX_DRIVER_H_
#endif // HAX_CORE_DRIVER_H_
2 changes: 2 additions & 0 deletions core/include/dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#ifndef HAX_CORE_DUMP_H_
#define HAX_CORE_DUMP_H_

#include "vmx.h"

void dump_vmcs(struct vcpu_t *vcpu);

void dump_vmx_info(struct info_t *info);
Expand Down
2 changes: 0 additions & 2 deletions core/include/emulate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
#ifndef HAX_CORE_EMULATE_H_
#define HAX_CORE_EMULATE_H_

#include "../../include/hax_types.h"

#include "emulate_ops.h"

typedef enum {
Expand Down
2 changes: 2 additions & 0 deletions core/include/emulate_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#ifndef HAX_CORE_EMULATE_OPS_H_
#define HAX_CORE_EMULATE_OPS_H_

#include "types.h"

#define FASTOP_ALIGN 0x10
#define FASTOP_OFFSET(size) ( \
((size) == 8) ? (3 * FASTOP_ALIGN) : \
Expand Down
1 change: 0 additions & 1 deletion core/include/ept.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#ifndef HAX_CORE_EPT_H_
#define HAX_CORE_EPT_H_

#include "../../include/hax_types.h"
#include "vm.h"

#define ept_cap_rwX ((uint64_t)1 << 0)
Expand Down
2 changes: 0 additions & 2 deletions core/include/ept2.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
#ifndef HAX_CORE_EPT2_H_
#define HAX_CORE_EPT2_H_

#include "../../include/hax_types.h"
#include "../../include/hax_list.h"
#include "memory.h"
#include "vmx.h"

Expand Down
2 changes: 1 addition & 1 deletion core/include/ia32.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef HAX_CORE_IA32_H_
#define HAX_CORE_IA32_H_

#include "../../include/hax_types.h"
#include "types.h"

union cpuid_args_t;
struct system_desc_t;
Expand Down
2 changes: 1 addition & 1 deletion core/include/ia32_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef HAX_CORE_IA32_DEFS_H_
#define HAX_CORE_IA32_DEFS_H_

#include "../../include/hax_types.h"
#include "types.h"

#define IA32_FXSAVE_SIZE 512

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef HAX_CORE_HAX_CORE_INTERFACE_H_
#define HAX_CORE_HAX_CORE_INTERFACE_H_
#ifndef HAX_CORE_INTERFACE_H_
#define HAX_CORE_INTERFACE_H_

#include "hax.h"

#include "../../include/hax.h"
struct vcpu_t;
struct vm_t;

Expand Down Expand Up @@ -98,4 +99,4 @@ int vcpu_event_pending(struct vcpu_t *vcpu);
}
#endif

#endif // HAX_CORE_HAX_CORE_INTERFACE_H_
#endif // HAX_CORE_INTERFACE_H_
1 change: 0 additions & 1 deletion core/include/intr.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#ifndef HAX_CORE_INTR_H_
#define HAX_CORE_INTR_H_

#include "../../include/hax.h"
#include "vcpu.h"

#define NO_ERROR_CODE ~0U
Expand Down
5 changes: 3 additions & 2 deletions core/include/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
#ifndef HAX_CORE_MEMORY_H_
#define HAX_CORE_MEMORY_H_

#include "../../include/hax_types.h"
#include "../../include/hax_list.h"
#include "hax_list.h"

#include "types.h"

#define HAX_CHUNK_SHIFT 21
#define HAX_CHUNK_SIZE (1U << HAX_CHUNK_SHIFT) // 2MB
Expand Down
3 changes: 3 additions & 0 deletions core/include/page_walker.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
#ifndef HAX_CORE_PAGE_WALKER_H_
#define HAX_CORE_PAGE_WALKER_H_

#include "types.h"
#include "vcpu.h"

typedef uint64_t ADDRESS;

#define ALIGN_BACKWARD(__address, __bytes) \
Expand Down
2 changes: 1 addition & 1 deletion core/include/paging.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifndef HAX_CORE_PAGING_H_
#define HAX_CORE_PAGING_H_

#include "../../include/hax.h"
#include "hax.h"

#define PM_INVALID 0
#define PM_FLAT 1
Expand Down
5 changes: 3 additions & 2 deletions core/include/segments.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
#ifndef HAX_CORE_SEGMENTS_H_
#define HAX_CORE_SEGMENTS_H_

#include "ia32.h"
// TODO: Get rid of is_compatible(), and then delete the following #include
#include "../../include/hax_interface.h"
#include "hax_interface.h"

#include "ia32.h"

#ifdef HAX_COMPILER_MSVC
#pragma pack(push, 1)
Expand Down
2 changes: 1 addition & 1 deletion core/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef HAX_CORE_TYPES_H_
#define HAX_CORE_TYPES_H_

#include "../../include/hax_types.h"
#include "hax_types.h"

#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
Expand Down
7 changes: 3 additions & 4 deletions core/include/vcpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
#ifndef HAX_CORE_VCPU_H_
#define HAX_CORE_VCPU_H_

#include "config.h"
#include "cpuid.h"
#include "emulate.h"
#include "vmx.h"
#include "mtrr.h"
#include "vm.h"
#include "pmu.h"
#include "../../include/hax_interface.h"
#include "config.h"
#include "vm.h"
#include "vmx.h"

#define NR_GMSR 5
#define NR_EMT64MSR 6
Expand Down
Loading