David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 1 | /* |
| 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> |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 10 | #include <linux/linkage.h> |
| 11 | #include <asm/macro.h> |
| 12 | |
| 13 | ENTRY(armv8_switch_to_el2) |
Alison Wang | 73818d5 | 2016-11-10 10:49:03 +0800 | [diff] [blame] | 14 | switch_el x5, 1f, 0f, 0f |
| 15 | 0: |
| 16 | /* |
| 17 | * x3 is kernel entry point or switch_to_el1 |
| 18 | * if CONFIG_ARMV8_SWITCH_TO_EL1 is defined. |
| 19 | * When running in EL2 now, jump to the |
| 20 | * address saved in x3. |
| 21 | */ |
| 22 | br x3 |
| 23 | 1: armv8_switch_to_el2_m x3, x4, x5 |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 24 | ENDPROC(armv8_switch_to_el2) |
| 25 | |
| 26 | ENTRY(armv8_switch_to_el1) |
Alison Wang | 73818d5 | 2016-11-10 10:49:03 +0800 | [diff] [blame] | 27 | switch_el x5, 0f, 1f, 0f |
| 28 | 0: |
| 29 | /* x3 is kernel entry point. When running in EL1 |
| 30 | * now, jump to the address saved in x3. |
| 31 | */ |
| 32 | br x3 |
| 33 | 1: armv8_switch_to_el1_m x3, x4, x5 |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 34 | ENDPROC(armv8_switch_to_el1) |