From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (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 291FE2119C883 for ; Wed, 12 Dec 2018 01:12:15 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id t27so16847993wra.6 for ; Wed, 12 Dec 2018 01:12:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WlCi7l/SsSI1ICMMcandgBXKXyV/x7fGQtzIjP/OY18=; b=Iplm/FV25pk9SxZT8Yn66FD8id1JuwNcp7tY1/62mlaTayC75lkFLRm0SBzsm6AsIt +KI3vRi34lwG/5xC18ZzE0e60vjCWcbi4S0jdX54UlEgURWpHPvbrv/TIL5eEsSkWxG0 VtSl9QONznHirbPh7DhnkobC7pUGN0TAi1XKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WlCi7l/SsSI1ICMMcandgBXKXyV/x7fGQtzIjP/OY18=; b=gF1R7X69B2l/qejB0fEUxl4Tsfpa28AxJ3ZzuqEBzP/0kYzpfjrBccHd56XSmVHTL8 G9irBXc6Z8K9ECFAwA/msN/k68LVed8xseN1ZZoCdQyAZAS+E1id9riqvTZk6Twd6l83 Oomtm9R/lfRA1YLxR8MYaz2fOW4qdps+rEZVuc75MIvH4v0oCI+WC7zTEpVFCNs5haqq nYq1ThLL9+Ag7wSTZCOkdHJToVbQrUiMWUe++n4Rv7TMvmqdzTQubVoXnZHBxsgp3Rr2 HisDQRFWV35/DqR3H0cGZqR2n8ypFClbO2zuRUUL6QN5bGZp+I4hLoQNK2giUY+ueK20 4UOQ== X-Gm-Message-State: AA+aEWYUHJ8d8T7zgWL09l3m6tC68OPtM17k0OkcLSGq67YkW1fgmj4v 3BoMYRoS7k1giNgR38wcgIfUIvppfSVzLw== X-Google-Smtp-Source: AFSGD/WKHeGC/isxoe/gTXBHDBYZXOTfrnVCPocDZwcYxhnJX4JrDjU6zb6/yKzoBw/SyAp5ZaNw8w== X-Received: by 2002:adf:c5d3:: with SMTP id v19mr16227367wrg.30.1544605934072; Wed, 12 Dec 2018 01:12:14 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:1db:abd7:f798:3277]) by smtp.gmail.com with ESMTPSA id v133sm2128278wmf.19.2018.12.12.01.12.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 01:12:13 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 12 Dec 2018 10:12:11 +0100 Message-Id: <20181212091211.13258-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [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 09:12:16 -0000 Content-Transfer-Encoding: 8bit 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 and the increment/decrement specifier, and use decrement-after (da) and increment-before (ib) as appropriate for an empty descending stack. 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