From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Vhfuf-0000Do-Ft for mharc-grub-devel@gnu.org; Sat, 16 Nov 2013 08:27:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhfuY-0000DO-DF for grub-devel@gnu.org; Sat, 16 Nov 2013 08:27:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VhfuT-0007U5-0y for grub-devel@gnu.org; Sat, 16 Nov 2013 08:27:42 -0500 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:46730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhfuS-0007Tj-OG for grub-devel@gnu.org; Sat, 16 Nov 2013 08:27:36 -0500 Received: by mail-lb0-f175.google.com with SMTP id p9so3523205lbv.20 for ; Sat, 16 Nov 2013 05:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type; bh=IaPVZ35MDvuQoxszzuoQgK0DYuSMeRb58ZaqFnXSdXA=; b=vZ64tkw6ImaiEUFeWSb1CVWyXAGMlDWUwfw/fEHqGDScCgiWzKElW8ycyAg6DHtlDf EZW2Gzp2h7QW4cedNTg16BsCKWZzxMEWoYUas0y6Fpg49BWXulTo6jlGSWmsU8BKlRJJ Nx5yErZGCquo87UwcFGcZuenHB+4jfnKZLqYgeO0j2T+h6L/YvOazflAaq+KtONtCaZY gnQcHXq0RJA0HfPRY9nsJ3MennucmVGJK6uU7ciANCTufn0R/CqzRjvuj8R81YOzqXh3 4pWEv8kS/X6Wa9i0JE+LCAUti9mVCmTYwPp8v7yDPuMsuC27HTjcjvGsjNlUPT6H0IB1 2rzQ== X-Received: by 10.152.244.130 with SMTP id xg2mr2689901lac.4.1384608455371; Sat, 16 Nov 2013 05:27:35 -0800 (PST) Received: from opensuse.site (ppp91-76-174-89.pppoe.mtu-net.ru. [91.76.174.89]) by mx.google.com with ESMTPSA id zv10sm5575199lbb.2.2013.11.16.05.27.34 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sat, 16 Nov 2013 05:27:34 -0800 (PST) Date: Sat, 16 Nov 2013 17:27:33 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH] arm: fix u-boot port syscall interface va_arg handling (was Re: [PATCH] [ARM] Enable boot module for arm) Message-ID: <20131116172733.73f135ac@opensuse.site> In-Reply-To: <5287707F.5090207@gmail.com> References: <51EBE025.6040302@gmail.com> <51F137FE.4030102@gmail.com> <51F139FF.2030402@gmail.com> <51F13E82.7040207@gmail.com> <20130727074625.64ad89d2@opensuse.site> <51F34AE4.1080709@gmail.com> <20131115231325.1d3fa95a@opensuse.site> <5286C02B.9050404@gmail.com> <20131116123941.GC30374@rocoto.smurfnet.nu> <528769EF.9070207@gmail.com> <20131116130010.GD30374@rocoto.smurfnet.nu> <5287707F.5090207@gmail.com> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.18; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/LLCWVvL+Q/mftkzesDW8thw"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22f X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Nov 2013 13:27:48 -0000 --Sig_/LLCWVvL+Q/mftkzesDW8thw Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Sat, 16 Nov 2013 14:17:51 +0100 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 16.11.2013 14:00, Leif Lindholm wrote: > > On Sat, Nov 16, 2013 at 01:49:51PM +0100, Vladimir '=CF=86-coder/phcode= r' Serbinenko wrote: > >> On 16.11.2013 13:39, Leif Lindholm wrote: > >>> - str r9, transition_space + 8 > >> You need to save r9. Otherwise GRUB will crash if compiled with clang. > >=20 > > Hmm, but this is a bug in clang in that case. > >=20 > > From an ABI perspective, grub_uboot_syscall is a veneer: > > the only visible side effect it is permitted to have is to corrupt r12. > >=20 > According to wikipedia: > "Subroutines must preserve the contents of r4 to r11 and the stack pointe= r." According to ARM ABI documentation "A subroutine must preserve the contents of the registers r4 - r8, r10, r11 and SP (and r9 in PCS variants that designate r9 as v6)." So it sounds like whether r9 is preserved depends on platform. > So changing r9 sounds to me like this is actually U-Boot bug and > preserving it sounds like right way to handle it. > What's the harm in preserving r9? Is it used for something in calling? > > We need to additionally switch r8 between grub and u-boot copy because > > u-boot uses it for its global data pointer, and lr because we need to > > corrupt it to make u-boot return to this veneer to switch the r8 back > > again. > >=20 > > This veneer should not touch anything else - so if we need to > > temporarily work around a toolchain ABI bug, can we do this via an > > ifdef and a config option? > >=20 > If the bug is on clang side (I doubt it right now), there is no way to > handle it without side effects and we can invent a test for it, we can > reject buggy compilers (clang is secondary compiler) > > / > > Leif > >=20 > > _______________________________________________ > > Grub-devel mailing list > > Grub-devel@gnu.org > > https://lists.gnu.org/mailman/listinfo/grub-devel > >=20 >=20 >=20 --Sig_/LLCWVvL+Q/mftkzesDW8thw Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlKHcsYACgkQR6LMutpd94w6/gCfRbGAepZHTgOy5NPtMAcBD18D OjkAnjX//OpFMxC/r61VQyAj/f+unMVy =DaA1 -----END PGP SIGNATURE----- --Sig_/LLCWVvL+Q/mftkzesDW8thw--