From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Mon, 28 Jan 2013 10:41:44 +0100 Subject: [U-Boot] [PATCH] powerpc/lib: fix unsafe register handling in wait_ticks In-Reply-To: References: Message-ID: <510647D8.9040403@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > Cc: Wolfgang Denk > Acked-by: Joakim Tjernlund 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 Thanks, Stefan