From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: RFC: s390x: correct core file register layout
Date: Fri, 23 May 2003 06:58:00 -0000 [thread overview]
Message-ID: <vt24r3mywfe.fsf@zenia.red-bean.com> (raw)
2003-05-23 Jim Blandy <jimb@redhat.com>
* s390-nat.c (supply_gregset, fill_gregset): On the s390x, the
elements of gregset_t are 64 bits each, but access registers
are still 32 bits, so they're packed two per gregset_t
element. Unpack/pack them properly.
Index: gdb/s390-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-nat.c,v
retrieving revision 1.7
diff -c -r1.7 s390-nat.c
*** gdb/s390-nat.c 14 Apr 2003 14:21:07 -0000 1.7
--- gdb/s390-nat.c 23 May 2003 06:52:07 -0000
***************
*** 251,259 ****
for (regi = 0; regi < S390_NUM_GPRS; regi++)
supply_register (S390_GP0_REGNUM + regi,
(char *) &gregp[S390_GP0_REGNUM + regi]);
for (regi = 0; regi < S390_NUM_ACRS; regi++)
supply_register (S390_FIRST_ACR + regi,
! (char *) &gregp[S390_FIRST_ACR + regi]);
/* unfortunately this isn't in gregsetp */
for (regi = 0; regi < S390_NUM_CRS; regi++)
supply_register (S390_FIRST_CR + regi, NULL);
--- 251,276 ----
for (regi = 0; regi < S390_NUM_GPRS; regi++)
supply_register (S390_GP0_REGNUM + regi,
(char *) &gregp[S390_GP0_REGNUM + regi]);
+
+ #if defined (CONFIG_ARCH_S390X)
+ /* On the s390x, each element of gregset_t is 8 bytes long, but
+ each access register is still only 32 bits long. So they're
+ packed two per element. It's apparently traditional that
+ gregset_t must be an array, so when the registers it provides
+ have different sizes, something has to get strange
+ somewhere. */
+ {
+ unsigned int *acrs = (unsigned int *) &gregp[S390_FIRST_ACR];
+
+ for (regi = 0; regi < S390_NUM_ACRS; regi++)
+ supply_register (S390_FIRST_ACR + regi, (char *) &acrs[regi]);
+ }
+ #else
for (regi = 0; regi < S390_NUM_ACRS; regi++)
supply_register (S390_FIRST_ACR + regi,
! (char *) &gregp[S390_FIRST_ACR + regi]);
! #endif
!
/* unfortunately this isn't in gregsetp */
for (regi = 0; regi < S390_NUM_CRS; regi++)
supply_register (S390_FIRST_CR + regi, NULL);
***************
*** 284,295 ****
for (regi = 0; regi < S390_NUM_GPRS; regi++)
regcache_collect (S390_GP0_REGNUM + regi,
&gregp[S390_GP0_REGNUM + regi]);
for (regi = 0; regi < S390_NUM_ACRS; regi++)
regcache_collect (S390_FIRST_ACR + regi,
&gregp[S390_FIRST_ACR + regi]);
}
! else if (regno >= S390_PSWM_REGNUM && regno <= S390_LAST_ACR)
regcache_collect (regno, &gregp[regno]);
}
/* Given a pointer to a floating point register set in /proc format
--- 301,335 ----
for (regi = 0; regi < S390_NUM_GPRS; regi++)
regcache_collect (S390_GP0_REGNUM + regi,
&gregp[S390_GP0_REGNUM + regi]);
+ #if defined (CONFIG_ARCH_S390X)
+ /* See the comments about the access registers in
+ supply_gregset, above. */
+ {
+ unsigned int *acrs = (unsigned int *) &gregp[S390_FIRST_ACR];
+
+ for (regi = 0; regi < S390_NUM_ACRS; regi++)
+ regcache_collect (S390_FIRST_ACR + regi, &acrs[regi]);
+ }
+ #else
for (regi = 0; regi < S390_NUM_ACRS; regi++)
regcache_collect (S390_FIRST_ACR + regi,
&gregp[S390_FIRST_ACR + regi]);
+ #endif
}
! else if (regno >= S390_PSWM_REGNUM && regno < S390_FIRST_ACR)
regcache_collect (regno, &gregp[regno]);
+ else if (regno >= S390_FIRST_ACR && regno <= S390_LAST_ACR)
+ {
+ #if defined (CONFIG_ARCH_S390X)
+ /* See the comments about the access registers in
+ supply_gregset, above. */
+ unsigned int *acrs = (unsigned int *) &gregp[S390_FIRST_ACR];
+
+ regcache_collect (regno, &acrs[regno - S390_FIRST_ACR]);
+ #else
+ regcache_collect (regno, &gregp[regno]);
+ #endif
+ }
}
/* Given a pointer to a floating point register set in /proc format
next reply other threads:[~2003-05-23 6:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-23 6:58 Jim Blandy [this message]
2003-06-03 0:59 ` Michael Snyder
2003-06-03 5:48 ` Jim Blandy
2003-06-03 13:03 ` Daniel Jacobowitz
2003-06-03 16:59 ` Jim Blandy
2003-06-03 5:49 ` Jim Blandy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vt24r3mywfe.fsf@zenia.red-bean.com \
--to=jimb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox