Skip to contentSkip to conversation

powerpc/lib: fix unsafe register handling in wait_ticks

PATCH New Tom Rini 1 participant 1 message Apr 10, 2013

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 powerpc/lib: fix unsafe register handling in wait_ticks

Quoted 10 lines · Mats K??rrman

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.

Quoted 7 lines

The patch has been tested on a custom MPC5125 based machine using the 512x powerpc architecture.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130410/3bd8eb24/attachment.pgp>