|
|
7b26da |
commit 2492f0d005f0390eabb3deb58aa7db7fcd716763
|
|
|
7b26da |
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
|
|
|
7b26da |
Date: Fri May 8 12:50:47 2015 +0200
|
|
|
7b26da |
|
|
|
7b26da |
S390: Fix for inadvertently setting 24-bit mode in fill_gregset
|
|
|
7b26da |
|
|
|
7b26da |
On 64-bit S390 platforms, for programs compiled with -m31, it could
|
|
|
7b26da |
happen that GDB inadvertently cleared the inferior's 31-bit addressing
|
|
|
7b26da |
mode bit and left the inferior running in 24-bit addressing mode. In
|
|
|
7b26da |
particular this occurred with checkpoint.exp, when the "restore"
|
|
|
7b26da |
command needed to create a new regcache copy: At the time when the
|
|
|
7b26da |
PSWM register was copied over, the addressing mode bit was taken from
|
|
|
7b26da |
the PSWA register, which was still zero since it had not been copied
|
|
|
7b26da |
yet. And when the PSWA register was copied, the addressing mode was
|
|
|
7b26da |
not updated again.
|
|
|
7b26da |
|
|
|
7b26da |
The fix affects fill_gregset, where the bits "belonging" to each of
|
|
|
7b26da |
the PSWA and PSWM registers are now carefully separated. The
|
|
|
7b26da |
addressing mode bit is no longer touched when writing PSWM, and --
|
|
|
7b26da |
more importantly -- it *is* written when writing PSWA.
|
|
|
7b26da |
|
|
|
7b26da |
gdb/ChangeLog:
|
|
|
7b26da |
|
|
|
7b26da |
* s390-linux-nat.c (fill_gregset): Avoid relying on the PSWA
|
|
|
7b26da |
register in the regcache when treating the PSWM register, and vice
|
|
|
7b26da |
versa.
|
|
|
7b26da |
|
|
|
7b26da |
Index: gdb-7.6.1/gdb/s390-nat.c
|
|
|
7b26da |
===================================================================
|
|
|
7b26da |
--- gdb-7.6.1.orig/gdb/s390-nat.c
|
|
|
7b26da |
+++ gdb-7.6.1/gdb/s390-nat.c
|
|
|
7b26da |
@@ -174,19 +174,28 @@ fill_gregset (const struct regcache *reg
|
|
|
7b26da |
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
|
|
7b26da |
ULONGEST pswa, pswm;
|
|
|
7b26da |
gdb_byte buf[4];
|
|
|
7b26da |
+ gdb_byte *pswm_p = (gdb_byte *) regp + 0;
|
|
|
7b26da |
+ gdb_byte *pswa_p = (gdb_byte *) regp + 8;
|
|
|
7b26da |
|
|
|
7b26da |
- regcache_raw_collect (regcache, S390_PSWM_REGNUM, buf);
|
|
|
7b26da |
- pswm = extract_unsigned_integer (buf, 4, byte_order);
|
|
|
7b26da |
- regcache_raw_collect (regcache, S390_PSWA_REGNUM, buf);
|
|
|
7b26da |
- pswa = extract_unsigned_integer (buf, 4, byte_order);
|
|
|
7b26da |
+ pswm = extract_unsigned_integer (pswm_p, 8, byte_order);
|
|
|
7b26da |
|
|
|
7b26da |
if (regno == -1 || regno == S390_PSWM_REGNUM)
|
|
|
7b26da |
- store_unsigned_integer (psw_p[0], 8, byte_order,
|
|
|
7b26da |
- ((pswm & 0xfff7ffff) << 32) |
|
|
|
7b26da |
- (pswa & 0x80000000));
|
|
|
7b26da |
+ {
|
|
|
7b26da |
+ pswm &= 0x80000000;
|
|
|
7b26da |
+ regcache_raw_collect (regcache, S390_PSWM_REGNUM, buf);
|
|
|
7b26da |
+ pswm |= (extract_unsigned_integer (buf, 4, byte_order)
|
|
|
7b26da |
+ & 0xfff7ffff) << 32;
|
|
|
7b26da |
+ }
|
|
|
7b26da |
if (regno == -1 || regno == S390_PSWA_REGNUM)
|
|
|
7b26da |
- store_unsigned_integer (psw_p[1], 8, byte_order,
|
|
|
7b26da |
- pswa & 0x7fffffff);
|
|
|
7b26da |
+ {
|
|
|
7b26da |
+ regcache_raw_collect (regcache, S390_PSWA_REGNUM, buf);
|
|
|
7b26da |
+ pswa = extract_unsigned_integer (buf, 4, byte_order);
|
|
|
7b26da |
+ pswm ^= (pswm ^ pswa) & 0x80000000;
|
|
|
7b26da |
+ pswa &= 0x7fffffff;
|
|
|
7b26da |
+ store_unsigned_integer (pswa_p, 8, byte_order, pswa);
|
|
|
7b26da |
+ }
|
|
|
7b26da |
+
|
|
|
7b26da |
+ store_unsigned_integer (pswm_p, 8, byte_order, pswm);
|
|
|
7b26da |
}
|
|
|
7b26da |
return;
|
|
|
7b26da |
}
|