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>
This commit is contained in:
parent
75b2c5da94
commit
d03114ea20
25
target/loongarch/csr.h
Normal file
25
target/loongarch/csr.h
Normal file
@ -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 */
|
@ -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] = { \
|
||||
|
Loading…
x
Reference in New Issue
Block a user