1 From 40507bf199440082ed69b777986d50c31efe2520 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 4d451c8..ef0703f 100644
27 --- a/libgcc/config/xtensa/lib2funcs.S
28 +++ b/libgcc/config/xtensa/lib2funcs.S
29 @@ -34,10 +34,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 @@ -61,10 +80,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