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

Commit f40dfd2

Browse files
authored
Merge pull request #141 from insidiaGithub/master
Changed vm_mid_bits and VM_MID_BIT variable to 64
2 parents 98c8126 + b67b94a commit f40dfd2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

core/include/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,7 @@ struct config_t {
6565
};
6666

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

6971
#endif // HAX_CORE_CONFIG_H_

core/vm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
#include "include/hax_core_interface.h"
3636
#include "include/ept.h"
3737
#include "include/paging.h"
38+
#include "include/config.h"
3839

39-
static uint8_t vm_mid_bits = 0;
40-
#define VM_MID_BIT 8
40+
static uint64_t vm_mid_bits = 0;
4141

4242
#ifdef HAX_ARCH_X86_32
4343
static void gpfn_to_hva_recycle_total(struct vm_t *vm, uint64_t cr3_cur,
@@ -48,7 +48,7 @@ static int get_free_vm_mid(void)
4848
{
4949
int i;
5050

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

6565
static int valid_vm_mid(int vm_id)
6666
{
67-
return (vm_id >= 0) && (vm_id < VM_MID_BIT);
67+
return (vm_id >= 0) && (vm_id < HAX_MAX_VMS);
6868
}
6969

7070
int hax_vm_set_qemuversion(struct vm_t *vm, struct hax_qemu_version *ver)

0 commit comments

Comments
 (0)