blob: b91a1b662f47c3fce8e8049890f887d87475fed9 [file] [log] [blame]
David Feng0ae76532013-12-14 11:47:35 +08001/*
2 * (C) Copyright 2013
3 * David Feng <fenghua@phytium.com.cn>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <asm-offsets.h>
9#include <config.h>
10#include <version.h>
11#include <asm/ptrace.h>
12#include <asm/macro.h>
13#include <linux/linkage.h>
14
15/*
16 * Enter Exception.
17 * This will save the processor state that is ELR/X0~X30
18 * to the stack frame.
19 */
20.macro exception_entry
21 stp x29, x30, [sp, #-16]!
22 stp x27, x28, [sp, #-16]!
23 stp x25, x26, [sp, #-16]!
24 stp x23, x24, [sp, #-16]!
25 stp x21, x22, [sp, #-16]!
26 stp x19, x20, [sp, #-16]!
27 stp x17, x18, [sp, #-16]!
28 stp x15, x16, [sp, #-16]!
29 stp x13, x14, [sp, #-16]!
30 stp x11, x12, [sp, #-16]!
31 stp x9, x10, [sp, #-16]!
32 stp x7, x8, [sp, #-16]!
33 stp x5, x6, [sp, #-16]!
34 stp x3, x4, [sp, #-16]!
35 stp x1, x2, [sp, #-16]!
36
37 /* Could be running at EL3/EL2/EL1 */
38 switch_el x11, 3f, 2f, 1f
393: mrs x1, esr_el3
40 mrs x2, elr_el3
41 b 0f
422: mrs x1, esr_el2
43 mrs x2, elr_el2
44 b 0f
451: mrs x1, esr_el1
46 mrs x2, elr_el1
470:
48 stp x2, x0, [sp, #-16]!
49 mov x0, sp
50.endm
51
52/*
53 * Exception vectors.
54 */
55 .align 11
56 .globl vectors
57vectors:
58 .align 7
59 b _do_bad_sync /* Current EL Synchronous Thread */
60
61 .align 7
62 b _do_bad_irq /* Current EL IRQ Thread */
63
64 .align 7
65 b _do_bad_fiq /* Current EL FIQ Thread */
66
67 .align 7
68 b _do_bad_error /* Current EL Error Thread */
69
70 .align 7
71 b _do_sync /* Current EL Synchronous Handler */
72
73 .align 7
74 b _do_irq /* Current EL IRQ Handler */
75
76 .align 7
77 b _do_fiq /* Current EL FIQ Handler */
78
79 .align 7
80 b _do_error /* Current EL Error Handler */
81
82
83_do_bad_sync:
84 exception_entry
85 bl do_bad_sync
86
87_do_bad_irq:
88 exception_entry
89 bl do_bad_irq
90
91_do_bad_fiq:
92 exception_entry
93 bl do_bad_fiq
94
95_do_bad_error:
96 exception_entry
97 bl do_bad_error
98
99_do_sync:
100 exception_entry
101 bl do_sync
102
103_do_irq:
104 exception_entry
105 bl do_irq
106
107_do_fiq:
108 exception_entry
109 bl do_fiq
110
111_do_error:
112 exception_entry
113 bl do_error