Statistics
| Branch: | Revision:

root / target-ppc / op_mem_access.h @ f8ed7070

History | View | Annotate | Download (4 kB)

1
/*
2
 *  PowerPC emulation memory access helpers for qemu.
3
 *
4
 *  Copyright (c) 2003-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
/* 8 bits accesses */
22
static always_inline target_ulong glue(ldu8, MEMSUFFIX) (target_ulong EA)
23
{
24
    return (uint8_t)glue(ldub, MEMSUFFIX)(EA);
25
}
26

    
27
static always_inline target_long glue(lds8, MEMSUFFIX) (target_ulong EA)
28
{
29
    return (int8_t)glue(ldsb, MEMSUFFIX)(EA);
30
}
31

    
32
static always_inline void glue(st8, MEMSUFFIX) (target_ulong EA, uint8_t val)
33
{
34
    glue(stb, MEMSUFFIX)(EA, val);
35
}
36

    
37
/* 16 bits accesses */
38
static always_inline target_ulong glue(ldu16, MEMSUFFIX) (target_ulong EA)
39
{
40
    return (uint16_t)glue(lduw, MEMSUFFIX)(EA);
41
}
42

    
43
static always_inline target_long glue(lds16, MEMSUFFIX) (target_ulong EA)
44
{
45
    return (int16_t)glue(ldsw, MEMSUFFIX)(EA);
46
}
47

    
48
static always_inline void glue(st16, MEMSUFFIX) (target_ulong EA, uint16_t val)
49
{
50
    glue(stw, MEMSUFFIX)(EA, val);
51
}
52

    
53
static always_inline target_ulong glue(ldu16r, MEMSUFFIX) (target_ulong EA)
54
{
55
    return (uint16_t)bswap16(glue(lduw, MEMSUFFIX)(EA));
56
}
57

    
58
static always_inline target_long glue(lds16r, MEMSUFFIX) (target_ulong EA)
59
{
60
    return (int16_t)bswap16(glue(lduw, MEMSUFFIX)(EA));
61
}
62

    
63
static always_inline void glue(st16r, MEMSUFFIX) (target_ulong EA, uint16_t val)
64
{
65
    glue(stw, MEMSUFFIX)(EA, bswap16(val));
66
}
67

    
68
/* 32 bits accesses */
69
static always_inline uint32_t glue(__ldul, MEMSUFFIX) (target_ulong EA)
70
{
71
    return (uint32_t)glue(ldl, MEMSUFFIX)(EA);
72
}
73

    
74
static always_inline int32_t glue(__ldsl, MEMSUFFIX) (target_ulong EA)
75
{
76
    return (int32_t)glue(ldl, MEMSUFFIX)(EA);
77
}
78

    
79
static always_inline target_ulong glue(ldu32, MEMSUFFIX) (target_ulong EA)
80
{
81
    return glue(__ldul, MEMSUFFIX)(EA);
82
}
83

    
84
static always_inline target_long glue(lds32, MEMSUFFIX) (target_ulong EA)
85
{
86
    return glue(__ldsl, MEMSUFFIX)(EA);
87
}
88

    
89
static always_inline void glue(st32, MEMSUFFIX) (target_ulong EA, uint32_t val)
90
{
91
    glue(stl, MEMSUFFIX)(EA, val);
92
}
93

    
94
static always_inline target_ulong glue(ldu32r, MEMSUFFIX) (target_ulong EA)
95
{
96
    return bswap32(glue(__ldul, MEMSUFFIX)(EA));
97
}
98

    
99
static always_inline target_long glue(lds32r, MEMSUFFIX) (target_ulong EA)
100
{
101
    return (int32_t)bswap32(glue(__ldul, MEMSUFFIX)(EA));
102
}
103

    
104
static always_inline void glue(st32r, MEMSUFFIX) (target_ulong EA, uint32_t val)
105
{
106
    glue(stl, MEMSUFFIX)(EA, bswap32(val));
107
}
108

    
109
/* 64 bits accesses */
110
static always_inline uint64_t glue(__lduq, MEMSUFFIX) (target_ulong EA)
111
{
112
    return (uint64_t)glue(ldq, MEMSUFFIX)(EA);
113
}
114

    
115
static always_inline int64_t glue(__ldsq, MEMSUFFIX) (target_ulong EA)
116
{
117
    return (int64_t)glue(ldq, MEMSUFFIX)(EA);
118
}
119

    
120
static always_inline uint64_t glue(ldu64, MEMSUFFIX) (target_ulong EA)
121
{
122
    return glue(__lduq, MEMSUFFIX)(EA);
123
}
124

    
125
static always_inline int64_t glue(lds64, MEMSUFFIX) (target_ulong EA)
126
{
127
    return glue(__ldsq, MEMSUFFIX)(EA);
128
}
129

    
130
static always_inline void glue(st64, MEMSUFFIX) (target_ulong EA, uint64_t val)
131
{
132
    glue(stq, MEMSUFFIX)(EA, val);
133
}
134

    
135
static always_inline uint64_t glue(ldu64r, MEMSUFFIX) (target_ulong EA)
136
{
137
    return bswap64(glue(__lduq, MEMSUFFIX)(EA));
138
}
139

    
140
static always_inline int64_t glue(lds64r, MEMSUFFIX) (target_ulong EA)
141
{
142
    return (int64_t)bswap64(glue(__lduq, MEMSUFFIX)(EA));
143
}
144

    
145
static always_inline void glue(st64r, MEMSUFFIX) (target_ulong EA, uint64_t val)
146
{
147
    glue(stq, MEMSUFFIX)(EA, bswap64(val));
148
}