Linux-libre 4.10.7-gnu
[librecmc/linux-libre.git] / arch / sparc / kernel / helpers.S
1         .align  32
2         .globl  __flushw_user
3         .type   __flushw_user,#function
4 __flushw_user:
5         rdpr    %otherwin, %g1
6         brz,pn  %g1, 2f
7          clr    %g2
8 1:      save    %sp, -128, %sp
9         rdpr    %otherwin, %g1
10         brnz,pt %g1, 1b
11          add    %g2, 1, %g2
12 1:      sub     %g2, 1, %g2
13         brnz,pt %g2, 1b
14          restore %g0, %g0, %g0
15 2:      retl
16          nop
17         .size   __flushw_user,.-__flushw_user
18 EXPORT_SYMBOL(__flushw_user)
19
20         /* Flush %fp and %i7 to the stack for all register
21          * windows active inside of the cpu.  This allows
22          * show_stack_trace() to avoid using an expensive
23          * 'flushw'.
24          */
25         .globl          stack_trace_flush
26         .type           stack_trace_flush,#function
27 stack_trace_flush:
28         rdpr            %pstate, %o0
29         wrpr            %o0, PSTATE_IE, %pstate
30
31         rdpr            %cwp, %g1
32         rdpr            %canrestore, %g2
33         sub             %g1, 1, %g3
34
35 1:      brz,pn          %g2, 2f
36          sub            %g2, 1, %g2
37         wrpr            %g3, %cwp
38         stx             %fp, [%sp + STACK_BIAS + RW_V9_I6]
39         stx             %i7, [%sp + STACK_BIAS + RW_V9_I7]
40         ba,pt           %xcc, 1b
41          sub            %g3, 1, %g3
42
43 2:      wrpr            %g1, %cwp
44         wrpr            %o0, %pstate
45
46         retl
47          nop
48         .size           stack_trace_flush,.-stack_trace_flush
49
50 #ifdef CONFIG_SMP
51         .globl          hard_smp_processor_id
52         .type           hard_smp_processor_id,#function
53 hard_smp_processor_id:
54 #endif
55         .globl          real_hard_smp_processor_id
56         .type           real_hard_smp_processor_id,#function
57 real_hard_smp_processor_id:
58         __GET_CPUID(%o0)
59         retl
60          nop
61 #ifdef CONFIG_SMP
62         .size           hard_smp_processor_id,.-hard_smp_processor_id
63 #endif
64         .size           real_hard_smp_processor_id,.-real_hard_smp_processor_id
65 EXPORT_SYMBOL_GPL(real_hard_smp_processor_id)