root / target-mips / op_mem.c @ d796321b
History | View | Annotate | Download (3.1 kB)
1 | 6af0bf9c | bellard | /*
|
---|---|---|---|
2 | 6af0bf9c | bellard | * MIPS emulation memory micro-operations for qemu.
|
3 | 6af0bf9c | bellard | *
|
4 | 6af0bf9c | bellard | * Copyright (c) 2004-2005 Jocelyn Mayer
|
5 | 6af0bf9c | bellard | *
|
6 | 6af0bf9c | bellard | * This library is free software; you can redistribute it and/or
|
7 | 6af0bf9c | bellard | * modify it under the terms of the GNU Lesser General Public
|
8 | 6af0bf9c | bellard | * License as published by the Free Software Foundation; either
|
9 | 6af0bf9c | bellard | * version 2 of the License, or (at your option) any later version.
|
10 | 6af0bf9c | bellard | *
|
11 | 6af0bf9c | bellard | * This library is distributed in the hope that it will be useful,
|
12 | 6af0bf9c | bellard | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 6af0bf9c | bellard | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 6af0bf9c | bellard | * Lesser General Public License for more details.
|
15 | 6af0bf9c | bellard | *
|
16 | 6af0bf9c | bellard | * You should have received a copy of the GNU Lesser General Public
|
17 | 6af0bf9c | bellard | * License along with this library; if not, write to the Free Software
|
18 | 6af0bf9c | bellard | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | 6af0bf9c | bellard | */
|
20 | 6af0bf9c | bellard | |
21 | 6af0bf9c | bellard | /* Standard loads and stores */
|
22 | 6af0bf9c | bellard | void glue(op_lb, MEMSUFFIX) (void) |
23 | 6af0bf9c | bellard | { |
24 | 6af0bf9c | bellard | T0 = glue(ldsb, MEMSUFFIX)(T0); |
25 | 6af0bf9c | bellard | RETURN(); |
26 | 6af0bf9c | bellard | } |
27 | 6af0bf9c | bellard | |
28 | 6af0bf9c | bellard | void glue(op_lbu, MEMSUFFIX) (void) |
29 | 6af0bf9c | bellard | { |
30 | 6af0bf9c | bellard | T0 = glue(ldub, MEMSUFFIX)(T0); |
31 | 6af0bf9c | bellard | RETURN(); |
32 | 6af0bf9c | bellard | } |
33 | 6af0bf9c | bellard | |
34 | 6af0bf9c | bellard | void glue(op_sb, MEMSUFFIX) (void) |
35 | 6af0bf9c | bellard | { |
36 | 6af0bf9c | bellard | glue(stb, MEMSUFFIX)(T0, T1); |
37 | 6af0bf9c | bellard | RETURN(); |
38 | 6af0bf9c | bellard | } |
39 | 6af0bf9c | bellard | |
40 | 6af0bf9c | bellard | void glue(op_lh, MEMSUFFIX) (void) |
41 | 6af0bf9c | bellard | { |
42 | 6af0bf9c | bellard | T0 = glue(ldsw, MEMSUFFIX)(T0); |
43 | 6af0bf9c | bellard | RETURN(); |
44 | 6af0bf9c | bellard | } |
45 | 6af0bf9c | bellard | |
46 | 6af0bf9c | bellard | void glue(op_lhu, MEMSUFFIX) (void) |
47 | 6af0bf9c | bellard | { |
48 | 6af0bf9c | bellard | T0 = glue(lduw, MEMSUFFIX)(T0); |
49 | 6af0bf9c | bellard | RETURN(); |
50 | 6af0bf9c | bellard | } |
51 | 6af0bf9c | bellard | |
52 | 6af0bf9c | bellard | void glue(op_sh, MEMSUFFIX) (void) |
53 | 6af0bf9c | bellard | { |
54 | 6af0bf9c | bellard | glue(stw, MEMSUFFIX)(T0, T1); |
55 | 6af0bf9c | bellard | RETURN(); |
56 | 6af0bf9c | bellard | } |
57 | 6af0bf9c | bellard | |
58 | 6af0bf9c | bellard | void glue(op_lw, MEMSUFFIX) (void) |
59 | 6af0bf9c | bellard | { |
60 | 6af0bf9c | bellard | T0 = glue(ldl, MEMSUFFIX)(T0); |
61 | 6af0bf9c | bellard | RETURN(); |
62 | 6af0bf9c | bellard | } |
63 | 6af0bf9c | bellard | |
64 | d796321b | bellard | void glue(op_lwu, MEMSUFFIX) (void) |
65 | d796321b | bellard | { |
66 | d796321b | bellard | T0 = glue(ldl, MEMSUFFIX)(T0); |
67 | d796321b | bellard | RETURN(); |
68 | d796321b | bellard | } |
69 | d796321b | bellard | |
70 | 6af0bf9c | bellard | void glue(op_sw, MEMSUFFIX) (void) |
71 | 6af0bf9c | bellard | { |
72 | 6af0bf9c | bellard | glue(stl, MEMSUFFIX)(T0, T1); |
73 | 6af0bf9c | bellard | RETURN(); |
74 | 6af0bf9c | bellard | } |
75 | 6af0bf9c | bellard | |
76 | 4ad40f36 | bellard | /* "half" load and stores. We must do the memory access inline,
|
77 | 4ad40f36 | bellard | or fault handling won't work. */
|
78 | 6af0bf9c | bellard | void glue(op_lwl, MEMSUFFIX) (void) |
79 | 6af0bf9c | bellard | { |
80 | 4ad40f36 | bellard | uint32_t tmp = glue(ldl, MEMSUFFIX)(T0 & ~3);
|
81 | 4ad40f36 | bellard | CALL_FROM_TB1(glue(do_lwl, MEMSUFFIX), tmp); |
82 | 6af0bf9c | bellard | RETURN(); |
83 | 6af0bf9c | bellard | } |
84 | 6af0bf9c | bellard | |
85 | 6af0bf9c | bellard | void glue(op_lwr, MEMSUFFIX) (void) |
86 | 6af0bf9c | bellard | { |
87 | 4ad40f36 | bellard | uint32_t tmp = glue(ldl, MEMSUFFIX)(T0 & ~3);
|
88 | 4ad40f36 | bellard | CALL_FROM_TB1(glue(do_lwr, MEMSUFFIX), tmp); |
89 | 6af0bf9c | bellard | RETURN(); |
90 | 6af0bf9c | bellard | } |
91 | 6af0bf9c | bellard | |
92 | 6af0bf9c | bellard | void glue(op_swl, MEMSUFFIX) (void) |
93 | 6af0bf9c | bellard | { |
94 | 4ad40f36 | bellard | uint32_t tmp = glue(ldl, MEMSUFFIX)(T0 & ~3);
|
95 | 4ad40f36 | bellard | tmp = CALL_FROM_TB1(glue(do_swl, MEMSUFFIX), tmp); |
96 | 4ad40f36 | bellard | glue(stl, MEMSUFFIX)(T0 & ~3, tmp);
|
97 | 6af0bf9c | bellard | RETURN(); |
98 | 6af0bf9c | bellard | } |
99 | 6af0bf9c | bellard | |
100 | 6af0bf9c | bellard | void glue(op_swr, MEMSUFFIX) (void) |
101 | 6af0bf9c | bellard | { |
102 | 4ad40f36 | bellard | uint32_t tmp = glue(ldl, MEMSUFFIX)(T0 & ~3);
|
103 | 4ad40f36 | bellard | tmp = CALL_FROM_TB1(glue(do_swr, MEMSUFFIX), tmp); |
104 | 4ad40f36 | bellard | glue(stl, MEMSUFFIX)(T0 & ~3, tmp);
|
105 | 6af0bf9c | bellard | RETURN(); |
106 | 6af0bf9c | bellard | } |
107 | 6af0bf9c | bellard | |
108 | 6af0bf9c | bellard | void glue(op_ll, MEMSUFFIX) (void) |
109 | 6af0bf9c | bellard | { |
110 | 6af0bf9c | bellard | T1 = T0; |
111 | 6af0bf9c | bellard | T0 = glue(ldl, MEMSUFFIX)(T0); |
112 | 6af0bf9c | bellard | env->CP0_LLAddr = T1; |
113 | 6af0bf9c | bellard | RETURN(); |
114 | 6af0bf9c | bellard | } |
115 | 6af0bf9c | bellard | |
116 | 6af0bf9c | bellard | void glue(op_sc, MEMSUFFIX) (void) |
117 | 6af0bf9c | bellard | { |
118 | 6af0bf9c | bellard | CALL_FROM_TB0(dump_sc); |
119 | 6af0bf9c | bellard | if (T0 == env->CP0_LLAddr) {
|
120 | 6af0bf9c | bellard | glue(stl, MEMSUFFIX)(T0, T1); |
121 | 6af0bf9c | bellard | T0 = 1;
|
122 | 6af0bf9c | bellard | } else {
|
123 | 6af0bf9c | bellard | T0 = 0;
|
124 | 6af0bf9c | bellard | } |
125 | 6af0bf9c | bellard | RETURN(); |
126 | 6af0bf9c | bellard | } |
127 | 6ea83fed | bellard | |
128 | 6ea83fed | bellard | #ifdef MIPS_USES_FPU
|
129 | 6ea83fed | bellard | void glue(op_lwc1, MEMSUFFIX) (void) |
130 | 6ea83fed | bellard | { |
131 | 6ea83fed | bellard | WT0 = glue(ldl, MEMSUFFIX)(T0); |
132 | 6ea83fed | bellard | RETURN(); |
133 | 6ea83fed | bellard | } |
134 | 6ea83fed | bellard | void glue(op_swc1, MEMSUFFIX) (void) |
135 | 6ea83fed | bellard | { |
136 | 6ea83fed | bellard | glue(stl, MEMSUFFIX)(T0, WT0); |
137 | 6ea83fed | bellard | RETURN(); |
138 | 6ea83fed | bellard | } |
139 | 6ea83fed | bellard | void glue(op_ldc1, MEMSUFFIX) (void) |
140 | 6ea83fed | bellard | { |
141 | 6ea83fed | bellard | DT0 = glue(ldq, MEMSUFFIX)(T0); |
142 | 6ea83fed | bellard | RETURN(); |
143 | 6ea83fed | bellard | } |
144 | 6ea83fed | bellard | void glue(op_sdc1, MEMSUFFIX) (void) |
145 | 6ea83fed | bellard | { |
146 | 6ea83fed | bellard | glue(stq, MEMSUFFIX)(T0, DT0); |
147 | 6ea83fed | bellard | RETURN(); |
148 | 6ea83fed | bellard | } |
149 | 6ea83fed | bellard | #endif |