From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::d42; helo=mail-io1-xd42.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 955BA2119BBD2 for ; Wed, 12 Dec 2018 03:33:19 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id v10so14492986ios.13 for ; Wed, 12 Dec 2018 03:33:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IX25KRVR1LzRRR+6F1T2VqmysO8EAh8ro2L8wqaEqiM=; b=MitWtkBN2D+pHxx7LdpvDd8aMb/2uNNJ1LkbN+q4n3FgjPvN0nicQ4+ZF8z1opjaAM 7mwwFUOh+C6RS4sXW1/wF/ifD2E8Ih9aCNjcJBqUlV3SN7rYhn95Cy5InaNSyd2Lbe52 amDB7vsA1TuDs1Ba70nlGBoY0dEEhGN3PuGO0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IX25KRVR1LzRRR+6F1T2VqmysO8EAh8ro2L8wqaEqiM=; b=f/6UiUBDycarXHIwmIjnbOHw0O8biBCFUs3RHqq75jPLswYcvVZPIV0pB42h2QdzL8 Ezd0yz16cvHOyeDoaebMmpDzLsRdwu2/Bzf/v+UQZRzdT8+yKoscFnnky1w0DZyL2iOM 9tif5YVZMjb6PwpfNtMx9CDChijYG3V/71RM5d6fEIBOa9JAQRCTF1SxtTpxH7yd5LhG uJkfMrdYDbyL/IK0IouDYiqveRodUcYiOqgp/xB/izzve7iJGNF/FPlKvfeZlcKeuXEV JK/jd0HRDDqcUiugPKFEhHPv3slHsLbUKnd3w0a7nl0+YvwCl/1P0HCIx3jbfuLEicby 6c+g== X-Gm-Message-State: AA+aEWYrtXYsXtpTqxfYk6ZaCLOStol4DMSYYyyXD3kKN2LNnsMvpiHs NkBiYBoQIGUZGm4W/bkHAT+I+glmKGHUNEtJ1bTqew== X-Google-Smtp-Source: AFSGD/X/hSgW2nlnMAb9waRztqaZ5C5aY1hQ6QhYr9LpQlxBQ4TqbfSu/R+j4sFs/Z+dVUiVHi6dYayR86KhxdvXW5M= X-Received: by 2002:a6b:5d01:: with SMTP id r1mr15471841iob.170.1544614398703; Wed, 12 Dec 2018 03:33:18 -0800 (PST) MIME-Version: 1.0 References: <20181212091211.13258-1-ard.biesheuvel@linaro.org> <20181212113009.vmsv37swaui3z4os@bivouac.eciton.net> In-Reply-To: <20181212113009.vmsv37swaui3z4os@bivouac.eciton.net> From: Ard Biesheuvel Date: Wed, 12 Dec 2018 12:33:07 +0100 Message-ID: To: Leif Lindholm Cc: "edk2-devel@lists.01.org" Subject: Re: [PATCH] EmbeddedPkg/GdbDebugAgent ARM: use modern dialect for ldm/stm instructions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2018 11:33:19 -0000 Content-Type: text/plain; charset="UTF-8" On Wed, 12 Dec 2018 at 12:30, Leif Lindholm wrote: > > On Wed, Dec 12, 2018 at 10:12:11AM +0100, Ard Biesheuvel wrote: > > Clang does not like the legacy 32-bit assembler syntax used in the > > gdbstub exception handling routines, so update them to something > > more fashionable. > > > > So switch the order of the conditional suffix > > Yes, this is essentially a bugfix. The syntax change predates ARM's > involvement in EDK2. > > > and the increment/decrement > > specifier, and use decrement-after (da) and increment-before (ib) as > > appropriate for an empty descending stack. > > But I very much prefer the FA/FD/EA/ED syntax. It gives symmetry, > which helps me a lot when dealing with 7-character mnemonics. > These aliases are also defined in the ARM ARM and won't be going away. > Clang doesn't support them though. This code is not used anywhere (it is referenced in BeagleBoardPkg but commented out), so we could also simply remove it. > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Ard Biesheuvel > > --- > > EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S b/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S > > index df1543a6d242..924578c7af2f 100644 > > --- a/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S > > +++ b/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S > > @@ -57,6 +57,7 @@ GCC_ASM_EXPORT(AsmCommonExceptionEntry) > > GCC_ASM_EXPORT(GdbExceptionHandler) > > > > .text > > +.syntax unified > > .align 3 > > > > > > @@ -198,9 +199,9 @@ ASM_PFX(AsmCommonExceptionEntry): > > and R3, R1, #0x1f @ Check CPSR to see if User or System Mode > > cmp R3, #0x1f @ if ((CPSR == 0x10) || (CPSR == 0x1df)) > > cmpne R3, #0x10 @ > > - stmeqed R2, {lr}^ @ save unbanked lr > > + stmdaeq R2, {lr}^ @ save unbanked lr > > @ else > > - stmneed R2, {lr} @ save SVC lr > > + stmdane R2, {lr} @ save SVC lr > > > > > > ldr R5, [SP, #0x58] @ PC is the LR pushed by srsfd > > @@ -245,9 +246,9 @@ GdbExceptionHandler ( > > and R1, R1, #0x1f @ Check to see if User or System Mode > > cmp R1, #0x1f @ if ((CPSR == 0x10) || (CPSR == 0x1f)) > > cmpne R1, #0x10 @ > > - ldmeqed R2, {lr}^ @ restore unbanked lr > > + ldmibeq R2, {lr}^ @ restore unbanked lr > > @ else > > - ldmneed R3, {lr} @ restore SVC lr, via ldmfd SP!, {LR} > > + ldmibne R3, {lr} @ restore SVC lr, via ldmfd SP!, {LR} > > > > ldmfd SP!,{R0-R12} @ Restore general purpose registers > > @ Exception handler can not change SP > > -- > > 2.19.2 > >