Skip to content

Commit

Permalink
sh: Fix up restorer in debug_trap exception return path.
Browse files Browse the repository at this point in the history
There are a few different types of debug trap exceptions, though now
that they are all going through a special jump table, the restorer needs
to be unified as well.

Presently this is falling through the ret_from_fork path, which more or
less does the right thing on SH-3/4 whilst being completely unsuitable on
MMU-less targets.

Ultimately what we want here is a branch through the platform's
restore_all directly, without worrying about the retval being clobbered.
We can accomplish that through a branch to __restore_all directly, so
switch it so we come back from the jump table and branch to the restorer.

This fixes up a recursion in the nommu WARN_ON() path, as well as some
other userspace nastiness where said recursion caused serious stack
corruption.

Signed-off-by: Paul Mundt <[email protected]>
  • Loading branch information
pmundt committed May 19, 2008
1 parent 9a33fc2 commit 336f1d3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions arch/sh/kernel/entry-common.S
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* $Id: entry.S,v 1.37 2004/06/11 13:02:46 doyu Exp $
*
* linux/arch/sh/entry.S
*
/*
* Copyright (C) 1999, 2000, 2002 Niibe Yutaka
* Copyright (C) 2003 Paul Mundt
* Copyright (C) 2003 - 2008 Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
Expand Down Expand Up @@ -282,7 +279,9 @@ debug_trap:
mov.l 1f, r8
add r0, r8
mov.l @r8, r8
jmp @r8
jsr @r8
nop
bra __restore_all
nop

.align 2
Expand Down

0 comments on commit 336f1d3

Please sign in to comment.