sparc: Fix handling of orig_i0 wrt. debugging when restarting syscalls.
authorDavid S. Miller <davem@davemloft.net>
Mon, 26 Dec 2011 17:30:13 +0000 (12:30 -0500)
committerRohan Somvanshi <rsomvanshi@nvidia.com>
Wed, 11 Jan 2012 18:20:43 +0000 (10:20 -0800)
commited91b8531f6e2b29400376de6bcf40dbfab053db
treeedeed7838d7a5da706c6a4b2d5ef22445071d24b
parent4e6c2d9d2131110a598bb37ecde9fb3e6a1e7fdf
sparc: Fix handling of orig_i0 wrt. debugging when restarting syscalls.

[ A combination of upstream commits 1d299bc7732c34d85bd43ac1a8745f5a2fed2078 and
  e88d2468718b0789b4c33da2f7e1cef2a1eee279 ]

Although we provide a proper way for a debugger to control whether
syscall restart occurs, we run into problems because orig_i0 is not
saved and restored properly.

Luckily we can solve this problem without having to make debuggers
aware of the issue.  Across system calls, several registers are
considered volatile and can be safely clobbered.

Therefore we use the pt_regs save area of one of those registers, %g6,
as a place to save and restore orig_i0.

Debuggers transparently will do the right thing because they save and
restore this register already.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Change-Id: I904bc58192c45c132938a97629578a954f26478d
Reviewed-on: http://git-master/r/74212
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>
arch/sparc/kernel/signal32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c