From patchwork Wed Feb 22 02:18:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Russell X-Patchwork-Id: 6871 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8FB4B23EAE for ; Wed, 22 Feb 2012 02:41:32 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 3B3DFA18659 for ; Wed, 22 Feb 2012 02:41:32 +0000 (UTC) Received: by iabz7 with SMTP id z7so13630946iab.11 for ; Tue, 21 Feb 2012 18:41:31 -0800 (PST) Received: from mr.google.com ([10.43.52.74]) by 10.43.52.74 with SMTP id vl10mr30201037icb.55.1329878491648 (num_hops = 1); Tue, 21 Feb 2012 18:41:31 -0800 (PST) Received: by 10.43.52.74 with SMTP id vl10mr24158827icb.55.1329878491597; Tue, 21 Feb 2012 18:41:31 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.11.10 with SMTP id r10csp122902ibr; Tue, 21 Feb 2012 18:41:30 -0800 (PST) Received: by 10.68.219.234 with SMTP id pr10mr68115231pbc.11.1329878489081; Tue, 21 Feb 2012 18:41:29 -0800 (PST) Received: from ozlabs.org (ozlabs.org. [203.10.76.45]) by mx.google.com with ESMTPS id s4si35458376pbc.15.2012.02.21.18.41.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Feb 2012 18:41:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rusty@ozlabs.org designates 203.10.76.45 as permitted sender) client-ip=203.10.76.45; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rusty@ozlabs.org designates 203.10.76.45 as permitted sender) smtp.mail=rusty@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1011) id 13A8FB6EEC; Wed, 22 Feb 2012 13:41:25 +1100 (EST) From: Rusty Russell To: Dave Martin , Peter Maydell Cc: patches@linaro.org, Marc Zyngier Subject: Re: [PULL] boot-wrappe: boot kernel in Hyp mode In-Reply-To: <20120221123345.GB2488@linaro.org> References: <1329330098-31636-1-git-send-email-dave.martin@linaro.org> <1329330098-31636-2-git-send-email-dave.martin@linaro.org> <87boou8l7g.fsf@rustcorp.com.au> <874nuk7rmf.fsf@rustcorp.com.au> <20120221123345.GB2488@linaro.org> User-Agent: Notmuch/0.6.1-1 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) Date: Wed, 22 Feb 2012 12:48:26 +1030 Message-ID: <87k43f626l.fsf@rustcorp.com.au> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQm4+vRWxJDc89LRyRWm4obiKCR+7x1wRFnpUgJhFoFDVX80qvUB/X9HWjZ1QDhw6OgwpFkC On Tue, 21 Feb 2012 12:33:45 +0000, Dave Martin wrote: > > "fiq", I assume. Yep, fixed. > > > - popgt {r11, r12} > > > - movgts pc, lr > > > + ldmgtfd sp!, {r10-r12,pc}^ > > > > I was going to say 'This is more conventionally written "ldmiagt"' > > but it looks like we'd need to uncomment the '.syntax unified' > > at the top of the file and fix the warnings for that. 'ldmgtia', > > then. > > I did attempt to write it the other way around, and couldn't figure out > why it didn't work... but I didn't try .syntax unified. Being an ARM newbie, I found the old two-insn version much clearer than Dave's single one. This returns it to the original. If noone complains, I'll fold this into the previous patch and re-push. Otherwise, I'll just fix the typo. Thanks, Rusty. commit c1b47d034a719e9db4660a533336b89f0019e80d Author: Rusty Russell Date: Wed Feb 22 12:39:19 2012 +1030 Fix typo, return to simpler two-instruction function return sequences. diff --git a/boot.S b/boot.S index 0f61c3c..76de65f 100644 --- a/boot.S +++ b/boot.S @@ -130,7 +130,7 @@ vectors: .word 0 /* dabt */ b into_hyp_mode /* hvc */ .word 0 /* irq */ - .word 0 /* fix */ + .word 0 /* fiq */ into_hyp_mode: @ Check CPU nr again diff --git a/monitor.S b/monitor.S index 334186e..09689bd 100644 --- a/monitor.S +++ b/monitor.S @@ -25,7 +25,7 @@ @ 1: ldr sp, =_monitor_stack - push {r10-r12,lr} + push {r10-r12} cmp r7, #0xffffffff beq _non_sec @@ -36,7 +36,8 @@ movnes pc, lr and r12, r7, #0xf cmp r12, #0x0 - ldmgtfd sp!, {r10-r12,pc}^ + popgt {r10-r12} + movgts pc, lr @ Check the VMID is 0 mrc p15, 0, r10, c1, c1, 0 @ SCR @@ -48,7 +49,8 @@ lsr r11, r11, #16 and r11, r11, #0xff cmp r11, #0 - ldmnefd sp!, {r10-r12,pc}^ + popne {r10-r12} + movnes pc, lr @ Jump to the right function and r12, r7, #0xf @@ -71,7 +73,8 @@ _non_sec: ldr r11, =0x131 orr r12, r12, r11 mcr p15, 0, r12, c1, c1, 0 - ldmfd sp!, {r10-r12,pc}^ + pop {r10-r12} + movs pc, lr @ @ Read/Write HVBAR @@ -82,7 +85,8 @@ _write_hvbar: isb mcr p15, 4, r0, c12, c0, 0 mcr p15, 0, r10, c1, c1, 0 @ Restore SCR - ldmfd sp!, {r10-r12,pc}^ + pop {r10-r12} + movs pc, lr .ltorg