board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / gcc / 5.4.0 / 871-xtensa-reimplement-register-spilling.patch
blob4056f8b8ed9e579251b65c638c05d986dc9574da
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>
12 libgcc/
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>
19 ---
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:
33 - entry sp, 32
34 - movi a2, 0
35 - syscall
36 + entry sp, 48
37 +#if XCHAL_NUM_AREGS > 16
38 + call12 1f
39 + retw
40 + .align 4
41 +1:
42 + .rept (XCHAL_NUM_AREGS - 24) / 12
43 + _entry sp, 48
44 + mov a12, a0
45 + .endr
46 + _entry sp, 16
47 +#if XCHAL_NUM_AREGS % 12 == 0
48 + mov a4, a4
49 +#elif XCHAL_NUM_AREGS % 12 == 4
50 + mov a8, a8
51 +#elif XCHAL_NUM_AREGS % 12 == 8
52 + mov a12, a12
53 +#endif
54 retw
55 +#else
56 + mov a8, a8
57 + retw
58 +#endif
59 .size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill
60 #endif
62 @@ -61,10 +80,7 @@ __xtensa_nonlocal_goto:
63 entry sp, 32
65 /* Flush registers. */
66 - mov a5, a2
67 - movi a2, 0
68 - syscall
69 - mov a2, a5
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
74 --
75 1.8.1.4