Commit 877d8ad78bfeade699af313e1f7793743dc48a08
1 parent
5ef98b47
CRIS: Add (untested) cpu-state save/load.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4721 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
89 additions
and
1 deletions
hw/etraxfs.c
... | ... | @@ -67,7 +67,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, |
67 | 67 | cpu_model = "crisv32"; |
68 | 68 | } |
69 | 69 | env = cpu_init(cpu_model); |
70 | -/* register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); */ | |
70 | + register_savevm("cpu", 0, 1, cpu_save, cpu_load, env); | |
71 | 71 | qemu_register_reset(main_cpu_reset, env); |
72 | 72 | |
73 | 73 | /* allocate RAM */ | ... | ... |
target-cris/machine.c
... | ... | @@ -5,3 +5,91 @@ void register_machines(void) |
5 | 5 | { |
6 | 6 | qemu_register_machine(&bareetraxfs_machine); |
7 | 7 | } |
8 | + | |
9 | +void cpu_save(QEMUFile *f, void *opaque) | |
10 | +{ | |
11 | + CPUCRISState *env = opaque; | |
12 | + int i; | |
13 | + int s; | |
14 | + int mmu; | |
15 | + | |
16 | + for (i = 0; i < 16; i++) | |
17 | + qemu_put_be32(f, env->regs[i]); | |
18 | + for (i = 0; i < 16; i++) | |
19 | + qemu_put_be32(f, env->pregs[i]); | |
20 | + | |
21 | + qemu_put_be32(f, env->pc); | |
22 | + qemu_put_be32(f, env->ksp); | |
23 | + | |
24 | + qemu_put_be32(f, env->dslot); | |
25 | + qemu_put_be32(f, env->btaken); | |
26 | + qemu_put_be32(f, env->btarget); | |
27 | + | |
28 | + qemu_put_be32(f, env->cc_op); | |
29 | + qemu_put_be32(f, env->cc_mask); | |
30 | + qemu_put_be32(f, env->cc_dest); | |
31 | + qemu_put_be32(f, env->cc_src); | |
32 | + qemu_put_be32(f, env->cc_result); | |
33 | + qemu_put_be32(f, env->cc_size); | |
34 | + qemu_put_be32(f, env->cc_x); | |
35 | + | |
36 | + for (s = 0; s < 4; i++) { | |
37 | + for (i = 0; i < 16; i++) | |
38 | + qemu_put_be32(f, env->sregs[s][i]); | |
39 | + } | |
40 | + | |
41 | + qemu_put_be32(f, env->mmu_rand_lfsr); | |
42 | + for (mmu = 0; mmu < 2; mmu++) { | |
43 | + for (s = 0; s < 4; i++) { | |
44 | + for (i = 0; i < 16; i++) { | |
45 | + qemu_put_be32(f, env->tlbsets[mmu][s][i].lo); | |
46 | + qemu_put_be32(f, env->tlbsets[mmu][s][i].hi); | |
47 | + } | |
48 | + } | |
49 | + } | |
50 | +} | |
51 | + | |
52 | +int cpu_load(QEMUFile *f, void *opaque, int version_id) | |
53 | +{ | |
54 | + CPUCRISState *env = opaque; | |
55 | + int i; | |
56 | + int s; | |
57 | + int mmu; | |
58 | + | |
59 | + for (i = 0; i < 16; i++) | |
60 | + env->regs[i] = qemu_get_be32(f); | |
61 | + for (i = 0; i < 16; i++) | |
62 | + env->pregs[i] = qemu_get_be32(f); | |
63 | + | |
64 | + env->pc = qemu_get_be32(f); | |
65 | + env->ksp = qemu_get_be32(f); | |
66 | + | |
67 | + env->dslot = qemu_get_be32(f); | |
68 | + env->btaken = qemu_get_be32(f); | |
69 | + env->btarget = qemu_get_be32(f); | |
70 | + | |
71 | + env->cc_op = qemu_get_be32(f); | |
72 | + env->cc_mask = qemu_get_be32(f); | |
73 | + env->cc_dest = qemu_get_be32(f); | |
74 | + env->cc_src = qemu_get_be32(f); | |
75 | + env->cc_result = qemu_get_be32(f); | |
76 | + env->cc_size = qemu_get_be32(f); | |
77 | + env->cc_x = qemu_get_be32(f); | |
78 | + | |
79 | + for (s = 0; s < 4; i++) { | |
80 | + for (i = 0; i < 16; i++) | |
81 | + env->sregs[s][i] = qemu_get_be32(f); | |
82 | + } | |
83 | + | |
84 | + env->mmu_rand_lfsr = qemu_get_be32(f); | |
85 | + for (mmu = 0; mmu < 2; mmu++) { | |
86 | + for (s = 0; s < 4; i++) { | |
87 | + for (i = 0; i < 16; i++) { | |
88 | + env->tlbsets[mmu][s][i].lo = qemu_get_be32(f); | |
89 | + env->tlbsets[mmu][s][i].hi = qemu_get_be32(f); | |
90 | + } | |
91 | + } | |
92 | + } | |
93 | + | |
94 | + return 0; | |
95 | +} | ... | ... |