public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Carl Love <carll@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] PowerPC, correct the gdb ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF.
Date: Fri, 10 Jun 2022 16:18:07 +0000 (GMT)	[thread overview]
Message-ID: <20220610161807.5ADBC385736D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b69a68b93bf31bf17fe0b9db3fef4f4d6d089626

commit b69a68b93bf31bf17fe0b9db3fef4f4d6d089626
Author: Carl Love <cel@us.ibm.com>
Date:   Fri Jun 10 16:17:27 2022 +0000

    PowerPC, correct the gdb ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF.
    
    Some of the ioctl numbers are based on the size of kernel termios structure.
    Currently the PowerPC GDB definitions are "hard coded" into the ioctl
    number.
    
    The current PowerPC values for TCGETS, TCSETS, TCSETSW and TCSETSF are
    defined in gdb/ppc-linux-tdep.c as:
    
      record_tdep->ioctl_TCGETS = 0x403c7413;
      record_tdep->ioctl_TCSETS = 0x803c7414;
      record_tdep->ioctl_TCSETSW = 0x803c7415;
      record_tdep->ioctl_TCSETSF = 0x803c7416;
    
    Where the termios structure size is in hex digits [5:4] as 0x3c.
    
    The definition for the PowerPC termios structure is given in:
      arch/powerpc/include/uapi/asm/termbits.h
    
    The size of the termios data structure in this file is 0x2c not 0x3c.
    
    This patch changes the hex digits for the size of the PowerPC termios size
    in the ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF to 0x2c.
    This patch also changes the hard coding to generate the number based on a
    it easier to update the ioctl numbers.

Diff:
---
 gdb/ppc-linux-tdep.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 4c5f8b7a281..bf95f395515 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1738,6 +1738,11 @@ static void
 ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
 			    int wordsize)
 {
+  /* The values for TCGETS, TCSETS, TCSETSW, TCSETSF are based on the
+     size of struct termios in the kernel source.
+     include/uapi/asm-generic/termbits.h  */
+#define SIZE_OF_STRUCT_TERMIOS  0x2c
+
   /* Simply return if it had been initialized.  */
   if (record_tdep->size_pointer != 0)
     return;
@@ -1899,14 +1904,15 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
   /* These values are the second argument of system call "sys_ioctl".
      They are obtained from Linux Kernel source.
      See arch/powerpc/include/uapi/asm/ioctls.h.  */
-  record_tdep->ioctl_TCGETS = 0x403c7413;
-  record_tdep->ioctl_TCSETS = 0x803c7414;
-  record_tdep->ioctl_TCSETSW = 0x803c7415;
-  record_tdep->ioctl_TCSETSF = 0x803c7416;
   record_tdep->ioctl_TCGETA = 0x40147417;
   record_tdep->ioctl_TCSETA = 0x80147418;
   record_tdep->ioctl_TCSETAW = 0x80147419;
   record_tdep->ioctl_TCSETAF = 0x8014741c;
+  record_tdep->ioctl_TCGETS = 0x40007413 | (SIZE_OF_STRUCT_TERMIOS << 16);
+  record_tdep->ioctl_TCSETS = 0x80007414 | (SIZE_OF_STRUCT_TERMIOS << 16);
+  record_tdep->ioctl_TCSETSW = 0x80007415 | (SIZE_OF_STRUCT_TERMIOS << 16);
+  record_tdep->ioctl_TCSETSF = 0x80007416 | (SIZE_OF_STRUCT_TERMIOS << 16);
+
   record_tdep->ioctl_TCSBRK = 0x2000741d;
   record_tdep->ioctl_TCXONC = 0x2000741e;
   record_tdep->ioctl_TCFLSH = 0x2000741f;


                 reply	other threads:[~2022-06-10 16:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220610161807.5ADBC385736D@sourceware.org \
    --to=carll@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).