From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11389 invoked by alias); 5 Jun 2012 13:16:49 -0000 Received: (qmail 11290 invoked by uid 22791); 5 Jun 2012 13:16:47 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Jun 2012 13:16:33 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id q55DGUCT021847; Tue, 5 Jun 2012 15:16:30 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id q55DGSq4017712; Tue, 5 Jun 2012 15:16:28 +0200 (CEST) Date: Tue, 05 Jun 2012 13:16:00 -0000 Message-Id: <201206051316.q55DGSq4017712@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: hjl.tools@gmail.com CC: gdb-patches@sourceware.org In-reply-to: (hjl.tools@gmail.com) Subject: Re: x32 ABI Support (was Re: Three weeks to branching (gdb 7.5 release)) References: <20120511181737.GP29339@adacore.com> <201205202043.q4KKhRGw022215@glazunov.sibelius.xs4all.nl> <201205202138.q4KLcWBf011913@glazunov.sibelius.xs4all.nl> <201205282026.q4SKQ737007589@glazunov.sibelius.xs4all.nl> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00119.txt.bz2 > Date: Tue, 5 Jun 2012 05:58:18 -0700 > From: "H.J. Lu" > > On Thu, May 31, 2012 at 11:18 AM, H.J. Lu wrote: > > On Mon, May 28, 2012 at 2:18 PM, H.J. Lu wrote: > >> On Mon, May 28, 2012 at 1:26 PM, Mark Kettenis wrote: > >>>> Date: Sun, 20 May 2012 15:48:54 -0700 > >>>> From: "H.J. Lu" > >>>> > >>>> Does this one look OK.  I extracted x32_init_abi from amd64_x32_init_abi > >>>> since amd64_x32_linux_init_abi can't call amd64_init_abi after > >>>> calling amd64_linux_init_abi. > >>> > >>> I guess multiple-inheritance is a bad idea, even when implemented in C ;) > >>> > >>> I really do think that amd64_x32_linux_init_abi() should call > >>> amd64_x32_init_abi().  That way it is immediately obvious that the OS-specific ABI inherits everything from the generic ABI. > >> > >> X32 kernel interface are highly OS specific.  Different OSes can implement > >> very different kernel interfaces.  The only generic x32 bits are > >> > >>  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > >> > >>  tdep->num_dword_regs = 17; > >> > >>  set_tdesc_pseudo_register_type (gdbarch, amd64_x32_pseudo_register_type); > >> > >>  set_gdbarch_long_bit (gdbarch, 32); > >>  set_gdbarch_ptr_bit (gdbarch, 32); > >> > >> They are the same for all x32 OSes since they are determined by > >> hardware, not OS. > >> > >>> In order too avoid too much code duplication, the common bits should > >>> be split out from amd64_linux_init_abi() into a seperate function that > >>> gets called from both amd64_linux_init_abi() and > >>> amd64_x32_linux_init_abi().  As I wrote earlier, it isn't entirely > >>> obvious that everything in amd64_linix_init_abi() applies to the x32 > >>> ABI.  So we should be conservative in moving stuff into the common > >>> function.  In fact it might be a good idea to start out with something > >>> like the attached diff, and gradually move things over. > >> > >> Linux x32 kernel interface shares > 90% of Linux amd64 kernel > >> interface (309 system calls out of 337 are the same).  See > >> 64-bit system call table in Linux kernel 3.4: > >> > >> http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=arch/x86/syscalls/syscall_64.tbl;h=dd29a9ea27c560a9d2fcb6e1c2983f8b8e9be407;hb=HEAD > >> > >> I believe we should start with sharing everything between Linux/x32 > >> and Linux/amd64.  We can update x32 part as we go. > >> > > > > > > Here is the updated patch.  I added amd64_x32_init for generic x32 > > setting.  It can be used by all x32 init_abi functions.  Since > > tdep->tdesc can't be changed after being used, I renamed > > amd64_init_abi/amd64_init_abi to amd64_init/amd64_linux_init > > to take an  argument to set tdep->tdesc properly.  OK for trunk? > > > > Thanks. > > > > Hi Mark, > > Do you have a chance to take a look at this? Sorry, no. Unliekly to be able to look at it until Thrusday evening.