On 4/26/22 02:03, yangxiaojuan wrote:
Hi, Richard
On 2022/4/26 上午6:55, Richard Henderson wrote:
On 4/25/22 02:10, Xiaojuan Yang wrote:
+static void output_r_csr(DisasContext *ctx, arg_r_csr *a,
+ const char *mnemonic)
+{
+ output(ctx, mnemonic, "r%d, %d # %s", a->rd, a->csr, csr_names[a->csr]);
+}
+
+static void output_rr_csr(DisasContext *ctx, arg_rr_csr *a,
+ const char *mnemonic)
+{
+ output(ctx, mnemonic, "r%d, r%d, %d # %s",
+ a->rd, a->rj, a->csr, csr_names[a->csr]);
Need to check for csr not in csr_names.
I will re-used get_csr() to check csr,
like this:
if (get_csr() == NULL)
{
printf("Undefined CSR.\n");
} else {
printf(" %s\n", csr_names[a->csr]);
}
No, please don't. Since this is used twice, you may wish to create a local get_csr_name()
function, but it's as simple as checking ARRAY_SIZE(csr_names), and validating that the
entry has a name.
The disassembler should stay self-contained, so that we may re-use it for tcg/loongarch64
host disassembly.
r~