Skip to content
This repository was archived by the owner on Jan 28, 2023. It is now read-only.
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
2 changes: 2 additions & 0 deletions core/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,7 @@ struct config_t {
};

#define HAX_MAX_VCPUS 16
// Matches the number of bits in vm_mid_bits (see vm.c)
#define HAX_MAX_VMS 64

#endif // HAX_CORE_CONFIG_H_
8 changes: 4 additions & 4 deletions core/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
#include "include/hax_core_interface.h"
#include "include/ept.h"
#include "include/paging.h"
#include "include/config.h"

static uint8_t vm_mid_bits = 0;
#define VM_MID_BIT 8
static uint64_t vm_mid_bits = 0;

#ifdef HAX_ARCH_X86_32
static void gpfn_to_hva_recycle_total(struct vm_t *vm, uint64_t cr3_cur,
Expand All @@ -48,7 +48,7 @@ static int get_free_vm_mid(void)
{
int i;

for (i = 0; i < VM_MID_BIT; i++) {
for (i = 0; i < HAX_MAX_VMS; i++) {
if (!hax_test_and_set_bit(i, (uint64_t *)&vm_mid_bits))
return i;
}
Expand All @@ -64,7 +64,7 @@ static void hax_put_vm_mid(int id)

static int valid_vm_mid(int vm_id)
{
return (vm_id >= 0) && (vm_id < VM_MID_BIT);
return (vm_id >= 0) && (vm_id < HAX_MAX_VMS);
}

int hax_vm_set_qemuversion(struct vm_t *vm, struct hax_qemu_version *ver)
Expand Down