修訂 | b7c8601a7f2874de1bbe0dc38ef86ea053593ad8 (tree) |
---|---|
時間 | 2018-12-14 03:48:23 |
作者 | Jim Wilson <jimw@sifi...> |
Commiter | Jim Wilson |
RISC-V: Correct printing of MSTATUS and MISA.
* riscv-tdep.c (riscv_print_one_register_info): For MSTATUS, add
comment for SD field, and correct xlen calculation. For MISA, add
comment for MXL field, add call to register_size, and correct base
calculation.
@@ -1,3 +1,10 @@ | ||
1 | +2018-12-13 Jim Wilson <jimw@sifive.com> | |
2 | + | |
3 | + * riscv-tdep.c (riscv_print_one_register_info): For MSTATUS, add | |
4 | + comment for SD field, and correct xlen calculation. For MISA, add | |
5 | + comment for MXL field, add call to register_size, and correct base | |
6 | + calculation. | |
7 | + | |
1 | 8 | 2018-12-13 Stafford Horne <shorne@gmail.com> |
2 | 9 | |
3 | 10 | * NEWS(New targets): Add or1k*-*-linux*. |
@@ -701,8 +701,10 @@ riscv_print_one_register_info (struct gdbarch *gdbarch, | ||
701 | 701 | int size = register_size (gdbarch, regnum); |
702 | 702 | unsigned xlen; |
703 | 703 | |
704 | + /* The SD field is always in the upper bit of MSTATUS, regardless | |
705 | + of the number of bits in MSTATUS. */ | |
704 | 706 | d = value_as_long (val); |
705 | - xlen = size * 4; | |
707 | + xlen = size * 8; | |
706 | 708 | fprintf_filtered (file, |
707 | 709 | "\tSD:%X VM:%02X MXR:%X PUM:%X MPRV:%X XS:%X " |
708 | 710 | "FS:%X MPP:%x HPP:%X SPP:%X MPIE:%X HPIE:%X " |
@@ -731,9 +733,13 @@ riscv_print_one_register_info (struct gdbarch *gdbarch, | ||
731 | 733 | int base; |
732 | 734 | unsigned xlen, i; |
733 | 735 | LONGEST d; |
736 | + int size = register_size (gdbarch, regnum); | |
734 | 737 | |
738 | + /* The MXL field is always in the upper two bits of MISA, | |
739 | + regardless of the number of bits in MISA. Mask out other | |
740 | + bits to ensure we have a positive value. */ | |
735 | 741 | d = value_as_long (val); |
736 | - base = d >> 30; | |
742 | + base = (d >> ((size * 8) - 2)) & 0x3; | |
737 | 743 | xlen = 16; |
738 | 744 | |
739 | 745 | for (; base > 0; base--) |