diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h index 6543b35..327a1ab 100644 --- a/include/kvm/kvm.h +++ b/include/kvm/kvm.h @@ -7,6 +7,8 @@ #include #include +#define KVM_NR_CPUS (255) + struct kvm { int sys_fd; /* For system ioctls(), i.e. /dev/kvm */ int vm_fd; /* For VM ioctls() */ diff --git a/kvm-run.c b/kvm-run.c index aa0f248..13e7662 100644 --- a/kvm-run.c +++ b/kvm-run.c @@ -40,8 +40,6 @@ #define MIN_RAM_SIZE_MB (64ULL) #define MIN_RAM_SIZE_BYTE (MIN_RAM_SIZE_MB << MB_SHIFT) -#define KVM_NR_CPUS (255) - static struct kvm *kvm; static struct kvm_cpu *kvm_cpus[KVM_NR_CPUS]; static __thread struct kvm_cpu *current_kvm_cpu; diff --git a/mptable.c b/mptable.c index 368db65..5bbe7ea 100644 --- a/mptable.c +++ b/mptable.c @@ -6,6 +6,14 @@ #include +/* + * If kernel is not configured yet this macro + * might not be defined, fix it by own definition + */ +#ifndef NR_CPUS +#define NR_CPUS KVM_NR_CPUS +#endif + #include /*