kern: correct flushing of init arguments

This commit is contained in:
Michael Scire 2020-08-11 17:09:22 -07:00 committed by SciresM
parent 4a35904d73
commit f07bd0e337
3 changed files with 6 additions and 9 deletions

View file

@ -26,6 +26,5 @@ namespace ams::kern::init {
KPhysicalAddress GetInitArgumentsAddress(s32 core_id);
void SetInitArguments(s32 core_id, KPhysicalAddress address, uintptr_t arg);
void StoreInitArguments();
}

View file

@ -259,9 +259,6 @@ namespace ams::kern {
/* Setup the InitArguments. */
SetInitArguments(static_cast<s32>(i), core_local_region_start_phys[i], GetInteger(core_l1_ttbr1_phys[i]));
}
/* Ensure the InitArguments are flushed to cache. */
StoreInitArguments();
}
void SetupPoolPartitionMemoryRegions() {

View file

@ -349,6 +349,7 @@ namespace ams::kern::init {
}
void SetInitArguments(s32 core_id, KPhysicalAddress address, uintptr_t arg) {
/* Set the arguments. */
KInitArguments *init_args = reinterpret_cast<KInitArguments *>(GetInteger(address));
init_args->ttbr0 = cpu::GetTtbr0El1();
init_args->ttbr1 = arg;
@ -361,14 +362,14 @@ namespace ams::kern::init {
init_args->entrypoint = reinterpret_cast<uintptr_t>(::ams::kern::HorizonKernelMain);
init_args->argument = static_cast<u64>(core_id);
init_args->setup_function = reinterpret_cast<uintptr_t>(::ams::kern::init::StartOtherCore);
/* Ensure the arguments are written to memory. */
StoreDataCache(init_args, sizeof(*init_args));
/* Save the pointer to the arguments to use as argument upon core wakeup. */
g_init_arguments_phys_addr[core_id] = address;
}
void StoreInitArguments() {
StoreDataCache(g_init_arguments_phys_addr, sizeof(g_init_arguments_phys_addr));
}
void InitializeDebugRegisters() {
/* Determine how many watchpoints and breakpoints we have */
cpu::DebugFeatureRegisterAccessor aa64dfr0;