root / target-mips / op_mem.c @ 1e8a7cfd
History | View | Annotate | Download (2.3 kB)
1 |
/*
|
---|---|
2 |
* MIPS emulation memory micro-operations for qemu.
|
3 |
*
|
4 |
* Copyright (c) 2004-2005 Jocelyn Mayer
|
5 |
*
|
6 |
* This library is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU Lesser General Public
|
8 |
* License as published by the Free Software Foundation; either
|
9 |
* version 2 of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This library is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
* Lesser General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU Lesser General Public
|
17 |
* License along with this library; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 |
*/
|
20 |
|
21 |
/* Standard loads and stores */
|
22 |
void glue(op_lb, MEMSUFFIX) (void) |
23 |
{ |
24 |
T0 = glue(ldsb, MEMSUFFIX)(T0); |
25 |
RETURN(); |
26 |
} |
27 |
|
28 |
void glue(op_lbu, MEMSUFFIX) (void) |
29 |
{ |
30 |
T0 = glue(ldub, MEMSUFFIX)(T0); |
31 |
RETURN(); |
32 |
} |
33 |
|
34 |
void glue(op_sb, MEMSUFFIX) (void) |
35 |
{ |
36 |
glue(stb, MEMSUFFIX)(T0, T1); |
37 |
RETURN(); |
38 |
} |
39 |
|
40 |
void glue(op_lh, MEMSUFFIX) (void) |
41 |
{ |
42 |
T0 = glue(ldsw, MEMSUFFIX)(T0); |
43 |
RETURN(); |
44 |
} |
45 |
|
46 |
void glue(op_lhu, MEMSUFFIX) (void) |
47 |
{ |
48 |
T0 = glue(lduw, MEMSUFFIX)(T0); |
49 |
RETURN(); |
50 |
} |
51 |
|
52 |
void glue(op_sh, MEMSUFFIX) (void) |
53 |
{ |
54 |
glue(stw, MEMSUFFIX)(T0, T1); |
55 |
RETURN(); |
56 |
} |
57 |
|
58 |
void glue(op_lw, MEMSUFFIX) (void) |
59 |
{ |
60 |
T0 = glue(ldl, MEMSUFFIX)(T0); |
61 |
RETURN(); |
62 |
} |
63 |
|
64 |
void glue(op_sw, MEMSUFFIX) (void) |
65 |
{ |
66 |
glue(stl, MEMSUFFIX)(T0, T1); |
67 |
RETURN(); |
68 |
} |
69 |
|
70 |
/* "half" load and stores */
|
71 |
void glue(op_lwl, MEMSUFFIX) (void) |
72 |
{ |
73 |
CALL_FROM_TB0(glue(do_lwl, MEMSUFFIX)); |
74 |
RETURN(); |
75 |
} |
76 |
|
77 |
void glue(op_lwr, MEMSUFFIX) (void) |
78 |
{ |
79 |
CALL_FROM_TB0(glue(do_lwr, MEMSUFFIX)); |
80 |
RETURN(); |
81 |
} |
82 |
|
83 |
void glue(op_swl, MEMSUFFIX) (void) |
84 |
{ |
85 |
CALL_FROM_TB0(glue(do_swl, MEMSUFFIX)); |
86 |
RETURN(); |
87 |
} |
88 |
|
89 |
void glue(op_swr, MEMSUFFIX) (void) |
90 |
{ |
91 |
CALL_FROM_TB0(glue(do_swr, MEMSUFFIX)); |
92 |
RETURN(); |
93 |
} |
94 |
|
95 |
void glue(op_ll, MEMSUFFIX) (void) |
96 |
{ |
97 |
T1 = T0; |
98 |
T0 = glue(ldl, MEMSUFFIX)(T0); |
99 |
env->CP0_LLAddr = T1; |
100 |
RETURN(); |
101 |
} |
102 |
|
103 |
void glue(op_sc, MEMSUFFIX) (void) |
104 |
{ |
105 |
CALL_FROM_TB0(dump_sc); |
106 |
if (T0 == env->CP0_LLAddr) {
|
107 |
glue(stl, MEMSUFFIX)(T0, T1); |
108 |
T0 = 1;
|
109 |
} else {
|
110 |
T0 = 0;
|
111 |
} |
112 |
RETURN(); |
113 |
} |