Hi Guan, > +void cpu_save(QEMUFile *f, void *opaque) > +{ > + int i; > + CPUUniCore32State *env = (CPUUniCore32State *)opaque; > + > + for (i = 0; i < 32; i++) { > + qemu_put_be32(f, env->regs[i]); > + } > + qemu_put_be32(f, cpu_asr_read(env)); > + qemu_put_be32(f, env->bsr); > + for (i = 0; i < 6; i++) { > + qemu_put_be32(f, env->banked_bsr[i]); > + qemu_put_be32(f, env->banked_r29[i]); > + qemu_put_be32(f, env->banked_r30[i]); > + } > + > + qemu_put_be32(f, env->cp0.c0_cpuid); > + qemu_put_be32(f, env->cp0.c0_cachetype); > + qemu_put_be32(f, env->cp0.c1_sys); > + qemu_put_be32(f, env->cp0.c2_base); > + qemu_put_be32(f, env->cp0.c3_faultstatus); > + qemu_put_be32(f, env->cp0.c4_faultaddr); > + qemu_put_be32(f, env->cp0.c5_cacheop); > + qemu_put_be32(f, env->cp0.c6_tlbop); > + > + qemu_put_be32(f, env->features); > + > + if (env->features & UC32_HWCAP_UCF64) { > + for (i = 0; i < 16; i++) { > + CPU_DoubleU u; > + u.d = env->ucf64.regs[i]; > + qemu_put_be32(f, u.l.upper); > + qemu_put_be32(f, u.l.lower); > + } > + for (i = 0; i < 32; i++) { > + qemu_put_be32(f, env->ucf64.xregs[i]); > + } > + } > +}
Do you think use VMState rather then QEMUFile is a good idea? I saw OpenRISC target got this kind of feedback before [1]. Regards, chenwj [1] http://lists.gnu.org/archive/html/qemu-devel/2012-05/msg02457.html -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj