root / target-arm / op_mem.h @ 7ed40acf
History | View | Annotate | Download (1.3 kB)
1 |
/* ARM memory operations. */
|
---|---|
2 |
|
3 |
/* Load from address T1 into T0. */
|
4 |
#define MEM_LD_OP(name) \
|
5 |
void OPPROTO glue(op_ld##name,MEMSUFFIX)(void) \ |
6 |
{ \ |
7 |
T0 = glue(ld##name,MEMSUFFIX)(T1); \ |
8 |
FORCE_RET(); \ |
9 |
} |
10 |
|
11 |
MEM_LD_OP(ub) |
12 |
MEM_LD_OP(sb) |
13 |
MEM_LD_OP(uw) |
14 |
MEM_LD_OP(sw) |
15 |
MEM_LD_OP(l) |
16 |
|
17 |
#undef MEM_LD_OP
|
18 |
|
19 |
/* Store T0 to address T1. */
|
20 |
#define MEM_ST_OP(name) \
|
21 |
void OPPROTO glue(op_st##name,MEMSUFFIX)(void) \ |
22 |
{ \ |
23 |
glue(st##name,MEMSUFFIX)(T1, T0); \ |
24 |
FORCE_RET(); \ |
25 |
} |
26 |
|
27 |
MEM_ST_OP(b) |
28 |
MEM_ST_OP(w) |
29 |
MEM_ST_OP(l) |
30 |
|
31 |
#undef MEM_ST_OP
|
32 |
|
33 |
/* Swap T0 with memory at address T1. */
|
34 |
/* ??? Is this exception safe? */
|
35 |
#define MEM_SWP_OP(name, lname) \
|
36 |
void OPPROTO glue(op_swp##name,MEMSUFFIX)(void) \ |
37 |
{ \ |
38 |
uint32_t tmp; \ |
39 |
cpu_lock(); \ |
40 |
tmp = glue(ld##lname,MEMSUFFIX)(T1); \ |
41 |
glue(st##name,MEMSUFFIX)(T1, T0); \ |
42 |
T0 = tmp; \ |
43 |
cpu_unlock(); \ |
44 |
FORCE_RET(); \ |
45 |
} |
46 |
|
47 |
MEM_SWP_OP(b, ub) |
48 |
MEM_SWP_OP(l, l) |
49 |
|
50 |
#undef MEM_SWP_OP
|
51 |
|
52 |
/* Floating point load/store. Address is in T1 */
|
53 |
#define VFP_MEM_OP(p, w) \
|
54 |
void OPPROTO glue(op_vfp_ld##p,MEMSUFFIX)(void) \ |
55 |
{ \ |
56 |
FT0##p = glue(ldf##w,MEMSUFFIX)(T1); \ |
57 |
FORCE_RET(); \ |
58 |
} \ |
59 |
void OPPROTO glue(op_vfp_st##p,MEMSUFFIX)(void) \ |
60 |
{ \ |
61 |
glue(stf##w,MEMSUFFIX)(T1, FT0##p); \ |
62 |
FORCE_RET(); \ |
63 |
} |
64 |
|
65 |
VFP_MEM_OP(s,l) |
66 |
VFP_MEM_OP(d,q) |
67 |
|
68 |
#undef VFP_MEM_OP
|
69 |
|
70 |
#undef MEMSUFFIX
|