On 2/6/26 05:00, Bibo Mao wrote:
Add wrapper function get_csr_offset(), it is to get offset from structure
CPULoongArchState. There is no function change, and it is used for future
LVZ feature.
Signed-off-by: Bibo Mao <[email protected]>
---
target/loongarch/cpu.c | 4 ++--
target/loongarch/csr.h | 4 ++++
.../tcg/insn_trans/trans_privileged.c.inc | 16 +++++++++++-----
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/target/loongarch/csr.h b/target/loongarch/csr.h
index 508a3214fc..ed7c603a0b 100644
--- a/target/loongarch/csr.h
+++ b/target/loongarch/csr.h
@@ -27,4 +27,8 @@ typedef struct {
CSRInfo *get_csr(unsigned int csr_num);
bool set_csr_flag(unsigned int csr_num, int flag);
+static inline int get_csr_offset(const CSRInfo *csr, int vm_level)
unsigned
+{
+ return csr->offset;
+}
#endif /* TARGET_LOONGARCH_CSR_H */