2008-05-04 15:11:44 +02:00
|
|
|
#include "hw/hw.h"
|
|
|
|
#include "hw/boards.h"
|
2009-05-02 00:22:51 +02:00
|
|
|
#include "kvm.h"
|
2008-05-04 15:11:44 +02:00
|
|
|
|
|
|
|
void cpu_save(QEMUFile *f, void *opaque)
|
|
|
|
{
|
2012-03-14 01:38:22 +01:00
|
|
|
CPUPPCState *env = (CPUPPCState *)opaque;
|
2008-12-30 20:01:44 +01:00
|
|
|
unsigned int i, j;
|
|
|
|
|
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
qemu_put_betls(f, &env->gpr[i]);
|
|
|
|
#if !defined(TARGET_PPC64)
|
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
qemu_put_betls(f, &env->gprh[i]);
|
|
|
|
#endif
|
|
|
|
qemu_put_betls(f, &env->lr);
|
|
|
|
qemu_put_betls(f, &env->ctr);
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
qemu_put_be32s(f, &env->crf[i]);
|
|
|
|
qemu_put_betls(f, &env->xer);
|
2009-08-03 17:43:25 +02:00
|
|
|
qemu_put_betls(f, &env->reserve_addr);
|
2008-12-30 20:01:44 +01:00
|
|
|
qemu_put_betls(f, &env->msr);
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
qemu_put_betls(f, &env->tgpr[i]);
|
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
union {
|
|
|
|
float64 d;
|
|
|
|
uint64_t l;
|
|
|
|
} u;
|
|
|
|
u.d = env->fpr[i];
|
|
|
|
qemu_put_be64(f, u.l);
|
|
|
|
}
|
|
|
|
qemu_put_be32s(f, &env->fpscr);
|
|
|
|
qemu_put_sbe32s(f, &env->access_type);
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
qemu_put_betls(f, &env->asr);
|
|
|
|
qemu_put_sbe32s(f, &env->slb_nr);
|
|
|
|
#endif
|
2011-04-01 06:15:15 +02:00
|
|
|
qemu_put_betls(f, &env->spr[SPR_SDR1]);
|
2008-12-30 20:01:44 +01:00
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
qemu_put_betls(f, &env->sr[i]);
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
qemu_put_betls(f, &env->DBAT[i][j]);
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
qemu_put_betls(f, &env->IBAT[i][j]);
|
|
|
|
qemu_put_sbe32s(f, &env->nb_tlb);
|
|
|
|
qemu_put_sbe32s(f, &env->tlb_per_way);
|
|
|
|
qemu_put_sbe32s(f, &env->nb_ways);
|
|
|
|
qemu_put_sbe32s(f, &env->last_way);
|
|
|
|
qemu_put_sbe32s(f, &env->id_tlbs);
|
|
|
|
qemu_put_sbe32s(f, &env->nb_pids);
|
2011-06-17 01:00:28 +02:00
|
|
|
if (env->tlb.tlb6) {
|
2008-12-30 20:01:44 +01:00
|
|
|
// XXX assumes 6xx
|
|
|
|
for (i = 0; i < env->nb_tlb; i++) {
|
2011-06-17 01:00:28 +02:00
|
|
|
qemu_put_betls(f, &env->tlb.tlb6[i].pte0);
|
|
|
|
qemu_put_betls(f, &env->tlb.tlb6[i].pte1);
|
|
|
|
qemu_put_betls(f, &env->tlb.tlb6[i].EPN);
|
2008-12-30 20:01:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
qemu_put_betls(f, &env->pb[i]);
|
|
|
|
for (i = 0; i < 1024; i++)
|
|
|
|
qemu_put_betls(f, &env->spr[i]);
|
|
|
|
qemu_put_be32s(f, &env->vscr);
|
|
|
|
qemu_put_be64s(f, &env->spe_acc);
|
|
|
|
qemu_put_be32s(f, &env->spe_fscr);
|
|
|
|
qemu_put_betls(f, &env->msr_mask);
|
|
|
|
qemu_put_be32s(f, &env->flags);
|
|
|
|
qemu_put_sbe32s(f, &env->error_code);
|
|
|
|
qemu_put_be32s(f, &env->pending_interrupts);
|
|
|
|
qemu_put_be32s(f, &env->irq_input_state);
|
|
|
|
for (i = 0; i < POWERPC_EXCP_NB; i++)
|
|
|
|
qemu_put_betls(f, &env->excp_vectors[i]);
|
|
|
|
qemu_put_betls(f, &env->excp_prefix);
|
2009-04-28 20:00:30 +02:00
|
|
|
qemu_put_betls(f, &env->hreset_excp_prefix);
|
2008-12-30 20:01:44 +01:00
|
|
|
qemu_put_betls(f, &env->ivor_mask);
|
|
|
|
qemu_put_betls(f, &env->ivpr_mask);
|
|
|
|
qemu_put_betls(f, &env->hreset_vector);
|
|
|
|
qemu_put_betls(f, &env->nip);
|
|
|
|
qemu_put_betls(f, &env->hflags);
|
|
|
|
qemu_put_betls(f, &env->hflags_nmsr);
|
|
|
|
qemu_put_sbe32s(f, &env->mmu_idx);
|
2012-09-20 19:42:28 +02:00
|
|
|
qemu_put_sbe32(f, 0);
|
2008-05-04 15:11:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int cpu_load(QEMUFile *f, void *opaque, int version_id)
|
|
|
|
{
|
2012-03-14 01:38:22 +01:00
|
|
|
CPUPPCState *env = (CPUPPCState *)opaque;
|
2008-12-30 20:01:44 +01:00
|
|
|
unsigned int i, j;
|
2011-04-01 06:15:15 +02:00
|
|
|
target_ulong sdr1;
|
2008-12-30 20:01:44 +01:00
|
|
|
|
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
qemu_get_betls(f, &env->gpr[i]);
|
|
|
|
#if !defined(TARGET_PPC64)
|
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
qemu_get_betls(f, &env->gprh[i]);
|
|
|
|
#endif
|
|
|
|
qemu_get_betls(f, &env->lr);
|
|
|
|
qemu_get_betls(f, &env->ctr);
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
qemu_get_be32s(f, &env->crf[i]);
|
|
|
|
qemu_get_betls(f, &env->xer);
|
2009-08-03 17:43:25 +02:00
|
|
|
qemu_get_betls(f, &env->reserve_addr);
|
2008-12-30 20:01:44 +01:00
|
|
|
qemu_get_betls(f, &env->msr);
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
qemu_get_betls(f, &env->tgpr[i]);
|
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
union {
|
|
|
|
float64 d;
|
|
|
|
uint64_t l;
|
|
|
|
} u;
|
|
|
|
u.l = qemu_get_be64(f);
|
|
|
|
env->fpr[i] = u.d;
|
|
|
|
}
|
|
|
|
qemu_get_be32s(f, &env->fpscr);
|
|
|
|
qemu_get_sbe32s(f, &env->access_type);
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
qemu_get_betls(f, &env->asr);
|
|
|
|
qemu_get_sbe32s(f, &env->slb_nr);
|
|
|
|
#endif
|
2011-04-01 06:15:15 +02:00
|
|
|
qemu_get_betls(f, &sdr1);
|
2008-12-30 20:01:44 +01:00
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
qemu_get_betls(f, &env->sr[i]);
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
qemu_get_betls(f, &env->DBAT[i][j]);
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
qemu_get_betls(f, &env->IBAT[i][j]);
|
|
|
|
qemu_get_sbe32s(f, &env->nb_tlb);
|
|
|
|
qemu_get_sbe32s(f, &env->tlb_per_way);
|
|
|
|
qemu_get_sbe32s(f, &env->nb_ways);
|
|
|
|
qemu_get_sbe32s(f, &env->last_way);
|
|
|
|
qemu_get_sbe32s(f, &env->id_tlbs);
|
|
|
|
qemu_get_sbe32s(f, &env->nb_pids);
|
2011-06-17 01:00:28 +02:00
|
|
|
if (env->tlb.tlb6) {
|
2008-12-30 20:01:44 +01:00
|
|
|
// XXX assumes 6xx
|
|
|
|
for (i = 0; i < env->nb_tlb; i++) {
|
2011-06-17 01:00:28 +02:00
|
|
|
qemu_get_betls(f, &env->tlb.tlb6[i].pte0);
|
|
|
|
qemu_get_betls(f, &env->tlb.tlb6[i].pte1);
|
|
|
|
qemu_get_betls(f, &env->tlb.tlb6[i].EPN);
|
2008-12-30 20:01:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
qemu_get_betls(f, &env->pb[i]);
|
|
|
|
for (i = 0; i < 1024; i++)
|
|
|
|
qemu_get_betls(f, &env->spr[i]);
|
2011-04-01 06:15:15 +02:00
|
|
|
ppc_store_sdr1(env, sdr1);
|
2008-12-30 20:01:44 +01:00
|
|
|
qemu_get_be32s(f, &env->vscr);
|
|
|
|
qemu_get_be64s(f, &env->spe_acc);
|
|
|
|
qemu_get_be32s(f, &env->spe_fscr);
|
|
|
|
qemu_get_betls(f, &env->msr_mask);
|
|
|
|
qemu_get_be32s(f, &env->flags);
|
|
|
|
qemu_get_sbe32s(f, &env->error_code);
|
|
|
|
qemu_get_be32s(f, &env->pending_interrupts);
|
|
|
|
qemu_get_be32s(f, &env->irq_input_state);
|
|
|
|
for (i = 0; i < POWERPC_EXCP_NB; i++)
|
|
|
|
qemu_get_betls(f, &env->excp_vectors[i]);
|
|
|
|
qemu_get_betls(f, &env->excp_prefix);
|
2009-04-28 20:00:30 +02:00
|
|
|
qemu_get_betls(f, &env->hreset_excp_prefix);
|
2008-12-30 20:01:44 +01:00
|
|
|
qemu_get_betls(f, &env->ivor_mask);
|
|
|
|
qemu_get_betls(f, &env->ivpr_mask);
|
|
|
|
qemu_get_betls(f, &env->hreset_vector);
|
|
|
|
qemu_get_betls(f, &env->nip);
|
|
|
|
qemu_get_betls(f, &env->hflags);
|
|
|
|
qemu_get_betls(f, &env->hflags_nmsr);
|
|
|
|
qemu_get_sbe32s(f, &env->mmu_idx);
|
2012-09-20 19:42:28 +02:00
|
|
|
qemu_get_sbe32(f); /* Discard unused power_mode */
|
2008-12-30 20:01:44 +01:00
|
|
|
|
2008-05-04 15:11:44 +02:00
|
|
|
return 0;
|
|
|
|
}
|