|
| From: | Richard Henderson |
| Subject: | Re: [RFC PATCH v7 07/29] target/loongarch: Add LoongArch CSR instruction |
| Date: | Wed, 30 Mar 2022 07:46:45 -0600 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 |
On 3/30/22 04:01, yangxiaojuan wrote:
trans_csrrd {
...
switch(a->csr) {
case LOONGARCH_CSR_PGD:
gen_helper_csrrd_pgd();
break;
case LOONGARCH_CSR_TVAL:
gen_helper_csrrd_tval();
break;
case LOONGARCH_CSR_CPUID:
...
default:
...
}
}
And the same in trans_csrwr, is this right?
That's the idea, yes. However, you'll want to pull these switches out to helper functions within trans_privileged.c.inc so that you may reuse them for trans_csrxchg.
r~
| [Prev in Thread] | Current Thread | [Next in Thread] |