]>
Commit | Line | Data |
---|---|---|
f84a2aac XY |
1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
2 | /* | |
3 | * Copyright (c) 2021 Loongson Technology Corporation Limited | |
4 | * | |
5 | * Helpers for IOCSR reads/writes | |
6 | */ | |
7 | ||
8 | #include "qemu/osdep.h" | |
f84a2aac XY |
9 | #include "cpu.h" |
10 | #include "qemu/host-utils.h" | |
11 | #include "exec/helper-proto.h" | |
12 | #include "exec/exec-all.h" | |
13 | #include "exec/cpu_ldst.h" | |
f84a2aac | 14 | |
a649fffc XY |
15 | #define GET_MEMTXATTRS(cas) \ |
16 | ((MemTxAttrs){.requester_id = env_cpu(cas)->cpu_index}) | |
17 | ||
f84a2aac XY |
18 | uint64_t helper_iocsrrd_b(CPULoongArchState *env, target_ulong r_addr) |
19 | { | |
20 | return address_space_ldub(&env->address_space_iocsr, r_addr, | |
a649fffc | 21 | GET_MEMTXATTRS(env), NULL); |
f84a2aac XY |
22 | } |
23 | ||
24 | uint64_t helper_iocsrrd_h(CPULoongArchState *env, target_ulong r_addr) | |
25 | { | |
26 | return address_space_lduw(&env->address_space_iocsr, r_addr, | |
a649fffc | 27 | GET_MEMTXATTRS(env), NULL); |
f84a2aac XY |
28 | } |
29 | ||
30 | uint64_t helper_iocsrrd_w(CPULoongArchState *env, target_ulong r_addr) | |
31 | { | |
32 | return address_space_ldl(&env->address_space_iocsr, r_addr, | |
a649fffc | 33 | GET_MEMTXATTRS(env), NULL); |
f84a2aac XY |
34 | } |
35 | ||
36 | uint64_t helper_iocsrrd_d(CPULoongArchState *env, target_ulong r_addr) | |
37 | { | |
38 | return address_space_ldq(&env->address_space_iocsr, r_addr, | |
a649fffc | 39 | GET_MEMTXATTRS(env), NULL); |
f84a2aac XY |
40 | } |
41 | ||
42 | void helper_iocsrwr_b(CPULoongArchState *env, target_ulong w_addr, | |
43 | target_ulong val) | |
44 | { | |
45 | address_space_stb(&env->address_space_iocsr, w_addr, | |
a649fffc | 46 | val, GET_MEMTXATTRS(env), NULL); |
f84a2aac XY |
47 | } |
48 | ||
49 | void helper_iocsrwr_h(CPULoongArchState *env, target_ulong w_addr, | |
50 | target_ulong val) | |
51 | { | |
52 | address_space_stw(&env->address_space_iocsr, w_addr, | |
a649fffc | 53 | val, GET_MEMTXATTRS(env), NULL); |
f84a2aac XY |
54 | } |
55 | ||
56 | void helper_iocsrwr_w(CPULoongArchState *env, target_ulong w_addr, | |
57 | target_ulong val) | |
58 | { | |
59 | address_space_stl(&env->address_space_iocsr, w_addr, | |
a649fffc | 60 | val, GET_MEMTXATTRS(env), NULL); |
f84a2aac XY |
61 | } |
62 | ||
63 | void helper_iocsrwr_d(CPULoongArchState *env, target_ulong w_addr, | |
64 | target_ulong val) | |
65 | { | |
66 | address_space_stq(&env->address_space_iocsr, w_addr, | |
a649fffc | 67 | val, GET_MEMTXATTRS(env), NULL); |
f84a2aac | 68 | } |