root / target-ppc / op_mem_access.h @ f8ed7070
History | View | Annotate | Download (4 kB)
1 | e7c24003 | j_mayer | /*
|
---|---|---|---|
2 | e7c24003 | j_mayer | * PowerPC emulation memory access helpers for qemu.
|
3 | e7c24003 | j_mayer | *
|
4 | e7c24003 | j_mayer | * Copyright (c) 2003-2007 Jocelyn Mayer
|
5 | e7c24003 | j_mayer | *
|
6 | e7c24003 | j_mayer | * This library is free software; you can redistribute it and/or
|
7 | e7c24003 | j_mayer | * modify it under the terms of the GNU Lesser General Public
|
8 | e7c24003 | j_mayer | * License as published by the Free Software Foundation; either
|
9 | e7c24003 | j_mayer | * version 2 of the License, or (at your option) any later version.
|
10 | e7c24003 | j_mayer | *
|
11 | e7c24003 | j_mayer | * This library is distributed in the hope that it will be useful,
|
12 | e7c24003 | j_mayer | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | e7c24003 | j_mayer | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | e7c24003 | j_mayer | * Lesser General Public License for more details.
|
15 | e7c24003 | j_mayer | *
|
16 | e7c24003 | j_mayer | * You should have received a copy of the GNU Lesser General Public
|
17 | e7c24003 | j_mayer | * License along with this library; if not, write to the Free Software
|
18 | e7c24003 | j_mayer | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | e7c24003 | j_mayer | */
|
20 | e7c24003 | j_mayer | |
21 | e7c24003 | j_mayer | /* 8 bits accesses */
|
22 | e7c24003 | j_mayer | static always_inline target_ulong glue(ldu8, MEMSUFFIX) (target_ulong EA)
|
23 | e7c24003 | j_mayer | { |
24 | e7c24003 | j_mayer | return (uint8_t)glue(ldub, MEMSUFFIX)(EA);
|
25 | e7c24003 | j_mayer | } |
26 | e7c24003 | j_mayer | |
27 | e7c24003 | j_mayer | static always_inline target_long glue(lds8, MEMSUFFIX) (target_ulong EA)
|
28 | e7c24003 | j_mayer | { |
29 | e7c24003 | j_mayer | return (int8_t)glue(ldsb, MEMSUFFIX)(EA);
|
30 | e7c24003 | j_mayer | } |
31 | e7c24003 | j_mayer | |
32 | e7c24003 | j_mayer | static always_inline void glue(st8, MEMSUFFIX) (target_ulong EA, uint8_t val) |
33 | e7c24003 | j_mayer | { |
34 | e7c24003 | j_mayer | glue(stb, MEMSUFFIX)(EA, val); |
35 | e7c24003 | j_mayer | } |
36 | e7c24003 | j_mayer | |
37 | e7c24003 | j_mayer | /* 16 bits accesses */
|
38 | e7c24003 | j_mayer | static always_inline target_ulong glue(ldu16, MEMSUFFIX) (target_ulong EA)
|
39 | e7c24003 | j_mayer | { |
40 | e7c24003 | j_mayer | return (uint16_t)glue(lduw, MEMSUFFIX)(EA);
|
41 | e7c24003 | j_mayer | } |
42 | e7c24003 | j_mayer | |
43 | e7c24003 | j_mayer | static always_inline target_long glue(lds16, MEMSUFFIX) (target_ulong EA)
|
44 | e7c24003 | j_mayer | { |
45 | e7c24003 | j_mayer | return (int16_t)glue(ldsw, MEMSUFFIX)(EA);
|
46 | e7c24003 | j_mayer | } |
47 | e7c24003 | j_mayer | |
48 | e7c24003 | j_mayer | static always_inline void glue(st16, MEMSUFFIX) (target_ulong EA, uint16_t val) |
49 | e7c24003 | j_mayer | { |
50 | e7c24003 | j_mayer | glue(stw, MEMSUFFIX)(EA, val); |
51 | e7c24003 | j_mayer | } |
52 | e7c24003 | j_mayer | |
53 | e7c24003 | j_mayer | static always_inline target_ulong glue(ldu16r, MEMSUFFIX) (target_ulong EA)
|
54 | e7c24003 | j_mayer | { |
55 | e7c24003 | j_mayer | return (uint16_t)bswap16(glue(lduw, MEMSUFFIX)(EA));
|
56 | e7c24003 | j_mayer | } |
57 | e7c24003 | j_mayer | |
58 | e7c24003 | j_mayer | static always_inline target_long glue(lds16r, MEMSUFFIX) (target_ulong EA)
|
59 | e7c24003 | j_mayer | { |
60 | e7c24003 | j_mayer | return (int16_t)bswap16(glue(lduw, MEMSUFFIX)(EA));
|
61 | e7c24003 | j_mayer | } |
62 | e7c24003 | j_mayer | |
63 | e7c24003 | j_mayer | static always_inline void glue(st16r, MEMSUFFIX) (target_ulong EA, uint16_t val) |
64 | e7c24003 | j_mayer | { |
65 | e7c24003 | j_mayer | glue(stw, MEMSUFFIX)(EA, bswap16(val)); |
66 | e7c24003 | j_mayer | } |
67 | e7c24003 | j_mayer | |
68 | e7c24003 | j_mayer | /* 32 bits accesses */
|
69 | e7c24003 | j_mayer | static always_inline uint32_t glue(__ldul, MEMSUFFIX) (target_ulong EA)
|
70 | e7c24003 | j_mayer | { |
71 | e7c24003 | j_mayer | return (uint32_t)glue(ldl, MEMSUFFIX)(EA);
|
72 | e7c24003 | j_mayer | } |
73 | e7c24003 | j_mayer | |
74 | e7c24003 | j_mayer | static always_inline int32_t glue(__ldsl, MEMSUFFIX) (target_ulong EA)
|
75 | e7c24003 | j_mayer | { |
76 | e7c24003 | j_mayer | return (int32_t)glue(ldl, MEMSUFFIX)(EA);
|
77 | e7c24003 | j_mayer | } |
78 | e7c24003 | j_mayer | |
79 | e7c24003 | j_mayer | static always_inline target_ulong glue(ldu32, MEMSUFFIX) (target_ulong EA)
|
80 | e7c24003 | j_mayer | { |
81 | e7c24003 | j_mayer | return glue(__ldul, MEMSUFFIX)(EA);
|
82 | e7c24003 | j_mayer | } |
83 | e7c24003 | j_mayer | |
84 | e7c24003 | j_mayer | static always_inline target_long glue(lds32, MEMSUFFIX) (target_ulong EA)
|
85 | e7c24003 | j_mayer | { |
86 | e7c24003 | j_mayer | return glue(__ldsl, MEMSUFFIX)(EA);
|
87 | e7c24003 | j_mayer | } |
88 | e7c24003 | j_mayer | |
89 | e7c24003 | j_mayer | static always_inline void glue(st32, MEMSUFFIX) (target_ulong EA, uint32_t val) |
90 | e7c24003 | j_mayer | { |
91 | e7c24003 | j_mayer | glue(stl, MEMSUFFIX)(EA, val); |
92 | e7c24003 | j_mayer | } |
93 | e7c24003 | j_mayer | |
94 | e7c24003 | j_mayer | static always_inline target_ulong glue(ldu32r, MEMSUFFIX) (target_ulong EA)
|
95 | e7c24003 | j_mayer | { |
96 | e7c24003 | j_mayer | return bswap32(glue(__ldul, MEMSUFFIX)(EA));
|
97 | e7c24003 | j_mayer | } |
98 | e7c24003 | j_mayer | |
99 | e7c24003 | j_mayer | static always_inline target_long glue(lds32r, MEMSUFFIX) (target_ulong EA)
|
100 | e7c24003 | j_mayer | { |
101 | e7c24003 | j_mayer | return (int32_t)bswap32(glue(__ldul, MEMSUFFIX)(EA));
|
102 | e7c24003 | j_mayer | } |
103 | e7c24003 | j_mayer | |
104 | e7c24003 | j_mayer | static always_inline void glue(st32r, MEMSUFFIX) (target_ulong EA, uint32_t val) |
105 | e7c24003 | j_mayer | { |
106 | e7c24003 | j_mayer | glue(stl, MEMSUFFIX)(EA, bswap32(val)); |
107 | e7c24003 | j_mayer | } |
108 | e7c24003 | j_mayer | |
109 | e7c24003 | j_mayer | /* 64 bits accesses */
|
110 | e7c24003 | j_mayer | static always_inline uint64_t glue(__lduq, MEMSUFFIX) (target_ulong EA)
|
111 | e7c24003 | j_mayer | { |
112 | e7c24003 | j_mayer | return (uint64_t)glue(ldq, MEMSUFFIX)(EA);
|
113 | e7c24003 | j_mayer | } |
114 | e7c24003 | j_mayer | |
115 | e7c24003 | j_mayer | static always_inline int64_t glue(__ldsq, MEMSUFFIX) (target_ulong EA)
|
116 | e7c24003 | j_mayer | { |
117 | e7c24003 | j_mayer | return (int64_t)glue(ldq, MEMSUFFIX)(EA);
|
118 | e7c24003 | j_mayer | } |
119 | e7c24003 | j_mayer | |
120 | e7c24003 | j_mayer | static always_inline uint64_t glue(ldu64, MEMSUFFIX) (target_ulong EA)
|
121 | e7c24003 | j_mayer | { |
122 | e7c24003 | j_mayer | return glue(__lduq, MEMSUFFIX)(EA);
|
123 | e7c24003 | j_mayer | } |
124 | e7c24003 | j_mayer | |
125 | e7c24003 | j_mayer | static always_inline int64_t glue(lds64, MEMSUFFIX) (target_ulong EA)
|
126 | e7c24003 | j_mayer | { |
127 | e7c24003 | j_mayer | return glue(__ldsq, MEMSUFFIX)(EA);
|
128 | e7c24003 | j_mayer | } |
129 | e7c24003 | j_mayer | |
130 | e7c24003 | j_mayer | static always_inline void glue(st64, MEMSUFFIX) (target_ulong EA, uint64_t val) |
131 | e7c24003 | j_mayer | { |
132 | e7c24003 | j_mayer | glue(stq, MEMSUFFIX)(EA, val); |
133 | e7c24003 | j_mayer | } |
134 | e7c24003 | j_mayer | |
135 | e7c24003 | j_mayer | static always_inline uint64_t glue(ldu64r, MEMSUFFIX) (target_ulong EA)
|
136 | e7c24003 | j_mayer | { |
137 | e7c24003 | j_mayer | return bswap64(glue(__lduq, MEMSUFFIX)(EA));
|
138 | e7c24003 | j_mayer | } |
139 | e7c24003 | j_mayer | |
140 | e7c24003 | j_mayer | static always_inline int64_t glue(lds64r, MEMSUFFIX) (target_ulong EA)
|
141 | e7c24003 | j_mayer | { |
142 | e7c24003 | j_mayer | return (int64_t)bswap64(glue(__lduq, MEMSUFFIX)(EA));
|
143 | e7c24003 | j_mayer | } |
144 | e7c24003 | j_mayer | |
145 | e7c24003 | j_mayer | static always_inline void glue(st64r, MEMSUFFIX) (target_ulong EA, uint64_t val) |
146 | e7c24003 | j_mayer | { |
147 | e7c24003 | j_mayer | glue(stq, MEMSUFFIX)(EA, bswap64(val)); |
148 | e7c24003 | j_mayer | } |