root / target-mips / op_helper_mem.c @ 43057ab1
History | View | Annotate | Download (2.9 kB)
1 | 9f25f11f | bellard | #ifdef TARGET_WORDS_BIGENDIAN
|
---|---|---|---|
2 | 9f25f11f | bellard | #define GET_LMASK(v) ((v) & 3) |
3 | 9f25f11f | bellard | #else
|
4 | 9f25f11f | bellard | #define GET_LMASK(v) (((v) & 3) ^ 3) |
5 | 9f25f11f | bellard | #endif
|
6 | 9f25f11f | bellard | |
7 | 4ad40f36 | bellard | void glue(do_lwl, MEMSUFFIX) (uint32_t tmp)
|
8 | 6af0bf9c | bellard | { |
9 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
10 | 6af0bf9c | bellard | target_ulong sav = T0; |
11 | 6af0bf9c | bellard | #endif
|
12 | 6af0bf9c | bellard | |
13 | 6af0bf9c | bellard | /* XXX: this is valid only in big-endian mode
|
14 | 6af0bf9c | bellard | * should be reverted for little-endian...
|
15 | 6af0bf9c | bellard | */
|
16 | 9f25f11f | bellard | switch (GET_LMASK(T0)) {
|
17 | 6af0bf9c | bellard | case 0: |
18 | 6af0bf9c | bellard | T0 = tmp; |
19 | 6af0bf9c | bellard | break;
|
20 | 6af0bf9c | bellard | case 1: |
21 | 6af0bf9c | bellard | T0 = (tmp << 8) | (T1 & 0x000000FF); |
22 | 6af0bf9c | bellard | break;
|
23 | 6af0bf9c | bellard | case 2: |
24 | 6af0bf9c | bellard | T0 = (tmp << 16) | (T1 & 0x0000FFFF); |
25 | 6af0bf9c | bellard | break;
|
26 | 6af0bf9c | bellard | case 3: |
27 | 6af0bf9c | bellard | T0 = (tmp << 24) | (T1 & 0x00FFFFFF); |
28 | 6af0bf9c | bellard | break;
|
29 | 6af0bf9c | bellard | } |
30 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
31 | 6af0bf9c | bellard | if (logfile) {
|
32 | 6af0bf9c | bellard | fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
|
33 | 6af0bf9c | bellard | __func__, sav, tmp, T1, T0); |
34 | 6af0bf9c | bellard | } |
35 | 6af0bf9c | bellard | #endif
|
36 | 6af0bf9c | bellard | RETURN(); |
37 | 6af0bf9c | bellard | } |
38 | 6af0bf9c | bellard | |
39 | 4ad40f36 | bellard | void glue(do_lwr, MEMSUFFIX) (uint32_t tmp)
|
40 | 6af0bf9c | bellard | { |
41 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
42 | 6af0bf9c | bellard | target_ulong sav = T0; |
43 | 6af0bf9c | bellard | #endif
|
44 | 6af0bf9c | bellard | |
45 | 6af0bf9c | bellard | /* XXX: this is valid only in big-endian mode
|
46 | 6af0bf9c | bellard | * should be reverted for little-endian...
|
47 | 6af0bf9c | bellard | */
|
48 | 9f25f11f | bellard | switch (GET_LMASK(T0)) {
|
49 | 6af0bf9c | bellard | case 0: |
50 | 6af0bf9c | bellard | T0 = (tmp >> 24) | (T1 & 0xFFFFFF00); |
51 | 6af0bf9c | bellard | break;
|
52 | 6af0bf9c | bellard | case 1: |
53 | 6af0bf9c | bellard | T0 = (tmp >> 16) | (T1 & 0xFFFF0000); |
54 | 6af0bf9c | bellard | break;
|
55 | 6af0bf9c | bellard | case 2: |
56 | 6af0bf9c | bellard | T0 = (tmp >> 8) | (T1 & 0xFF000000); |
57 | 6af0bf9c | bellard | break;
|
58 | 6af0bf9c | bellard | case 3: |
59 | 6af0bf9c | bellard | T0 = tmp; |
60 | 6af0bf9c | bellard | break;
|
61 | 6af0bf9c | bellard | } |
62 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
63 | 6af0bf9c | bellard | if (logfile) {
|
64 | 6af0bf9c | bellard | fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
|
65 | 6af0bf9c | bellard | __func__, sav, tmp, T1, T0); |
66 | 6af0bf9c | bellard | } |
67 | 6af0bf9c | bellard | #endif
|
68 | 6af0bf9c | bellard | RETURN(); |
69 | 6af0bf9c | bellard | } |
70 | 6af0bf9c | bellard | |
71 | 4ad40f36 | bellard | uint32_t glue(do_swl, MEMSUFFIX) (uint32_t tmp) |
72 | 6af0bf9c | bellard | { |
73 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
74 | 6af0bf9c | bellard | target_ulong sav; |
75 | 6af0bf9c | bellard | #endif
|
76 | 6af0bf9c | bellard | |
77 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
78 | 6af0bf9c | bellard | sav = tmp; |
79 | 6af0bf9c | bellard | #endif
|
80 | 6af0bf9c | bellard | /* XXX: this is valid only in big-endian mode
|
81 | 6af0bf9c | bellard | * should be reverted for little-endian...
|
82 | 6af0bf9c | bellard | */
|
83 | 9f25f11f | bellard | switch (GET_LMASK(T0)) {
|
84 | 6af0bf9c | bellard | case 0: |
85 | 6af0bf9c | bellard | tmp = T1; |
86 | 6af0bf9c | bellard | break;
|
87 | 6af0bf9c | bellard | case 1: |
88 | 6af0bf9c | bellard | tmp = (tmp & 0xFF000000) | (T1 >> 8); |
89 | 6af0bf9c | bellard | break;
|
90 | 6af0bf9c | bellard | case 2: |
91 | 6af0bf9c | bellard | tmp = (tmp & 0xFFFF0000) | (T1 >> 16); |
92 | 6af0bf9c | bellard | break;
|
93 | 6af0bf9c | bellard | case 3: |
94 | 6af0bf9c | bellard | tmp = (tmp & 0xFFFFFF00) | (T1 >> 24); |
95 | 6af0bf9c | bellard | break;
|
96 | 6af0bf9c | bellard | } |
97 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
98 | 6af0bf9c | bellard | if (logfile) {
|
99 | 6af0bf9c | bellard | fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
|
100 | 6af0bf9c | bellard | __func__, T0, sav, T1, tmp); |
101 | 6af0bf9c | bellard | } |
102 | 6af0bf9c | bellard | #endif
|
103 | 6af0bf9c | bellard | RETURN(); |
104 | 4ad40f36 | bellard | return tmp;
|
105 | 6af0bf9c | bellard | } |
106 | 6af0bf9c | bellard | |
107 | 4ad40f36 | bellard | uint32_t glue(do_swr, MEMSUFFIX) (uint32_t tmp) |
108 | 6af0bf9c | bellard | { |
109 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
110 | 6af0bf9c | bellard | target_ulong sav; |
111 | 6af0bf9c | bellard | #endif
|
112 | 6af0bf9c | bellard | |
113 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
114 | 6af0bf9c | bellard | sav = tmp; |
115 | 6af0bf9c | bellard | #endif
|
116 | 6af0bf9c | bellard | /* XXX: this is valid only in big-endian mode
|
117 | 6af0bf9c | bellard | * should be reverted for little-endian...
|
118 | 6af0bf9c | bellard | */
|
119 | 9f25f11f | bellard | switch (GET_LMASK(T0)) {
|
120 | 6af0bf9c | bellard | case 0: |
121 | 6af0bf9c | bellard | tmp = (tmp & 0x00FFFFFF) | (T1 << 24); |
122 | 6af0bf9c | bellard | break;
|
123 | 6af0bf9c | bellard | case 1: |
124 | 6af0bf9c | bellard | tmp = (tmp & 0x0000FFFF) | (T1 << 16); |
125 | 6af0bf9c | bellard | break;
|
126 | 6af0bf9c | bellard | case 2: |
127 | 6af0bf9c | bellard | tmp = (tmp & 0x000000FF) | (T1 << 8); |
128 | 6af0bf9c | bellard | break;
|
129 | 6af0bf9c | bellard | case 3: |
130 | 6af0bf9c | bellard | tmp = T1; |
131 | 6af0bf9c | bellard | break;
|
132 | 6af0bf9c | bellard | } |
133 | 6af0bf9c | bellard | #if defined (DEBUG_OP)
|
134 | 6af0bf9c | bellard | if (logfile) {
|
135 | 6af0bf9c | bellard | fprintf(logfile, "%s: %08x - %08x %08x => %08x\n",
|
136 | 6af0bf9c | bellard | __func__, T0, sav, T1, tmp); |
137 | 6af0bf9c | bellard | } |
138 | 6af0bf9c | bellard | #endif
|
139 | 6af0bf9c | bellard | RETURN(); |
140 | 4ad40f36 | bellard | return tmp;
|
141 | 6af0bf9c | bellard | } |