public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] powerpc/lib: fix unsafe register handling in wait_ticks
Date: Mon, 28 Jan 2013 10:41:44 +0100	[thread overview]
Message-ID: <510647D8.9040403@denx.de> (raw)
In-Reply-To: <ED3E0BCACD909541BA94A34C4A164D4C427B5E6A@post.tritech.se>

On 01/27/2013 06:03 PM, Mats K?rrman wrote:
> If watchdog is enabled, the arch/powerpc/lib/ticks.S::wait_ticks() function
> calls the function specified by the WATCHDOG_RESET macro.
> The wait_ticks function depends on the registers r0, r6 and r7 being
> preserved however that is not guaranteed, e.g. if the reset function is a
> C function this will probably overwrite r0 and cause an endless loop.
> 
> The following patch changes to using r14+r15 instead of r6+r7 (to resemble
> what would have been generated by a C compiler) and saves all necessary
> registers on the stack.
> 
> The patch has been tested on a custom MPC5125 based machine using the 512x
> powerpc architecture.
> 
> Signed-off-by: Mats Karrman <mats.karrman@tritech.se>
> Cc: Wolfgang Denk <wd@denx.de>
> Acked-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>

Thanks for this fix. I just reproduced this problem on another MPC5200
based board (a4m2k) while implementing watchdog support. And this patch
fixes the problem (hangup in wait_ticks).

So:

Tested-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

  reply	other threads:[~2013-01-28  9:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27 17:03 [U-Boot] [PATCH] powerpc/lib: fix unsafe register handling in wait_ticks Mats Kärrman
2013-01-28  9:41 ` Stefan Roese [this message]
2013-01-28 13:27   ` Joakim Tjernlund
2013-04-08 16:27 ` [U-Boot] " Tom Rini

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=510647D8.9040403@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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