Changeset View
Changeset View
Standalone View
Standalone View
sys/riscv/riscv/db_disasm.c
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | case 'C': /* C-Compressed ISA extension */ | ||||
imm |= 0xffffff << 8; | imm |= 0xffffff << 8; | ||||
db_printf("%d", imm); | db_printf("%d", imm); | ||||
break; | break; | ||||
case 'u': | case 'u': | ||||
imm = ((insn >> 2) & 0x1f) << 0; | imm = ((insn >> 2) & 0x1f) << 0; | ||||
imm |= ((insn >> 12) & 0x1) << 5; | imm |= ((insn >> 12) & 0x1) << 5; | ||||
if (imm & (1 << 5)) | if (imm & (1 << 5)) | ||||
imm |= (0x7ffffff << 5); /* sign ext */ | imm |= (0x7ffffff << 5); /* sign ext */ | ||||
db_printf("0x%lx", imm); | db_printf("0x%x", imm); | ||||
arichardson: Could also use %x since it's an int? How is this not triggering warnings with clang? | |||||
Done Inline ActionsYeah, that is better. Looks like -Wno-format is passed when MK_FORMAT_EXTENSIONS == "no", so that would be why clang hasn't complained. I'm enabling it in D26320. mhorne: Yeah, that is better.
Looks like `-Wno-format` is passed when `MK_FORMAT_EXTENSIONS == "no"`… | |||||
break; | break; | ||||
case 'o': | case 'o': | ||||
imm = ((insn >> 2) & 0x1f) << 0; | imm = ((insn >> 2) & 0x1f) << 0; | ||||
imm |= ((insn >> 12) & 0x1) << 5; | imm |= ((insn >> 12) & 0x1) << 5; | ||||
if (imm & (1 << 5)) | if (imm & (1 << 5)) | ||||
imm |= (0x7ffffff << 5); /* sign ext */ | imm |= (0x7ffffff << 5); /* sign ext */ | ||||
db_printf("%d", imm); | db_printf("%d", imm); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | case 'a': | ||||
imm |= (0xfff << 20); /* sign extend */ | imm |= (0xfff << 20); /* sign extend */ | ||||
db_printf("0x%lx", (loc + imm)); | db_printf("0x%lx", (loc + imm)); | ||||
break; | break; | ||||
case 'u': | case 'u': | ||||
/* imm[31:12] << 12 */ | /* imm[31:12] << 12 */ | ||||
imm = (insn >> 12) & 0xfffff; | imm = (insn >> 12) & 0xfffff; | ||||
if (imm & (1 << 20)) | if (imm & (1 << 20)) | ||||
imm |= (0xfff << 20); /* sign extend */ | imm |= (0xfff << 20); /* sign extend */ | ||||
db_printf("0x%lx", imm); | db_printf("0x%x", imm); | ||||
Not Done Inline ActionsSame here? arichardson: Same here? | |||||
break; | break; | ||||
case 'j': | case 'j': | ||||
/* imm[11:0] << 20 */ | /* imm[11:0] << 20 */ | ||||
imm = (insn >> 20) & 0xfff; | imm = (insn >> 20) & 0xfff; | ||||
if (imm & (1 << 11)) | if (imm & (1 << 11)) | ||||
imm |= (0xfffff << 12); /* sign extend */ | imm |= (0xfffff << 12); /* sign extend */ | ||||
db_printf("%d", imm); | db_printf("%d", imm); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |
Could also use %x since it's an int? How is this not triggering warnings with clang?