2018-09-07 16:00:13 +01:00
|
|
|
/*
|
2020-01-24 10:10:40 +00:00
|
|
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
2018-09-07 16:00:13 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-02-25 02:54:28 +00:00
|
|
|
#include <string.h>
|
2018-02-25 02:34:15 +00:00
|
|
|
#include "utils.h"
|
|
|
|
#include "mmu.h"
|
|
|
|
#include "memory_map.h"
|
2018-02-27 21:29:47 +00:00
|
|
|
#include "arm.h"
|
2018-03-01 00:40:09 +00:00
|
|
|
#include "cpu_context.h"
|
2018-02-25 02:34:15 +00:00
|
|
|
|
2018-02-25 02:54:28 +00:00
|
|
|
extern uint8_t __pk2ldr_start__[], __pk2ldr_end__[];
|
2018-02-25 02:34:15 +00:00
|
|
|
|
|
|
|
void coldboot_main(void) {
|
2018-02-26 21:09:35 +00:00
|
|
|
uintptr_t *mmu_l3_table = (uintptr_t *)TZRAM_GET_SEGMENT_ADDRESS(TZRAM_SEGMENT_ID_L3_TRANSLATION_TABLE);
|
|
|
|
uintptr_t pk2ldr = TZRAM_GET_SEGMENT_ADDRESS(TZRAM_SEGMENT_ID_PK2LDR);
|
2018-02-25 02:54:28 +00:00
|
|
|
|
|
|
|
/* Clear and unmap pk2ldr (which is reused as exception entry stacks) */
|
2018-02-25 19:00:50 +00:00
|
|
|
memset((void *)pk2ldr, 0, __pk2ldr_end__ - __pk2ldr_start__);
|
|
|
|
mmu_unmap_range(3, mmu_l3_table, pk2ldr, __pk2ldr_end__ - __pk2ldr_start__);
|
2018-02-25 02:54:28 +00:00
|
|
|
tlb_invalidate_all_inner_shareable();
|
|
|
|
|
2018-03-03 02:43:46 +00:00
|
|
|
core_jump_to_lower_el();
|
2018-02-25 02:34:15 +00:00
|
|
|
}
|