2020-01-10 10:38:21 +08:00
|
|
|
/*
|
2022-01-18 13:35:13 +08:00
|
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
2020-01-15 16:46:19 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2020-01-10 10:38:21 +08:00
|
|
|
* Date Author Notes
|
|
|
|
* 2018-10-06 ZhaoXiaowei the first version
|
|
|
|
*/
|
2022-01-18 13:35:13 +08:00
|
|
|
|
2020-01-10 10:38:21 +08:00
|
|
|
.text
|
|
|
|
.globl rt_hw_get_current_el
|
|
|
|
rt_hw_get_current_el:
|
2022-01-18 13:35:13 +08:00
|
|
|
MRS X0, CurrentEL
|
|
|
|
CMP X0, 0xc
|
|
|
|
B.EQ 3f
|
|
|
|
CMP X0, 0x8
|
|
|
|
B.EQ 2f
|
|
|
|
CMP X0, 0x4
|
|
|
|
B.EQ 1f
|
|
|
|
|
|
|
|
LDR X0, =0
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
3:
|
2022-01-18 13:35:13 +08:00
|
|
|
LDR X0, =3
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
2:
|
2022-01-18 13:35:13 +08:00
|
|
|
LDR X0, =2
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
1:
|
2022-01-18 13:35:13 +08:00
|
|
|
LDR X0, =1
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
0:
|
2022-01-18 13:35:13 +08:00
|
|
|
RET
|
2020-01-10 10:38:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
.globl rt_hw_set_current_vbar
|
|
|
|
rt_hw_set_current_vbar:
|
2022-01-18 13:35:13 +08:00
|
|
|
MRS X1, CurrentEL
|
|
|
|
CMP X1, 0xc
|
|
|
|
B.EQ 3f
|
|
|
|
CMP X1, 0x8
|
|
|
|
B.EQ 2f
|
|
|
|
CMP X1, 0x4
|
|
|
|
B.EQ 1f
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
3:
|
2022-01-18 13:35:13 +08:00
|
|
|
MSR VBAR_EL3,X0
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
2:
|
2022-01-18 13:35:13 +08:00
|
|
|
MSR VBAR_EL2,X0
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
1:
|
2022-01-18 13:35:13 +08:00
|
|
|
MSR VBAR_EL1,X0
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
0:
|
2022-01-18 13:35:13 +08:00
|
|
|
RET
|
|
|
|
|
2020-01-10 10:38:21 +08:00
|
|
|
|
|
|
|
.globl rt_hw_set_elx_env
|
|
|
|
rt_hw_set_elx_env:
|
2022-01-18 13:35:13 +08:00
|
|
|
MRS X1, CurrentEL
|
|
|
|
CMP X1, 0xc
|
|
|
|
B.EQ 3f
|
|
|
|
CMP X1, 0x8
|
|
|
|
B.EQ 2f
|
|
|
|
CMP X1, 0x4
|
|
|
|
B.EQ 1f
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
3:
|
2022-01-18 13:35:13 +08:00
|
|
|
MRS X0, SCR_EL3
|
|
|
|
ORR X0, X0, #0xF /* SCR_EL3.NS|IRQ|FIQ|EA */
|
|
|
|
MSR SCR_EL3, X0
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
2:
|
2022-01-18 13:35:13 +08:00
|
|
|
MRS X0, HCR_EL2
|
|
|
|
ORR X0, X0, #0x38
|
|
|
|
MSR HCR_EL2, X0
|
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
1:
|
2022-01-18 13:35:13 +08:00
|
|
|
B 0f
|
2020-01-10 10:38:21 +08:00
|
|
|
0:
|
2022-01-18 13:35:13 +08:00
|
|
|
RET
|