1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-18 00:12:03 +00:00

Mention that Nintendo copy-pasted some startup code from arm-trusted-firmware

This commit is contained in:
TuxSH 2018-02-21 00:53:23 +01:00
parent 5681622f65
commit 663c446439
3 changed files with 40 additions and 6 deletions

View file

@ -417,7 +417,7 @@ uint32_t user_decrypt_rsa_private_key(smc_args_t *args) {
}
is_personalized = (int)args->X[3];
user_address = (void *)args->X[4];
size = = (size_t)args->X[5];
size = (size_t)args->X[5];
wrapped_key[0] = args->X[6];
wrapped_key[1] = args->X[7];
@ -609,4 +609,4 @@ uint32_t user_unwrap_aes_wrapped_titlekey(smc_args_t *args) {
args->X[1] = sealed_titlekey[0];
args->X[2] = sealed_titlekey[1];
}
}

View file

@ -1,7 +1,14 @@
.align 4
.align 6
.section .text.cold.start, "ax", %progbits
.global __start_cold
__start_cold:
/* Nintendo copy-pasted https://github.com/ARM-software/arm-trusted-firmware/blob/master/plat/nvidia/tegra/common/aarch64/tegra_helpers.S#L312 */
/*
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* The following comments are mine. */
/* mask all interrupts */
msr daifset, daif
@ -25,6 +32,10 @@ __start_cold:
bic x0, x0, #1
msr cpuactlr_el1, x0
.rept 7
nop /* wait long enough for the write to cpuactlr_el1 to have completed */
.endr
/* if the OS lock is set, disable it and request a warm reset */
mrs x0, oslsr_el1
ands x0, x0, #2
@ -39,7 +50,13 @@ __start_cold:
msr rmr_el3, x0
isb
dsb
wfi
/* Nintendo forgot to copy-paste the branch instruction below. */
_reset_wfi:
wfi
b _reset_wfi
.rept 65
nop /* guard against speculative excecution */
.endr
_set_lock_and_sp:
/* set the OS lock */

View file

@ -1,7 +1,14 @@
.align 4
.align 6
.section .text.warm.start, "ax", %progbits
.global __start_warm
__start_warm:
/* Nintendo copy-pasted https://github.com/ARM-software/arm-trusted-firmware/blob/master/plat/nvidia/tegra/common/aarch64/tegra_helpers.S#L312 */
/*
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* The following comments are mine. */
/* mask all interrupts */
msr daifset, daif
@ -25,6 +32,10 @@ __start_warm:
bic x0, x0, #1
msr cpuactlr_el1, x0
.rept 7
nop /* wait long enough for the write to cpuactlr_el1 to have completed */
.endr
/* if the OS lock is set, disable it and request a warm reset */
mrs x0, oslsr_el1
ands x0, x0, #2
@ -39,7 +50,13 @@ __start_warm:
msr rmr_el3, x0
isb
dsb
wfi
/* Nintendo forgot to copy-paste the branch instruction below. */
_reset_wfi:
wfi
b _reset_wfi
.rept 65
nop /* guard against speculative excecution */
.endr
_set_lock_and_sp:
/* set the OS lock */