Commit ac9eb0731ad123f8789005978500ac67026188c2
1 parent
9a64fbe4
suppressed explicit access type and use the exception routine to infer it from the micro operation
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@529 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
41 additions
and
46 deletions
target-ppc/cpu.h
... | ... | @@ -153,6 +153,8 @@ typedef struct CPUPPCState { |
153 | 153 | jmp_buf jmp_env; |
154 | 154 | int exception_index; |
155 | 155 | int error_code; |
156 | + int access_type; /* when a memory exception occurs, the access | |
157 | + type is stored here */ | |
156 | 158 | uint32_t exceptions; /* exception queue */ |
157 | 159 | uint32_t errors[16]; |
158 | 160 | int user_mode_only; /* user mode only simulation */ | ... | ... |
target-ppc/helper.c
... | ... | @@ -512,7 +512,7 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, |
512 | 512 | |
513 | 513 | // printf("%s 0\n", __func__); |
514 | 514 | is_user = flags & 0x01; |
515 | - access_type = flags & ~0x01; | |
515 | + access_type = env->access_type; | |
516 | 516 | if (env->user_mode_only) { |
517 | 517 | /* user mode only emulation */ |
518 | 518 | ret = -1; | ... | ... |
target-ppc/op_helper_mem.h
... | ... | @@ -8,14 +8,14 @@ void glue(do_lsw, MEMSUFFIX) (int dst) |
8 | 8 | __func__, T0, T1, dst); |
9 | 9 | } |
10 | 10 | for (; T1 > 3; T1 -= 4, T0 += 4) { |
11 | - ugpr(dst++) = glue(_ldl, MEMSUFFIX)((void *)T0, ACCESS_INT); | |
11 | + ugpr(dst++) = glue(ldl, MEMSUFFIX)((void *)T0); | |
12 | 12 | if (dst == 32) |
13 | 13 | dst = 0; |
14 | 14 | } |
15 | 15 | if (T1 > 0) { |
16 | 16 | tmp = 0; |
17 | 17 | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) { |
18 | - tmp |= glue(_ldub, MEMSUFFIX)((void *)T0, ACCESS_INT) << sh; | |
18 | + tmp |= glue(ldub, MEMSUFFIX)((void *)T0) << sh; | |
19 | 19 | } |
20 | 20 | ugpr(dst) = tmp; |
21 | 21 | } |
... | ... | @@ -30,14 +30,13 @@ void glue(do_stsw, MEMSUFFIX) (int src) |
30 | 30 | __func__, T0, T1, src); |
31 | 31 | } |
32 | 32 | for (; T1 > 3; T1 -= 4, T0 += 4) { |
33 | - glue(_stl, MEMSUFFIX)((void *)T0, ugpr(src++), ACCESS_INT); | |
33 | + glue(stl, MEMSUFFIX)((void *)T0, ugpr(src++)); | |
34 | 34 | if (src == 32) |
35 | 35 | src = 0; |
36 | 36 | } |
37 | 37 | if (T1 > 0) { |
38 | 38 | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) |
39 | - glue(_stb, MEMSUFFIX)((void *)T0, (ugpr(src) >> sh) & 0xFF, | |
40 | - ACCESS_INT); | |
39 | + glue(stb, MEMSUFFIX)((void *)T0, (ugpr(src) >> sh) & 0xFF); | |
41 | 40 | } |
42 | 41 | } |
43 | 42 | ... | ... |
target-ppc/op_mem.h
... | ... | @@ -2,68 +2,62 @@ |
2 | 2 | void glue(do_lsw, MEMSUFFIX) (int dst); |
3 | 3 | void glue(do_stsw, MEMSUFFIX) (int src); |
4 | 4 | |
5 | -/* Internal helpers for sign extension and byte-reverse */ | |
6 | -static inline uint32_t glue(_ld16x, MEMSUFFIX) (void *EA, int type) | |
5 | +static inline uint16_t glue(ld16r, MEMSUFFIX) (void *EA) | |
7 | 6 | { |
8 | - return s_ext16(glue(_lduw, MEMSUFFIX)(EA, type)); | |
9 | -} | |
10 | - | |
11 | -static inline uint16_t glue(_ld16r, MEMSUFFIX) (void *EA, int type) | |
12 | -{ | |
13 | - uint16_t tmp = glue(_lduw, MEMSUFFIX)(EA, type); | |
7 | + uint16_t tmp = glue(lduw, MEMSUFFIX)(EA); | |
14 | 8 | return ((tmp & 0xFF00) >> 8) | ((tmp & 0x00FF) << 8); |
15 | 9 | } |
16 | 10 | |
17 | -static inline uint32_t glue(_ld32r, MEMSUFFIX) (void *EA, int type) | |
11 | +static inline uint32_t glue(ld32r, MEMSUFFIX) (void *EA) | |
18 | 12 | { |
19 | - uint32_t tmp = glue(_ldl, MEMSUFFIX)(EA, type); | |
13 | + uint32_t tmp = glue(ldl, MEMSUFFIX)(EA); | |
20 | 14 | return ((tmp & 0xFF000000) >> 24) | ((tmp & 0x00FF0000) >> 8) | |
21 | 15 | ((tmp & 0x0000FF00) << 8) | ((tmp & 0x000000FF) << 24); |
22 | 16 | } |
23 | 17 | |
24 | -static inline void glue(_st16r, MEMSUFFIX) (void *EA, uint16_t data, int type) | |
18 | +static inline void glue(st16r, MEMSUFFIX) (void *EA, uint16_t data) | |
25 | 19 | { |
26 | 20 | uint16_t tmp = ((data & 0xFF00) >> 8) | ((data & 0x00FF) << 8); |
27 | - glue(_stw, MEMSUFFIX)(EA, tmp, type); | |
21 | + glue(stw, MEMSUFFIX)(EA, tmp); | |
28 | 22 | } |
29 | 23 | |
30 | -static inline void glue(_st32r, MEMSUFFIX) (void *EA, uint32_t data, int type) | |
24 | +static inline void glue(st32r, MEMSUFFIX) (void *EA, uint32_t data) | |
31 | 25 | { |
32 | 26 | uint32_t tmp = ((data & 0xFF000000) >> 24) | ((data & 0x00FF0000) >> 8) | |
33 | 27 | ((data & 0x0000FF00) << 8) | ((data & 0x000000FF) << 24); |
34 | - glue(_stl, MEMSUFFIX)(EA, tmp, type); | |
28 | + glue(stl, MEMSUFFIX)(EA, tmp); | |
35 | 29 | } |
36 | 30 | |
37 | 31 | /*** Integer load ***/ |
38 | 32 | #define PPC_LD_OP(name, op) \ |
39 | 33 | PPC_OP(glue(glue(l, name), MEMSUFFIX)) \ |
40 | 34 | { \ |
41 | - T1 = glue(op, MEMSUFFIX)((void *)T0, ACCESS_INT); \ | |
35 | + T1 = glue(op, MEMSUFFIX)((void *)T0); \ | |
42 | 36 | RETURN(); \ |
43 | 37 | } |
44 | 38 | |
45 | 39 | #define PPC_ST_OP(name, op) \ |
46 | 40 | PPC_OP(glue(glue(st, name), MEMSUFFIX)) \ |
47 | 41 | { \ |
48 | - glue(op, MEMSUFFIX)((void *)T0, T1, ACCESS_INT); \ | |
42 | + glue(op, MEMSUFFIX)((void *)T0, T1); \ | |
49 | 43 | RETURN(); \ |
50 | 44 | } |
51 | 45 | |
52 | -PPC_LD_OP(bz, _ldub); | |
53 | -PPC_LD_OP(ha, _ld16x); | |
54 | -PPC_LD_OP(hz, _lduw); | |
55 | -PPC_LD_OP(wz, _ldl); | |
46 | +PPC_LD_OP(bz, ldub); | |
47 | +PPC_LD_OP(ha, ldsw); | |
48 | +PPC_LD_OP(hz, lduw); | |
49 | +PPC_LD_OP(wz, ldl); | |
56 | 50 | |
57 | 51 | /*** Integer store ***/ |
58 | -PPC_ST_OP(b, _stb); | |
59 | -PPC_ST_OP(h, _stw); | |
60 | -PPC_ST_OP(w, _stl); | |
52 | +PPC_ST_OP(b, stb); | |
53 | +PPC_ST_OP(h, stw); | |
54 | +PPC_ST_OP(w, stl); | |
61 | 55 | |
62 | 56 | /*** Integer load and store with byte reverse ***/ |
63 | -PPC_LD_OP(hbr, _ld16r); | |
64 | -PPC_LD_OP(wbr, _ld32r); | |
65 | -PPC_ST_OP(hbr, _st16r); | |
66 | -PPC_ST_OP(wbr, _st32r); | |
57 | +PPC_LD_OP(hbr, ld16r); | |
58 | +PPC_LD_OP(wbr, ld32r); | |
59 | +PPC_ST_OP(hbr, st16r); | |
60 | +PPC_ST_OP(wbr, st32r); | |
67 | 61 | |
68 | 62 | /*** Integer load and store multiple ***/ |
69 | 63 | PPC_OP(glue(lmw, MEMSUFFIX)) |
... | ... | @@ -71,7 +65,7 @@ PPC_OP(glue(lmw, MEMSUFFIX)) |
71 | 65 | int dst = PARAM(1); |
72 | 66 | |
73 | 67 | for (; dst < 32; dst++, T0 += 4) { |
74 | - ugpr(dst) = glue(_ldl, MEMSUFFIX)((void *)T0, ACCESS_INT); | |
68 | + ugpr(dst) = glue(ldl, MEMSUFFIX)((void *)T0); | |
75 | 69 | } |
76 | 70 | RETURN(); |
77 | 71 | } |
... | ... | @@ -81,7 +75,7 @@ PPC_OP(glue(stmw, MEMSUFFIX)) |
81 | 75 | int src = PARAM(1); |
82 | 76 | |
83 | 77 | for (; src < 32; src++, T0 += 4) { |
84 | - glue(_stl, MEMSUFFIX)((void *)T0, ugpr(src), ACCESS_INT); | |
78 | + glue(stl, MEMSUFFIX)((void *)T0, ugpr(src)); | |
85 | 79 | } |
86 | 80 | RETURN(); |
87 | 81 | } |
... | ... | @@ -150,7 +144,7 @@ PPC_OP(glue(stwcx, MEMSUFFIX)) |
150 | 144 | if (regs->reserve != T0) { |
151 | 145 | env->crf[0] = xer_ov; |
152 | 146 | } else { |
153 | - glue(_stl, MEMSUFFIX)((void *)T0, T1, ACCESS_RES); | |
147 | + glue(stl, MEMSUFFIX)((void *)T0, T1); | |
154 | 148 | env->crf[0] = xer_ov | 0x02; |
155 | 149 | } |
156 | 150 | } |
... | ... | @@ -160,27 +154,27 @@ PPC_OP(glue(stwcx, MEMSUFFIX)) |
160 | 154 | |
161 | 155 | PPC_OP(glue(dcbz, MEMSUFFIX)) |
162 | 156 | { |
163 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x00), 0, ACCESS_INT); | |
164 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x04), 0, ACCESS_INT); | |
165 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x08), 0, ACCESS_INT); | |
166 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x0C), 0, ACCESS_INT); | |
167 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x10), 0, ACCESS_INT); | |
168 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x14), 0, ACCESS_INT); | |
169 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x18), 0, ACCESS_INT); | |
170 | - glue(_stl, MEMSUFFIX)((void *)(T0 + 0x1C), 0, ACCESS_INT); | |
157 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x00), 0); | |
158 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x04), 0); | |
159 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x08), 0); | |
160 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x0C), 0); | |
161 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x10), 0); | |
162 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x14), 0); | |
163 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x18), 0); | |
164 | + glue(stl, MEMSUFFIX)((void *)(T0 + 0x1C), 0); | |
171 | 165 | RETURN(); |
172 | 166 | } |
173 | 167 | |
174 | 168 | /* External access */ |
175 | 169 | PPC_OP(glue(eciwx, MEMSUFFIX)) |
176 | 170 | { |
177 | - T1 = glue(_ldl, MEMSUFFIX)((void *)T0, ACCESS_EXT); | |
171 | + T1 = glue(ldl, MEMSUFFIX)((void *)T0); | |
178 | 172 | RETURN(); |
179 | 173 | } |
180 | 174 | |
181 | 175 | PPC_OP(glue(ecowx, MEMSUFFIX)) |
182 | 176 | { |
183 | - glue(_stl, MEMSUFFIX)((void *)T0, T1, ACCESS_EXT); | |
177 | + glue(stl, MEMSUFFIX)((void *)T0, T1); | |
184 | 178 | RETURN(); |
185 | 179 | } |
186 | 180 | ... | ... |