On 03/06/2015 19:37, Paolo Bonzini wrote:
Since Michael said he'd merge this version, there's just one thing I
would change. You can access the region only one byte at a time, and
let the memory core fix endianness here:
I've applied the change offered below. Thanks.
There are two unanswered questions:
1. You wrote that I should not use the memory_region_init_io() function.
Should I use memory_region_init_ram() instead?
2. Is it possible to create a sysbus device using the "-device" command
line argument? I vaguely recall that it is not possible to do it and
that's the reason that I specifically add the device in the pc init.
Thanks,
Gal.
On 27/04/2015 13:19, Gal Hammer wrote:
+static uint64_t vmgenid_ram_read(void *opaque, hwaddr addr,
+ unsigned size)
+{
+ VmGenIdState *s = VMGENID(opaque);
+ uint64_t value;
+
+ memcpy(&value, s->guid + addr, size);
value = s->guid[addr];
+ return value;
+}
+
+static const MemoryRegionOps vmgenid_ram_ops = {
+ .read = vmgenid_ram_read,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
And instead of this .valid declaration, use this:
.valid.min_access_size = 1,
.valid.max_access_size = 4,
.impl.min_access_size = 1,
.impl.max_access_size = 1,
+ .endianness = DEVICE_NATIVE_ENDIAN,
.endianness = DEVICE_LITTLE_ENDIAN
+};
Thanks,
Paolo