1 From 05154174b369505238b759cf80d595d8cfc8c731 Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Mon, 10 Aug 2015 21:35:20 +0300
4 Subject: [PATCH 1/3] xtensa: reimplement register spilling
6 Spilling windowed registers in userspace is much easier, more portable,
7 less error-prone and equally effective as in kernel. Now that register
8 spilling syscall is considered obsolete in the xtensa linux kernel
9 replace it with CALL12 followed by series of ENTRY in libgcc.
11 2015-08-18 Max Filippov <jcmvbkbc@gmail.com>
13 * config/xtensa/lib2funcs.S (__xtensa_libgcc_window_spill): Use
14 CALL12 followed by series of ENTRY to spill windowed registers.
15 (__xtensa_nonlocal_goto): Call __xtensa_libgcc_window_spill
16 instead of making linux spill syscall.
18 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
20 Backported from: r226962
22 libgcc/config/xtensa/lib2funcs.S | 30 +++++++++++++++++++++++-------
23 1 file changed, 23 insertions(+), 7 deletions(-)
25 diff --git a/libgcc/config/xtensa/lib2funcs.S b/libgcc/config/xtensa/lib2funcs.S
26 index 3ac8c1d..2e678af 100644
27 --- a/libgcc/config/xtensa/lib2funcs.S
28 +++ b/libgcc/config/xtensa/lib2funcs.S
29 @@ -33,10 +33,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
30 .global __xtensa_libgcc_window_spill
31 .type __xtensa_libgcc_window_spill,@function
32 __xtensa_libgcc_window_spill:
37 +#if XCHAL_NUM_AREGS > 16
42 + .rept (XCHAL_NUM_AREGS - 24) / 12
47 +#if XCHAL_NUM_AREGS % 12 == 0
49 +#elif XCHAL_NUM_AREGS % 12 == 4
51 +#elif XCHAL_NUM_AREGS % 12 == 8
59 .size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill
62 @@ -58,10 +77,7 @@ __xtensa_nonlocal_goto:
65 /* Flush registers. */
70 + call8 __xtensa_libgcc_window_spill
72 /* Because the save area for a0-a3 is stored one frame below
73 the one identified by a2, the only way to restore those