diff options
Diffstat (limited to 'arch/sparc/kernel/utrap.S')
-rw-r--r-- | arch/sparc/kernel/utrap.S | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/sparc/kernel/utrap.S b/arch/sparc/kernel/utrap.S new file mode 100644 index 000000000000..b7f0f3f3a909 --- /dev/null +++ b/arch/sparc/kernel/utrap.S | |||
@@ -0,0 +1,29 @@ | |||
1 | .globl utrap_trap | ||
2 | .type utrap_trap,#function | ||
3 | utrap_trap: /* %g3=handler,%g4=level */ | ||
4 | TRAP_LOAD_THREAD_REG(%g6, %g1) | ||
5 | ldx [%g6 + TI_UTRAPS], %g1 | ||
6 | brnz,pt %g1, invoke_utrap | ||
7 | nop | ||
8 | |||
9 | ba,pt %xcc, etrap | ||
10 | rd %pc, %g7 | ||
11 | mov %l4, %o1 | ||
12 | call bad_trap | ||
13 | add %sp, PTREGS_OFF, %o0 | ||
14 | ba,pt %xcc, rtrap | ||
15 | nop | ||
16 | |||
17 | invoke_utrap: | ||
18 | sllx %g3, 3, %g3 | ||
19 | ldx [%g1 + %g3], %g1 | ||
20 | save %sp, -128, %sp | ||
21 | rdpr %tstate, %l6 | ||
22 | rdpr %cwp, %l7 | ||
23 | andn %l6, TSTATE_CWP, %l6 | ||
24 | wrpr %l6, %l7, %tstate | ||
25 | rdpr %tpc, %l6 | ||
26 | rdpr %tnpc, %l7 | ||
27 | wrpr %g1, 0, %tnpc | ||
28 | done | ||
29 | .size utrap_trap,.-utrap_trap | ||