linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: oops broken on v7-M
Date: Tue, 10 Dec 2013 22:25:50 +0100	[thread overview]
Message-ID: <20131210212550.GF18888@pengutronix.de> (raw)

Hello,

__show_regs does among other things the following:

        printk("Flags: %s  IRQs o%s  FIQs o%s  Mode %s  ISA %s  Segment %s\n",
                buf, interrupts_enabled(regs) ? "n" : "ff",
                fast_interrupts_enabled(regs) ? "n" : "ff",
                processor_modes[processor_mode(regs)],
                isa_modes[isa_mode(regs)],
                get_fs() == get_ds() ? "kernel" : "user");

with isa_mode being defined as follows:

	#define isa_mode(regs) \
		((((regs)->ARM_cpsr & PSR_J_BIT) >> 23) | \ 
		 (((regs)->ARM_cpsr & PSR_T_BIT) >> 5))

with

	#define V4_PSR_T_BIT    0x00000020      /* >= V4T, but not V7M */
	#define V7M_PSR_T_BIT   0x01000000
	#if defined(__KERNEL__) && defined(CONFIG_CPU_V7M)
	#define PSR_T_BIT       V7M_PSR_T_BIT
	#else
	/* for compatibility */
	#define PSR_T_BIT       V4_PSR_T_BIT
	#endif          
	...
	#define PSR_J_BIT       0x01000000      /* >= V5J, but not V7M */

so on !CPU_V7M isa_mode maps nicely into [0 .. 3], on CPU_V7M however it
maps to either 0x80000 or 0x80002 which both are bad values for indexing
into isa_modes[].

The possibilities to fix that are:
 1) #define isa_mode(regs) to be 1
    This makes all memory accesses fine, but still the other bits printed
    are bogus (IRQs, FIQs, Mode) as before.
 2) just do:
    printk("xPSR: %08x\n", regs->ARM_cpsr);
    instead of the printk above for CPU_V7M. This is informative, but an
    expert output.
 3) don't hardcode 23 and 5, but calculate these depending on PSR_J_BIT
    and PSR_T_BIT.

I think I will go for b) + c), but not today any more. What do you
think?

Best regards
Uwe


-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

             reply	other threads:[~2013-12-10 21:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10 21:25 Uwe Kleine-König [this message]
2013-12-16  9:37 ` [PATCH] ARM: make isa_mode macro more robust and fix for v7-M Uwe Kleine-König
2014-02-19 20:29   ` [PATCH v2] " Uwe Kleine-König
2013-12-16  9:48 ` [PATCH] ARM: show_regs: on v7-M there are no FIQs, different processor modes, Uwe Kleine-König
2014-02-19 20:31   ` [PATCH v2] " Uwe Kleine-König

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=20131210212550.GF18888@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).