On 2026/5/26 下午3:48, gaosong wrote:
在 2026/5/26 下午2:50, Bibo Mao 写道:
Here new structure CPUSysState is added in CPULoongArchState, CSR
registers are move in CPUSysState. In later with LVZ supported, there will
be two copied of CSR registers, so it is simply to add CPUSysState array.

Also new field curState is added which points to CPUSysState at
beginning, and it can be changed during VM exit/enter entry. There is no
function change, all is code movement or variable rename.

Bibo Mao (12):
   target/loongarch: Add new field curState in CPULoongArchState
   target/loongarch: Use curState in cpu.c when accessing CSR registers
   target/loongarch: Use curState in cpu_helper.c when accessing CSR
     registers
   target/loongarch: Use curState in file arch_dump.c when accessing CSR
     registers
   target/loongarch: Use curState in kvm.c when accessing CSR registers
   target/loongarch: Use curState in tlb_helper.c when accessing CSR
     registers
   target/loongarch: Use curState in tcg_cpu.c when accessing CSR
     registers
   target/loongarch: Use curState in csr_helper.c when accessing CSR
     registers
   target/loongarch: Use curState in op_helper.c when accessing CSR
     registers
   target/loongarch: Add default CSRFL_BASIC info with flags field
   target/loongarch: Add wrapper function get_csr_offset()
   target/loongarch: Add new structure CPUSysState

  hw/intc/loongarch_dintc.c                     |   4 +-
  target/loongarch/arch_dump.c                  |   5 +-
  target/loongarch/cpu-mmu.h                    |   4 +-
  target/loongarch/cpu.c                        | 120 ++++-----
  target/loongarch/cpu.h                        |  49 ++--
  target/loongarch/cpu_helper.c                 |  41 ++--
  target/loongarch/csr.c                        |  10 +-
  target/loongarch/csr.h                        |   5 +
  target/loongarch/gdbstub.c                    |   3 +-
  target/loongarch/kvm/kvm.c                    | 228 +++++++++---------
  target/loongarch/machine.c                    | 116 ++++-----
  target/loongarch/tcg/constant_timer.c         |  10 +-
  target/loongarch/tcg/csr_helper.c             |  55 +++--
  .../tcg/insn_trans/trans_extra.c.inc          |  11 +-
  .../tcg/insn_trans/trans_privileged.c.inc     |  16 +-
  target/loongarch/tcg/op_helper.c              |  45 ++--
  target/loongarch/tcg/tcg_cpu.c                | 107 ++++----
  target/loongarch/tcg/tlb_helper.c             | 137 ++++++-----
  18 files changed, 531 insertions(+), 435 deletions(-)

Hi,
The files in linux-user/loongarch64/* also need to be modified.
oops, loongarch-linux-user is missing here. Thanks for the reporting.
Will add and test this target.

Regards
Bibo Mao

Thanks.
Song Gao
base-commit: cbf877d67a812be17a9ce404a589e1bdf722c1f6


Reply via email to