Skip to content

Commit

Permalink
Blackfin arch: Fix random crash issue found by Michael.
Browse files Browse the repository at this point in the history
This is fixes a problem where we could jump to the wrong address. By
doing a "p0 = reti; jump (p0)". If a different, higher level interrupt
came in, just before, rather than returning to the calling function, we
would return to a random place in the kernel.

This very elegant fix from Bernd grabs the return location off the
stack, and places it into P0, so when we do a return, it goes to the
correct place.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
  • Loading branch information
Robin Getz authored and Bryan Wu committed Oct 29, 2007
1 parent 7728ec3 commit aa770aa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/blackfin/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ ENTRY(_ret_from_fork)
[sp + PT_IPEND] = r0;
/* do a 'fake' RTI by jumping to [RETI]
* to avoid clearing supervisor mode in child
*/
*/
r0 = [sp + PT_PC];
[sp + PT_P0] = r0;

RESTORE_ALL_SYS
p0 = reti;
jump (p0);
ENDPROC(_ret_from_fork)

Expand Down

0 comments on commit aa770aa

Please sign in to comment.