Konstantin Porotchkin | 01851db | 2018-10-03 14:21:42 +0300 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2018 Marvell International Ltd. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
| 8 | #include <asm_macros.S> |
| 9 | #include <marvell_def.h> |
| 10 | #include <platform_def.h> |
| 11 | |
| 12 | #define PTE_NON_EXEC_OFF 54 /* XN - eXecute Never bit offset - see VMSAv8-64 */ |
| 13 | |
| 14 | .globl marvell_ble_prepare_exit |
| 15 | |
| 16 | func marvell_ble_prepare_exit |
| 17 | /* |
| 18 | * Read the page table base and set the first page to be executable. |
| 19 | * This is required for jumping to DRAM for further execution. |
| 20 | */ |
| 21 | mrs x0, ttbr0_el3 |
| 22 | ldr x1, [x0] |
| 23 | mov x2, #1 |
| 24 | bic x1, x1, x2, lsl #PTE_NON_EXEC_OFF |
| 25 | str x1, [x0] |
| 26 | tlbi alle3 |
| 27 | dsb sy |
| 28 | isb |
| 29 | ret |
| 30 | endfunc marvell_ble_prepare_exit |