mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-06-16 02:15:47 +00:00
kvm: Ignore MMIO accesses
Lets cheat some more and ignore MMIO accesses altogether. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
9c5783b1f9
commit
29443dabe7
@@ -14,9 +14,10 @@ OBJS += interrupt.o
|
||||
OBJS += ioport.o
|
||||
OBJS += kvm.o
|
||||
OBJS += main.o
|
||||
OBJS += mmio.o
|
||||
OBJS += util.o
|
||||
OBJS += bios/c-intfake.o
|
||||
OBJS += bios/c-int10.o
|
||||
OBJS += bios/c-intfake.o
|
||||
|
||||
CFLAGS += $(CPPFLAGS) -Iinclude -g
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename, const char *
|
||||
void kvm__reset_vcpu(struct kvm *self);
|
||||
void kvm__run(struct kvm *self);
|
||||
bool kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count);
|
||||
bool kvm__emulate_mmio(struct kvm *self, uint64_t phys_addr, uint8_t *data, uint32_t len, uint8_t is_write);
|
||||
|
||||
/*
|
||||
* Debugging
|
||||
|
||||
@@ -80,6 +80,20 @@ int main(int argc, char *argv[])
|
||||
goto exit_kvm;
|
||||
break;
|
||||
}
|
||||
case KVM_EXIT_MMIO: {
|
||||
bool ret;
|
||||
|
||||
ret = kvm__emulate_mmio(kvm,
|
||||
kvm->kvm_run->mmio.phys_addr,
|
||||
kvm->kvm_run->mmio.data,
|
||||
kvm->kvm_run->mmio.len,
|
||||
kvm->kvm_run->mmio.is_write);
|
||||
|
||||
if (!ret)
|
||||
goto exit_kvm;
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
goto exit_kvm;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "kvm/kvm.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static const char *to_direction(uint8_t is_write)
|
||||
{
|
||||
if (is_write)
|
||||
return "write";
|
||||
|
||||
return "read";
|
||||
}
|
||||
|
||||
bool kvm__emulate_mmio(struct kvm *self, uint64_t phys_addr, uint8_t *data, uint32_t len, uint8_t is_write)
|
||||
{
|
||||
fprintf(stderr, "Warning: Ignoring MMIO %s at %016" PRIx64 " (length %" PRIu32 ")\n",
|
||||
to_direction(is_write), phys_addr, len);
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user