diff options
| author | Bibo Mao <maobibo@loongson.cn> | 2025-01-22 15:21:01 +0800 |
|---|---|---|
| committer | Bibo Mao <maobibo@loongson.cn> | 2025-01-24 14:49:24 +0800 |
| commit | d03114ea20e043278306f168bcf306a6605ed4a5 (patch) | |
| tree | 1fb08db512792e53c74ef846cadc4c28d1c172fc | |
| parent | 75b2c5da94fc9f94370438d27c179abcc8f424be (diff) | |
| download | qemu-d03114ea20e043278306f168bcf306a6605ed4a5.zip qemu-d03114ea20e043278306f168bcf306a6605ed4a5.tar.gz qemu-d03114ea20e043278306f168bcf306a6605ed4a5.tar.bz2 | |
target/loongarch: Add common header file for CSR registers
Common header file csr.h is added here, it can be used by both
TCG mode and kvm mode.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
| -rw-r--r-- | target/loongarch/csr.h | 25 | ||||
| -rw-r--r-- | target/loongarch/tcg/insn_trans/trans_privileged.c.inc | 16 |
2 files changed, 26 insertions, 15 deletions
diff --git a/target/loongarch/csr.h b/target/loongarch/csr.h new file mode 100644 index 0000000..20d4bf5 --- /dev/null +++ b/target/loongarch/csr.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2025 Loongson Technology Corporation Limited + */ + +#ifndef TARGET_LOONGARCH_CSR_H +#define TARGET_LOONGARCH_CSR_H + +#include "cpu-csr.h" + +typedef void (*GenCSRFunc)(void); +enum { + CSRFL_READONLY = (1 << 0), + CSRFL_EXITTB = (1 << 1), + CSRFL_IO = (1 << 2), +}; + +typedef struct { + int offset; + int flags; + GenCSRFunc readfn; + GenCSRFunc writefn; +} CSRInfo; + +#endif /* TARGET_LOONGARCH_CSR_H */ diff --git a/target/loongarch/tcg/insn_trans/trans_privileged.c.inc b/target/loongarch/tcg/insn_trans/trans_privileged.c.inc index 0513cac..87506ec 100644 --- a/target/loongarch/tcg/insn_trans/trans_privileged.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_privileged.c.inc @@ -5,7 +5,7 @@ * LoongArch translation routines for the privileged instructions. */ -#include "cpu-csr.h" +#include "csr.h" #ifdef CONFIG_USER_ONLY @@ -44,20 +44,6 @@ GEN_FALSE_TRANS(idle) typedef void (*GenCSRRead)(TCGv dest, TCGv_ptr env); typedef void (*GenCSRWrite)(TCGv dest, TCGv_ptr env, TCGv src); -typedef void (*GenCSRFunc)(void); - -typedef struct { - int offset; - int flags; - GenCSRFunc readfn; - GenCSRFunc writefn; -} CSRInfo; - -enum { - CSRFL_READONLY = (1 << 0), - CSRFL_EXITTB = (1 << 1), - CSRFL_IO = (1 << 2), -}; #define CSR_OFF_FUNCS(NAME, FL, RD, WR) \ [LOONGARCH_CSR_##NAME] = { \ |
