From: Russell King - ARM Linux <linux@arm.linux.org.uk> To: Dave Martin <dave.martin@linaro.org> Cc: Catalin Marinas <catalin.marinas@arm.com>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Colin Cross <ccross@android.com> Subject: Re: [PATCH] ARM: vfp: Fix up exception location in Thumb mode Date: Fri, 14 Jan 2011 16:52:23 +0000 [thread overview] Message-ID: <20110114165222.GI15996@n2100.arm.linux.org.uk> (raw) In-Reply-To: <AANLkTi=4=c0B3Qo+boguUw-DvEihBej5Zz_d2QWmoucm@mail.gmail.com> On Fri, Jan 14, 2011 at 10:24:52AM -0600, Dave Martin wrote: > Is the comment preceding __und_usr_unknown causing some confusion here? > > /* > * The FP module is called with these registers set: > * r0 = instruction > * r2 = PC+4 > ... > > That reflects the ARM case only: for Thumb, r2 is always PC+2 (?) Actually, referring to 'PC' here is confusing (and yes, I probably wrote it) - does 'PC' refer to the address of the faulting instruction or the current PC value... Your '(?)' there is exactly the problem I'm referring to - I don't think there's much of a clear idea really what's going on here... > The comment at the start of do_undefinstr() (which receives these > registers) is correct though: > > /* > * According to the ARM ARM, PC is 2 or 4 bytes ahead, > * depending whether we're in Thumb mode or not. > * Correct this offset. The ARM ARM says that in order to return to the instruction which generated the exception, subtract 2 bytes for thumb or 4 bytes for ARM. So, in order to point at the instruction which generated the exception, we have to subtract this value from the PC value we were passed. I suggest changing this comment to: /* * According to the ARM ARM, the PC is 2 or 4 bytes ahead * depending on Thumb mode. Correct this offset so that * regs->ARM_pc points at the faulting instruction. */
WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: vfp: Fix up exception location in Thumb mode Date: Fri, 14 Jan 2011 16:52:23 +0000 [thread overview] Message-ID: <20110114165222.GI15996@n2100.arm.linux.org.uk> (raw) In-Reply-To: <AANLkTi=4=c0B3Qo+boguUw-DvEihBej5Zz_d2QWmoucm@mail.gmail.com> On Fri, Jan 14, 2011 at 10:24:52AM -0600, Dave Martin wrote: > Is the comment preceding __und_usr_unknown causing some confusion here? > > /* > * The FP module is called with these registers set: > * r0 = instruction > * r2 = PC+4 > ... > > That reflects the ARM case only: for Thumb, r2 is always PC+2 (?) Actually, referring to 'PC' here is confusing (and yes, I probably wrote it) - does 'PC' refer to the address of the faulting instruction or the current PC value... Your '(?)' there is exactly the problem I'm referring to - I don't think there's much of a clear idea really what's going on here... > The comment at the start of do_undefinstr() (which receives these > registers) is correct though: > > /* > * According to the ARM ARM, PC is 2 or 4 bytes ahead, > * depending whether we're in Thumb mode or not. > * Correct this offset. The ARM ARM says that in order to return to the instruction which generated the exception, subtract 2 bytes for thumb or 4 bytes for ARM. So, in order to point at the instruction which generated the exception, we have to subtract this value from the PC value we were passed. I suggest changing this comment to: /* * According to the ARM ARM, the PC is 2 or 4 bytes ahead * depending on Thumb mode. Correct this offset so that * regs->ARM_pc points at the faulting instruction. */
next prev parent reply other threads:[~2011-01-14 16:52 UTC|newest] Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-14 7:42 [PATCH] ARM: vfp: Fix up exception location in Thumb mode Colin Cross 2011-01-14 7:42 ` Colin Cross 2011-01-14 11:43 ` Catalin Marinas 2011-01-14 11:43 ` Catalin Marinas 2011-01-14 12:02 ` Russell King - ARM Linux 2011-01-14 12:02 ` Russell King - ARM Linux 2011-01-14 14:10 ` Catalin Marinas 2011-01-14 14:10 ` Catalin Marinas 2011-01-14 15:49 ` Russell King - ARM Linux 2011-01-14 15:49 ` Russell King - ARM Linux 2011-01-14 16:23 ` Catalin Marinas 2011-01-14 16:23 ` Catalin Marinas 2011-01-14 16:35 ` Russell King - ARM Linux 2011-01-14 16:35 ` Russell King - ARM Linux 2011-01-14 16:58 ` Catalin Marinas 2011-01-14 16:58 ` Catalin Marinas 2011-01-14 17:30 ` Russell King - ARM Linux 2011-01-14 17:30 ` Russell King - ARM Linux 2011-01-14 18:47 ` Russell King - ARM Linux 2011-01-14 18:47 ` Russell King - ARM Linux 2011-01-14 19:23 ` Colin Cross 2011-01-14 19:23 ` Colin Cross 2011-01-14 19:51 ` Colin Cross 2011-01-14 19:51 ` Colin Cross 2011-01-14 21:24 ` Russell King - ARM Linux 2011-01-14 21:24 ` Russell King - ARM Linux 2011-01-25 23:33 ` Colin Cross 2011-01-25 23:33 ` Colin Cross 2011-01-26 11:26 ` Russell King - ARM Linux 2011-01-26 11:26 ` Russell King - ARM Linux 2011-01-27 6:11 ` Colin Cross 2011-01-27 6:11 ` Colin Cross 2011-01-27 6:35 ` Colin Cross 2011-01-27 6:35 ` Colin Cross 2011-01-27 7:30 ` Colin Cross 2011-01-27 7:30 ` Colin Cross 2011-02-09 18:12 ` Colin Cross 2011-02-09 18:12 ` Colin Cross 2011-01-15 15:38 ` Catalin Marinas 2011-01-15 15:38 ` Catalin Marinas 2011-01-15 15:43 ` Russell King - ARM Linux 2011-01-15 15:43 ` Russell King - ARM Linux 2011-01-16 11:51 ` Catalin Marinas 2011-01-16 11:51 ` Catalin Marinas 2011-01-15 15:31 ` Catalin Marinas 2011-01-15 15:31 ` Catalin Marinas 2011-01-15 15:40 ` Russell King - ARM Linux 2011-01-15 15:40 ` Russell King - ARM Linux 2011-01-16 11:49 ` Catalin Marinas 2011-01-16 11:49 ` Catalin Marinas 2011-01-23 15:51 ` Russell King - ARM Linux 2011-01-23 15:51 ` Russell King - ARM Linux 2011-01-25 13:19 ` Catalin Marinas 2011-01-25 13:19 ` Catalin Marinas 2011-01-16 21:25 ` Catalin Marinas 2011-01-16 21:25 ` Catalin Marinas 2011-01-23 15:46 ` Russell King - ARM Linux 2011-01-23 15:46 ` Russell King - ARM Linux 2011-01-25 13:45 ` Catalin Marinas 2011-01-25 13:45 ` Catalin Marinas 2011-01-14 16:24 ` Dave Martin 2011-01-14 16:24 ` Dave Martin 2011-01-14 16:52 ` Russell King - ARM Linux [this message] 2011-01-14 16:52 ` Russell King - ARM Linux
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20110114165222.GI15996@n2100.arm.linux.org.uk \ --to=linux@arm.linux.org.uk \ --cc=catalin.marinas@arm.com \ --cc=ccross@android.com \ --cc=dave.martin@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.