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~

Reply via email to