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::342; helo=mail-wm1-x342.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 19BC6211575FE for ; Wed, 12 Dec 2018 06:58:50 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id m1so5469460wml.2 for ; Wed, 12 Dec 2018 06:58:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tk3ZlYUStuj6F3Rx8X2GPZa6FIDcDGcELXEXd7pA/uw=; b=A/k41UCjKmura0ZA8xMm6pFMmOTAhap3+foVz2kSl00tFT9UuEaaarRALKQLCec7WQ +V9xUTAY/QqR1TWAF8oNBK09LST8c2yHrtoKhq+7SJj16VoO3i/hx1erSbscC3txBMFa yTaz0VZjhAXfeJyD7FEtEiANwzsn6L99m7vwE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tk3ZlYUStuj6F3Rx8X2GPZa6FIDcDGcELXEXd7pA/uw=; b=djOOdR4GavtVtupW91yvwkwtSr+IS8ih/0z3RU2uYxr5pc+pbZmkLHzT5bA7/2gW0O q5bd/QQ3e/sMXY0qAL1/KcJUUOXKXl7uCxjCJAM3ZpvjrzCcW5lB1uQFn+VlZt5DpXMl Dg1K0jClxRgxVAeb3hJj1NoFW14qzDr82QAx2vAazbinurAh8PE3bSjQKiybtakPE/9o sjkeXXWkpnbkpz5CGQNM+zdndTD11i3NBe5BTz7oammtlkscNM1T1VLlVyd1JDdIcpyt viEOZnhrBmeaVurKhEMUzENPfG6PlC90M0LiUIXXpYi0TTpUwOMK2JLydCmGMg9cgnHG HHGQ== X-Gm-Message-State: AA+aEWaVtld8/ITaynQBcqnHA+8y+BypmMAlsL5N0Zku8lymEg7Z9Csp E4EAvGL7K0ghQXcKXRdgrFtszA== X-Google-Smtp-Source: AFSGD/VDZIYSon3NssROTGUIQ+cpoeRzPkT6PTm7X2QPzh+EU4kPFmlnKjRMVf1d/u44D7kYDm+p3w== X-Received: by 2002:a1c:709:: with SMTP id 9mr6617899wmh.39.1544626729426; Wed, 12 Dec 2018 06:58:49 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id m15sm13806252wrr.95.2018.12.12.06.58.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 06:58:48 -0800 (PST) Date: Wed, 12 Dec 2018 14:58:47 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" Message-ID: <20181212145847.mvweonkc4oxjoy4q@bivouac.eciton.net> References: <20181212091211.13258-1-ard.biesheuvel@linaro.org> <20181212113009.vmsv37swaui3z4os@bivouac.eciton.net> <20181212123137.bzwi46gsszljlsvw@bivouac.eciton.net> <20181212144113.dxrno2cpclyszjrq@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) 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 14:58:51 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Dec 12, 2018 at 03:49:07PM +0100, Ard Biesheuvel wrote: > On Wed, 12 Dec 2018 at 15:41, Leif Lindholm wrote: > > > > On Wed, Dec 12, 2018 at 01:45:17PM +0100, Ard Biesheuvel wrote: > > > > > > > @@ -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 > > > > > > > > Then again, looking closer at these instructions, they're not really > > > > doing stack operations. Just (ab)using the instruction to get at the > > > > banked User mode LR from a different mode. So > > > > a) The symmetry thing doesn't really apply, so the ED is actively > > > > misleading here. > > > > b) This could trivially be changed to use FD anyway, just setting R2's > > > > offset from PC to #0x34 :) > > > > > > > > > > Actually, since there is no writeback, what is the point of the > > > decrement-after? Can't we just drop it? > > > > Possibly picked specifically to _not_ be mistaken for a stack > > operation. In this scenario The DA just means don't add 4 to R2 before > > using it as address. > > > > Indeed. But in the load counterpart below, it means increment-before, > so it will restore lr from the wrong address. I do believe you are correct :) Let's nuke this one. / Leif