Am 01.08.2013 16:12, schrieb Jason J. Herne:
From: "Jason J. Herne" <address@hidden>
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index 439d732..21e9124 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -123,6 +123,18 @@ static void s390_virtio_register_hcalls(void)
s390_virtio_hcall_set_status);
}
+static uint8_t *storage_keys;
+
+uint8_t *s390_get_storage_keys(void)
+{
+ return storage_keys;
+}
+
+void s390_alloc_storage_keys(ram_addr_t ram_size)
+{
+ storage_keys = g_malloc0(ram_size / TARGET_PAGE_SIZE);
+}
+
/*
* The number of running CPUs. On s390 a shutdown is the state of all CPUs
* being either stopped or disabled (for interrupts) waiting. We have to
@@ -176,7 +188,7 @@ void s390_init_ipl_dev(const char *kernel_filename,
qdev_init_nofail(dev);
}
-void s390_init_cpus(const char *cpu_model, uint8_t *storage_keys)
+void s390_init_cpus(const char *cpu_model)
{
int i;
@@ -196,7 +208,7 @@ void s390_init_cpus(const char *cpu_model, uint8_t
*storage_keys)
ipi_states[i] = cpu;
cs->halted = 1;
cpu->env.exception_index = EXCP_HLT;
- cpu->env.storage_keys = storage_keys;
+ cpu->env.storage_keys = s390_get_storage_keys();
Why not go this from the CPU initfn? Is there any ccw- vs. non-ccw
difference? Thinking about -device s390-cpu here. I believe it's safe to
assume that machine init and thus allocation has run before the CPU is
instantiated - possibly assert that.