s390x: Prepare cpu.h for emulation

We need to add some more logic to the CPU description to leverage emulation
of an s390x CPU. This patch adds all the required helpers, fields in CPUState
and constant definitions required for user and system emulation.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Alexander Graf 2011-04-15 17:32:47 +02:00 committed by Aurelien Jarno
parent 7b59220ef3
commit bcec36eaa0
4 changed files with 864 additions and 179 deletions

View File

@ -82,7 +82,7 @@ CPUState *s390_cpu_addr2state(uint16_t cpu_addr)
return ipi_states[cpu_addr];
}
int s390_virtio_hypercall(CPUState *env)
int s390_virtio_hypercall(CPUState *env, uint64_t mem_, uint64_t hypercall)
{
int r = 0, i;
target_ulong mem = env->regs[2];

File diff suppressed because it is too large Load Diff

View File

@ -182,8 +182,8 @@ int kvm_arch_process_async_events(CPUState *env)
return 0;
}
static void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
uint64_t parm64, int vm)
void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
uint64_t parm64, int vm)
{
struct kvm_s390_interrupt kvmint;
int r;
@ -218,7 +218,7 @@ void kvm_s390_virtio_irq(CPUState *env, int config_change, uint64_t token)
token, 1);
}
static void kvm_s390_interrupt(CPUState *env, int type, uint32_t code)
void kvm_s390_interrupt(CPUState *env, int type, uint32_t code)
{
kvm_s390_interrupt_internal(env, type, code, 0, 0);
}
@ -237,7 +237,8 @@ static void setcc(CPUState *env, uint64_t cc)
env->psw.mask |= (cc & 3) << 44;
}
static int sclp_service_call(CPUState *env, struct kvm_run *run, uint16_t ipbh0)
static int kvm_sclp_service_call(CPUState *env, struct kvm_run *run,
uint16_t ipbh0)
{
uint32_t sccb;
uint64_t code;
@ -287,7 +288,7 @@ static int handle_priv(CPUState *env, struct kvm_run *run, uint8_t ipa1)
dprintf("KVM: PRIV: %d\n", ipa1);
switch (ipa1) {
case PRIV_SCLP_CALL:
r = sclp_service_call(env, run, ipbh0);
r = kvm_sclp_service_call(env, run, ipbh0);
break;
default:
dprintf("KVM: unknown PRIV: 0x%x\n", ipa1);
@ -300,12 +301,10 @@ static int handle_priv(CPUState *env, struct kvm_run *run, uint8_t ipa1)
static int handle_hypercall(CPUState *env, struct kvm_run *run)
{
int r;
cpu_synchronize_state(env);
r = s390_virtio_hypercall(env);
env->regs[2] = s390_virtio_hypercall(env, env->regs[2], env->regs[1]);
return r;
return 0;
}
static int handle_diag(CPUState *env, struct kvm_run *run, int ipb_code)

View File

@ -36,7 +36,7 @@ void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
}
}
for (i = 0; i < 16; i++) {
cpu_fprintf(f, "F%02d=%016lx", i, (long)env->fregs[i].i);
cpu_fprintf(f, "F%02d=%016" PRIx64, i, *(uint64_t *)&env->fregs[i]);
if ((i % 4) == 3) {
cpu_fprintf(f, "\n");
} else {