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