root / target-alpha / op_mem.h @ 4c9649a9
History | View | Annotate | Download (4.2 kB)
1 |
/*
|
---|---|
2 |
* Alpha emulation cpu micro-operations for memory accesses for qemu.
|
3 |
*
|
4 |
* Copyright (c) 2007 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 |
#define DEBUG_MEM_ACCESSES
|
22 |
#if defined (DEBUG_MEM_ACCESSES)
|
23 |
void helper_print_mem_EA (target_ulong EA);
|
24 |
#define print_mem_EA(EA) do { helper_print_mem_EA(EA); } while (0) |
25 |
#else
|
26 |
#define print_mem_EA(EA) do { } while (0) |
27 |
#endif
|
28 |
|
29 |
static inline uint32_t glue(ldl_l, MEMSUFFIX) (target_ulong EA) |
30 |
{ |
31 |
env->lock = EA; |
32 |
|
33 |
return glue(ldl, MEMSUFFIX)(EA);
|
34 |
} |
35 |
|
36 |
static inline uint32_t glue(ldq_l, MEMSUFFIX) (target_ulong EA) |
37 |
{ |
38 |
env->lock = EA; |
39 |
|
40 |
return glue(ldq, MEMSUFFIX)(EA);
|
41 |
} |
42 |
|
43 |
static inline void glue(stl_c, MEMSUFFIX) (target_ulong EA, uint32_t data) |
44 |
{ |
45 |
if (EA == env->lock) {
|
46 |
glue(stl, MEMSUFFIX)(EA, data); |
47 |
T0 = 0;
|
48 |
} else {
|
49 |
T0 = 1;
|
50 |
} |
51 |
env->lock = -1;
|
52 |
} |
53 |
|
54 |
static inline void glue(stq_c, MEMSUFFIX) (target_ulong EA, uint64_t data) |
55 |
{ |
56 |
if (EA == env->lock) {
|
57 |
glue(stq, MEMSUFFIX)(EA, data); |
58 |
T0 = 0;
|
59 |
} else {
|
60 |
T0 = 1;
|
61 |
} |
62 |
env->lock = -1;
|
63 |
} |
64 |
|
65 |
#define ALPHA_LD_OP(name, op) \
|
66 |
void OPPROTO glue(glue(op_ld, name), MEMSUFFIX) (void) \ |
67 |
{ \ |
68 |
print_mem_EA(T0); \ |
69 |
T1 = glue(op, MEMSUFFIX)(T0); \ |
70 |
RETURN(); \ |
71 |
} |
72 |
|
73 |
#define ALPHA_ST_OP(name, op) \
|
74 |
void OPPROTO glue(glue(op_st, name), MEMSUFFIX) (void) \ |
75 |
{ \ |
76 |
print_mem_EA(T0); \ |
77 |
glue(op, MEMSUFFIX)(T0, T1); \ |
78 |
RETURN(); \ |
79 |
} |
80 |
|
81 |
ALPHA_LD_OP(bu, ldub); |
82 |
ALPHA_ST_OP(b, stb); |
83 |
ALPHA_LD_OP(wu, lduw); |
84 |
ALPHA_ST_OP(w, stw); |
85 |
ALPHA_LD_OP(l, ldl); |
86 |
ALPHA_ST_OP(l, stl); |
87 |
ALPHA_LD_OP(q, ldq); |
88 |
ALPHA_ST_OP(q, stq); |
89 |
|
90 |
ALPHA_LD_OP(q_u, ldq); |
91 |
ALPHA_ST_OP(q_u, stq); |
92 |
|
93 |
ALPHA_LD_OP(l_l, ldl_l); |
94 |
ALPHA_LD_OP(q_l, ldq_l); |
95 |
ALPHA_ST_OP(l_c, stl_c); |
96 |
ALPHA_ST_OP(q_c, stq_c); |
97 |
|
98 |
#define ALPHA_LDF_OP(name, op) \
|
99 |
void OPPROTO glue(glue(op_ld, name), MEMSUFFIX) (void) \ |
100 |
{ \ |
101 |
print_mem_EA(T0); \ |
102 |
FT1 = glue(op, MEMSUFFIX)(T0); \ |
103 |
RETURN(); \ |
104 |
} |
105 |
|
106 |
#define ALPHA_STF_OP(name, op) \
|
107 |
void OPPROTO glue(glue(op_st, name), MEMSUFFIX) (void) \ |
108 |
{ \ |
109 |
print_mem_EA(T0); \ |
110 |
glue(op, MEMSUFFIX)(T0, FT1); \ |
111 |
RETURN(); \ |
112 |
} |
113 |
|
114 |
ALPHA_LDF_OP(t, ldfq); |
115 |
ALPHA_STF_OP(t, stfq); |
116 |
ALPHA_LDF_OP(s, ldfl); |
117 |
ALPHA_STF_OP(s, stfl); |
118 |
|
119 |
/* VAX floating point */
|
120 |
ALPHA_LDF_OP(f, helper_ldff); |
121 |
ALPHA_STF_OP(f, helper_stff); |
122 |
ALPHA_LDF_OP(g, helper_ldfg); |
123 |
ALPHA_STF_OP(g, helper_stfg); |
124 |
|
125 |
#undef MEMSUFFIX
|