]> git.proxmox.com Git - mirror_qemu.git/blame - target/mips/tcg/sysemu/lcsr_helper.c
Merge tag 'pull-maintainer-may24-160524-2' of https://gitlab.com/stsquad/qemu into...
[mirror_qemu.git] / target / mips / tcg / sysemu / lcsr_helper.c
CommitLineData
03afdc28
JY
1/*
2 * Loongson CSR instructions translation routines
3 *
4 * Copyright (c) 2023 Jiaxun Yang <jiaxun.yang@flygoat.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "qemu/osdep.h"
03afdc28 10#include "cpu.h"
03afdc28 11#include "exec/helper-proto.h"
03afdc28
JY
12
13#define GET_MEMTXATTRS(cas) \
14 ((MemTxAttrs){.requester_id = env_cpu(cas)->cpu_index})
15
16uint64_t helper_lcsr_rdcsr(CPUMIPSState *env, target_ulong r_addr)
17{
18 return address_space_ldl(&env->iocsr.as, r_addr,
19 GET_MEMTXATTRS(env), NULL);
20}
21
22uint64_t helper_lcsr_drdcsr(CPUMIPSState *env, target_ulong r_addr)
23{
24 return address_space_ldq(&env->iocsr.as, r_addr,
25 GET_MEMTXATTRS(env), NULL);
26}
27
28void helper_lcsr_wrcsr(CPUMIPSState *env, target_ulong w_addr,
29 target_ulong val)
30{
31 address_space_stl(&env->iocsr.as, w_addr,
32 val, GET_MEMTXATTRS(env), NULL);
33}
34
35void helper_lcsr_dwrcsr(CPUMIPSState *env, target_ulong w_addr,
36 target_ulong val)
37{
38 address_space_stq(&env->iocsr.as, w_addr,
39 val, GET_MEMTXATTRS(env), NULL);
40}