1
2
3
4
5
6
7
8
9 #include <linux/init.h>
10 #include <linux/linkage.h>
11 #include <linux/irqchip/arm-gic-v3.h>
12
13 #include <asm/assembler.h>
14 #include <asm/kvm_arm.h>
15 #include <asm/kvm_asm.h>
16 #include <asm/ptrace.h>
17 #include <asm/virt.h>
18
19 .text
20 .pushsection .hyp.text, "ax"
21
22 .align 11
23
24 ENTRY(__hyp_stub_vectors)
25 ventry el2_sync_invalid
26 ventry el2_irq_invalid
27 ventry el2_fiq_invalid
28 ventry el2_error_invalid
29
30 ventry el2_sync_invalid
31 ventry el2_irq_invalid
32 ventry el2_fiq_invalid
33 ventry el2_error_invalid
34
35 ventry el1_sync
36 ventry el1_irq_invalid
37 ventry el1_fiq_invalid
38 ventry el1_error_invalid
39
40 ventry el1_sync_invalid
41 ventry el1_irq_invalid
42 ventry el1_fiq_invalid
43 ventry el1_error_invalid
44 ENDPROC(__hyp_stub_vectors)
45
46 .align 11
47
48 el1_sync:
49 cmp x0, #HVC_SET_VECTORS
50 b.ne 2f
51 msr vbar_el2, x1
52 b 9f
53
54 2: cmp x0, #HVC_SOFT_RESTART
55 b.ne 3f
56 mov x0, x2
57 mov x2, x4
58 mov x4, x1
59 mov x1, x3
60 br x4
61
62 3: cmp x0, #HVC_RESET_VECTORS
63 beq 9f
64
65
66 ldr x0, =HVC_STUB_ERR
67 eret
68
69 9: mov x0, xzr
70 eret
71 ENDPROC(el1_sync)
72
73 .macro invalid_vector label
74 \label:
75 b \label
76 ENDPROC(\label)
77 .endm
78
79 invalid_vector el2_sync_invalid
80 invalid_vector el2_irq_invalid
81 invalid_vector el2_fiq_invalid
82 invalid_vector el2_error_invalid
83 invalid_vector el1_sync_invalid
84 invalid_vector el1_irq_invalid
85 invalid_vector el1_fiq_invalid
86 invalid_vector el1_error_invalid
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109 ENTRY(__hyp_set_vectors)
110 mov x1, x0
111 mov x0, #HVC_SET_VECTORS
112 hvc #0
113 ret
114 ENDPROC(__hyp_set_vectors)
115
116 ENTRY(__hyp_reset_vectors)
117 mov x0, #HVC_RESET_VECTORS
118 hvc #0
119 ret
120 ENDPROC(__hyp_reset_vectors)