mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04:00
Finish writing coldboot_main
This commit is contained in:
parent
19dda5ed48
commit
78b9698260
3 changed files with 27 additions and 6 deletions
|
@ -3,20 +3,26 @@
|
|||
#include "mmu.h"
|
||||
#include "memory_map.h"
|
||||
#include "arm.h"
|
||||
#include "cpu_context.h"
|
||||
|
||||
extern uint8_t __pk2ldr_start__[], __pk2ldr_end__[];
|
||||
|
||||
/* start.s */
|
||||
void __jump_to_lower_el(uint64_t arg, uintptr_t ep, unsigned int el);
|
||||
void __attribute__((noreturn)) __jump_to_lower_el(uint64_t arg, uintptr_t ep, unsigned int el);
|
||||
|
||||
void coldboot_main(void) {
|
||||
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);
|
||||
uintptr_t ep;
|
||||
uint64_t arg;
|
||||
|
||||
/* Clear and unmap pk2ldr (which is reused as exception entry stacks) */
|
||||
memset((void *)pk2ldr, 0, __pk2ldr_end__ - __pk2ldr_start__);
|
||||
mmu_unmap_range(3, mmu_l3_table, pk2ldr, __pk2ldr_end__ - __pk2ldr_start__);
|
||||
tlb_invalidate_all_inner_shareable();
|
||||
|
||||
/* TODO: stuff & jump to lower EL */
|
||||
use_core_entrypoint_and_argument(get_core_id(), &ep, &arg);
|
||||
|
||||
/* Nintendo jumps to EL1, we jump to EL2. Both are supported with all current packages2. */
|
||||
__jump_to_lower_el(arg, ep, 2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue