From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1983) id 5ADBC385736D; Fri, 10 Jun 2022 16:18:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5ADBC385736D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Carl Love To: gdb-cvs@sourceware.org Subject: [binutils-gdb] PowerPC, correct the gdb ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF. X-Act-Checkin: binutils-gdb X-Git-Author: Carl Love X-Git-Refname: refs/heads/master X-Git-Oldrev: 80c0a3bf1b949403521d186fc04ed9052ea1d7d4 X-Git-Newrev: b69a68b93bf31bf17fe0b9db3fef4f4d6d089626 Message-Id: <20220610161807.5ADBC385736D@sourceware.org> Date: Fri, 10 Jun 2022 16:18:07 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2022 16:18:07 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db69a68b93bf3= 1bf17fe0b9db3fef4f4d6d089626 commit b69a68b93bf31bf17fe0b9db3fef4f4d6d089626 Author: Carl Love Date: Fri Jun 10 16:17:27 2022 +0000 PowerPC, correct the gdb ioctl values for TCGETS, TCSETS, TCSETSW and T= CSETSF. =20 Some of the ioctl numbers are based on the size of kernel termios struc= ture. Currently the PowerPC GDB definitions are "hard coded" into the ioctl number. =20 The current PowerPC values for TCGETS, TCSETS, TCSETSW and TCSETSF are defined in gdb/ppc-linux-tdep.c as: =20 record_tdep->ioctl_TCGETS =3D 0x403c7413; record_tdep->ioctl_TCSETS =3D 0x803c7414; record_tdep->ioctl_TCSETSW =3D 0x803c7415; record_tdep->ioctl_TCSETSF =3D 0x803c7416; =20 Where the termios structure size is in hex digits [5:4] as 0x3c. =20 The definition for the PowerPC termios structure is given in: arch/powerpc/include/uapi/asm/termbits.h =20 The size of the termios data structure in this file is 0x2c not 0x3c. =20 This patch changes the hex digits for the size of the PowerPC termios s= ize 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 !=3D 0) return; @@ -1899,14 +1904,15 @@ ppc_init_linux_record_tdep (struct linux_record_tde= p *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 =3D 0x403c7413; - record_tdep->ioctl_TCSETS =3D 0x803c7414; - record_tdep->ioctl_TCSETSW =3D 0x803c7415; - record_tdep->ioctl_TCSETSF =3D 0x803c7416; record_tdep->ioctl_TCGETA =3D 0x40147417; record_tdep->ioctl_TCSETA =3D 0x80147418; record_tdep->ioctl_TCSETAW =3D 0x80147419; record_tdep->ioctl_TCSETAF =3D 0x8014741c; + record_tdep->ioctl_TCGETS =3D 0x40007413 | (SIZE_OF_STRUCT_TERMIOS << 16= ); + record_tdep->ioctl_TCSETS =3D 0x80007414 | (SIZE_OF_STRUCT_TERMIOS << 16= ); + record_tdep->ioctl_TCSETSW =3D 0x80007415 | (SIZE_OF_STRUCT_TERMIOS << 1= 6); + record_tdep->ioctl_TCSETSF =3D 0x80007416 | (SIZE_OF_STRUCT_TERMIOS << 1= 6); + record_tdep->ioctl_TCSBRK =3D 0x2000741d; record_tdep->ioctl_TCXONC =3D 0x2000741e; record_tdep->ioctl_TCFLSH =3D 0x2000741f;