|
179 | 179 | #define RV___RS1(v) __RV_REG(v) |
180 | 180 | #define RV___RS2(v) __RV_REG(v) |
181 | 181 |
|
| 182 | +#define RV_OPCODE_AMO RV_OPCODE(47) |
182 | 183 | #define RV_OPCODE_MISC_MEM RV_OPCODE(15) |
183 | 184 | #define RV_OPCODE_OP_IMM RV_OPCODE(19) |
184 | 185 | #define RV_OPCODE_SYSTEM RV_OPCODE(115) |
|
208 | 209 | __ASM_STR(.error "hlv.d requires 64-bit support") |
209 | 210 | #endif |
210 | 211 |
|
| 212 | +#define LB_AQ(dest, addr) \ |
| 213 | + INSN_R(OPCODE_AMO, FUNC3(0), FUNC7(26), \ |
| 214 | + RD(dest), RS1(addr), __RS2(0)) |
| 215 | + |
| 216 | +#define LB_AQRL(dest, addr) \ |
| 217 | + INSN_R(OPCODE_AMO, FUNC3(0), FUNC7(27), \ |
| 218 | + RD(dest), RS1(addr), __RS2(0)) |
| 219 | + |
| 220 | +#define LH_AQ(dest, addr) \ |
| 221 | + INSN_R(OPCODE_AMO, FUNC3(1), FUNC7(26), \ |
| 222 | + RD(dest), RS1(addr), __RS2(0)) |
| 223 | + |
| 224 | +#define LH_AQRL(dest, addr) \ |
| 225 | + INSN_R(OPCODE_AMO, FUNC3(1), FUNC7(27), \ |
| 226 | + RD(dest), RS1(addr), __RS2(0)) |
| 227 | + |
| 228 | +#define LW_AQ(dest, addr) \ |
| 229 | + INSN_R(OPCODE_AMO, FUNC3(2), FUNC7(26), \ |
| 230 | + RD(dest), RS1(addr), __RS2(0)) |
| 231 | + |
| 232 | +#define LW_AQRL(dest, addr) \ |
| 233 | + INSN_R(OPCODE_AMO, FUNC3(2), FUNC7(27), \ |
| 234 | + RD(dest), RS1(addr), __RS2(0)) |
| 235 | + |
| 236 | +#define SB_RL(src, addr) \ |
| 237 | + INSN_R(OPCODE_AMO, FUNC3(0), FUNC7(29), \ |
| 238 | + __RD(0), RS1(addr), RS2(src)) |
| 239 | + |
| 240 | +#define SB_AQRL(src, addr) \ |
| 241 | + INSN_R(OPCODE_AMO, FUNC3(0), FUNC7(31), \ |
| 242 | + __RD(0), RS1(addr), RS2(src)) |
| 243 | + |
| 244 | +#define SH_RL(src, addr) \ |
| 245 | + INSN_R(OPCODE_AMO, FUNC3(1), FUNC7(29), \ |
| 246 | + __RD(0), RS1(addr), RS2(src)) |
| 247 | + |
| 248 | +#define SH_AQRL(src, addr) \ |
| 249 | + INSN_R(OPCODE_AMO, FUNC3(1), FUNC7(31), \ |
| 250 | + __RD(0), RS1(addr), RS2(src)) |
| 251 | + |
| 252 | +#define SW_RL(src, addr) \ |
| 253 | + INSN_R(OPCODE_AMO, FUNC3(2), FUNC7(29), \ |
| 254 | + __RD(0), RS1(addr), RS2(src)) |
| 255 | + |
| 256 | +#define SW_AQRL(src, addr) \ |
| 257 | + INSN_R(OPCODE_AMO, FUNC3(2), FUNC7(31), \ |
| 258 | + __RD(0), RS1(addr), RS2(src)) |
| 259 | + |
| 260 | +#ifdef CONFIG_64BIT |
| 261 | +#define LD_AQ(dest, addr) \ |
| 262 | + INSN_R(OPCODE_AMO, FUNC3(3), FUNC7(26), \ |
| 263 | + RD(dest), RS1(addr), __RS2(0)) |
| 264 | + |
| 265 | +#define LD_AQRL(dest, addr) \ |
| 266 | + INSN_R(OPCODE_AMO, FUNC3(3), FUNC7(27), \ |
| 267 | + RD(dest), RS1(addr), __RS2(0)) |
| 268 | + |
| 269 | +#define SD_RL(src, addr) \ |
| 270 | + INSN_R(OPCODE_AMO, FUNC3(3), FUNC7(29), \ |
| 271 | + __RD(0), RS1(addr), RS2(src)) |
| 272 | + |
| 273 | +#define SD_AQRL(src, addr) \ |
| 274 | + INSN_R(OPCODE_AMO, FUNC3(3), FUNC7(31), \ |
| 275 | + __RD(0), RS1(addr), RS2(src)) |
| 276 | +#else |
| 277 | +#define LD_AQ(dest, addr) \ |
| 278 | + __ASM_STR(.error "ld.aq requires 64-bit support") |
| 279 | + |
| 280 | +#define LD_AQRL(dest, addr) \ |
| 281 | + __ASM_STR(.error "ld.aqrl requires 64-bit support") |
| 282 | + |
| 283 | +#define SD_RL(dest, addr) \ |
| 284 | + __ASM_STR(.error "sd.rl requires 64-bit support") |
| 285 | + |
| 286 | +#define SD_AQRL(dest, addr) \ |
| 287 | + __ASM_STR(.error "sd.aqrl requires 64-bit support") |
| 288 | +#endif |
| 289 | + |
211 | 290 | #define SINVAL_VMA(vaddr, asid) \ |
212 | 291 | INSN_R(OPCODE_SYSTEM, FUNC3(0), FUNC7(11), \ |
213 | 292 | __RD(0), RS1(vaddr), RS2(asid)) |
|
0 commit comments