HOS 14.0.0 passed:
Extracting nca... ./43772e89bbf8147fef94a4e8d81f4810.nca (pcv) -> /Volumes/RAM/pcv/ ./5110ceed5e759af52d8ad3efcd005580.nca (ptm) -> /Volumes/RAM/ptm/ Converting nca to elf... Building and testing... Patching pcv... CpuClkOSLimit Count: 1 CpuVoltLimit* Count: 14 MemClkOSLimit Count: 32 MemVoltHOS Count: 2 MemClkPllmLimit Count: 2 in void ams::ldr::oc::pcv::Erista::Patch(uintptr_t, size_t) CpuClkOSLimit Count: 1 CpuClkOfficial Count: 1 GpuClkOfficial Count: 1 CpuVoltOfficial Count: 13 MemClkOSLimit Count: 32 GpuClkPllLimit Count: 1 MemClkPllmLimit Count: 2 GpuAsmPattern Count: 2 in void ams::ldr::oc::pcv::Mariko::Patch(uintptr_t, size_t) Passed! Patching ptm... cpuPtmBoost Count: 2 memPtmMax Count: 9 memPtmAlt Count: 7 in void ams::ldr::oc::ptm::Patch(uintptr_t, size_t) Passed!
This commit is contained in:
@@ -1155,11 +1155,22 @@ namespace ams::ldr::oc {
|
|||||||
constexpr u32 cpuPtmDefault = 1020'000'000;
|
constexpr u32 cpuPtmDefault = 1020'000'000;
|
||||||
constexpr u32 cpuPtmDevOC = 1224'000'000;
|
constexpr u32 cpuPtmDevOC = 1224'000'000;
|
||||||
constexpr u32 cpuPtmBoost = 1785'000'000;
|
constexpr u32 cpuPtmBoost = 1785'000'000;
|
||||||
const u32 cpuPtmBoostNew = C.marikoCpuBoostClock * 1000;
|
const u32 cpuPtmBoostNew = (C.marikoCpuBoostClock ?
|
||||||
|
C.marikoCpuBoostClock * 1000 : cpuPtmBoost);
|
||||||
constexpr u32 memPtmLimit = 1600'000'000;
|
constexpr u32 memPtmLimit = 1600'000'000;
|
||||||
constexpr u32 memPtmAlt = 1331'200'000;
|
constexpr u32 memPtmAlt = 1331'200'000;
|
||||||
constexpr u32 memPtmClamp = 1065'600'000;
|
constexpr u32 memPtmClamp = 1065'600'000;
|
||||||
const u32 memPtmMax = C.marikoEmcMaxClock * 1000;
|
const u32 memPtmMax = (C.marikoEmcMaxClock ?
|
||||||
|
C.marikoEmcMaxClock * 1000 : memPtmLimit);
|
||||||
|
|
||||||
|
enum PatchSuccessCnt {
|
||||||
|
CPU_BOOST,
|
||||||
|
MEM_MAX,
|
||||||
|
MEM_ALT,
|
||||||
|
CNT_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 cnt[CNT_MAX] = {};
|
||||||
|
|
||||||
for (uintptr_t ptr = mapped_nso;
|
for (uintptr_t ptr = mapped_nso;
|
||||||
ptr <= mapped_nso + nso_size - sizeof(perf_conf_entry) * entryCnt;
|
ptr <= mapped_nso + nso_size - sizeof(perf_conf_entry) * entryCnt;
|
||||||
@@ -1201,7 +1212,8 @@ namespace ams::ldr::oc {
|
|||||||
case cpuPtmBoost:
|
case cpuPtmBoost:
|
||||||
PatchOffset(&(entry_current->cpu_freq_1), cpuPtmBoostNew);
|
PatchOffset(&(entry_current->cpu_freq_1), cpuPtmBoostNew);
|
||||||
PatchOffset(&(entry_current->cpu_freq_2), cpuPtmBoostNew);
|
PatchOffset(&(entry_current->cpu_freq_2), cpuPtmBoostNew);
|
||||||
LOGGING("0x%x: CPU: Boost Freq", entry_current->conf_id);
|
cnt[CPU_BOOST]++;
|
||||||
|
// LOGGING("0x%08x: CPU: Boost Freq", entry_current->conf_id);
|
||||||
break;
|
break;
|
||||||
case cpuPtmDefault:
|
case cpuPtmDefault:
|
||||||
case cpuPtmDevOC:
|
case cpuPtmDevOC:
|
||||||
@@ -1216,19 +1228,35 @@ namespace ams::ldr::oc {
|
|||||||
case memPtmLimit:
|
case memPtmLimit:
|
||||||
PatchOffset(&(entry_current->emc_freq_1), memPtmMax);
|
PatchOffset(&(entry_current->emc_freq_1), memPtmMax);
|
||||||
PatchOffset(&(entry_current->emc_freq_2), memPtmMax);
|
PatchOffset(&(entry_current->emc_freq_2), memPtmMax);
|
||||||
LOGGING("0x%x: MEM: Max Freq", entry_current->conf_id);
|
cnt[MEM_MAX]++;
|
||||||
|
// LOGGING("0x%08x: MEM: Max Freq", entry_current->conf_id);
|
||||||
break;
|
break;
|
||||||
case memPtmAlt:
|
case memPtmAlt:
|
||||||
case memPtmClamp:
|
case memPtmClamp:
|
||||||
PatchOffset(&(entry_current->emc_freq_1), memPtmLimit);
|
PatchOffset(&(entry_current->emc_freq_1), memPtmLimit);
|
||||||
PatchOffset(&(entry_current->emc_freq_2), memPtmLimit);
|
PatchOffset(&(entry_current->emc_freq_2), memPtmLimit);
|
||||||
LOGGING("0x%x: MEM: Alt Freq", entry_current->conf_id);
|
cnt[MEM_ALT]++;
|
||||||
|
// LOGGING("0x%08x: MEM: Alt Freq", entry_current->conf_id);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGGING("Unknown MEM Freq: %u @%p!", entry_current->emc_freq_1, &(entry_current->emc_freq_1));
|
LOGGING("Unknown MEM Freq: %u @%p!", entry_current->emc_freq_1, &(entry_current->emc_freq_1));
|
||||||
CRASH();
|
CRASH();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGGING("cpuPtmBoost Count: %u\n"\
|
||||||
|
"memPtmMax Count: %u\n"\
|
||||||
|
"memPtmAlt Count: %u",
|
||||||
|
cnt[CPU_BOOST],
|
||||||
|
cnt[MEM_MAX],
|
||||||
|
cnt[MEM_ALT]);
|
||||||
|
|
||||||
|
if (cnt[CPU_BOOST] > 2 ||
|
||||||
|
cnt[MEM_MAX] > 9 ||
|
||||||
|
cnt[MEM_ALT] > 7)
|
||||||
|
{
|
||||||
|
CRASH();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ static void* ReadFile(const char* file_loc, long* out_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
const char* pcv_opt = "-pcv";
|
const char* pcv_opt = "pcv";
|
||||||
const char* ptm_opt = "-ptm";
|
const char* ptm_opt = "ptm";
|
||||||
enum {
|
enum {
|
||||||
EXE_PCV,
|
EXE_PCV,
|
||||||
EXE_PTM,
|
EXE_PTM,
|
||||||
@@ -81,14 +81,16 @@ int main(int argc, char** argv) {
|
|||||||
size_t exe_size = reinterpret_cast<size_t>(file_size * sizeof(char));
|
size_t exe_size = reinterpret_cast<size_t>(file_size * sizeof(char));
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case EXE_PCV:
|
case EXE_PCV:
|
||||||
|
printf("Patching %s...\n", pcv_opt);
|
||||||
ams::ldr::oc::pcv::Patch(mapped_exe, exe_size);
|
ams::ldr::oc::pcv::Patch(mapped_exe, exe_size);
|
||||||
break;
|
break;
|
||||||
case EXE_PTM:
|
case EXE_PTM:
|
||||||
|
printf("Patching %s...\n", ptm_opt);
|
||||||
ams::ldr::oc::ptm::Patch(mapped_exe, exe_size);
|
ams::ldr::oc::ptm::Patch(mapped_exe, exe_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(file_buffer);
|
free(file_buffer);
|
||||||
printf("Passed!\n");
|
printf("Passed!\n\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
46
Source/Atmosphere/stratosphere/loader/source/oc/test.sh
Executable file
46
Source/Atmosphere/stratosphere/loader/source/oc/test.sh
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
fw_dir="/Volumes/RAM/NX-14.0.0/"
|
||||||
|
tmp_dir="/Volumes/RAM/"
|
||||||
|
oc_test_dir="$HOME/Source/Switch-OC-Suite/Source/Atmosphere/stratosphere/loader/source/oc"
|
||||||
|
prodkeys="$HOME/.switch/prod.keys"
|
||||||
|
hactool_exe="$HOME/Source/hactool/hactool"
|
||||||
|
nx2elf_exe="$HOME/Source/nx2elf/nx2elf"
|
||||||
|
|
||||||
|
echo -e "\nExtracting nca..."
|
||||||
|
out_pcv="${tmp_dir}pcv/"
|
||||||
|
out_ptm="${tmp_dir}ptm/"
|
||||||
|
cd $fw_dir
|
||||||
|
for nca_file in ./*.nca
|
||||||
|
do
|
||||||
|
file_size=`wc -c "$nca_file" | awk '{print $1}'`
|
||||||
|
if [[ "$nca_file" == *".cnmt."* || file_size -lt 16384 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
titleid=`$hactool_exe -k $prodkeys --disablekeywarns -t nca $nca_file | grep 'Title ID'`
|
||||||
|
|
||||||
|
if [[ $titleid == *"010000000000001a"* ]]; then
|
||||||
|
echo "$nca_file (pcv) -> $out_pcv"
|
||||||
|
$hactool_exe -k $prodkeys --disablekeywarns -t nca $nca_file --exefsdir "$out_pcv" 1> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $titleid == *"0100000000000010"* ]]; then
|
||||||
|
echo "$nca_file (ptm) -> $out_ptm"
|
||||||
|
$hactool_exe -k $prodkeys --disablekeywarns -t nca $nca_file --exefsdir "$out_ptm" 1> /dev/null
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "\nConverting nca to elf..."
|
||||||
|
$nx2elf_exe "${out_pcv}main" 1> /dev/null
|
||||||
|
$nx2elf_exe "${out_ptm}main" 1> /dev/null
|
||||||
|
|
||||||
|
echo -e "\nBuilding and testing..."
|
||||||
|
cd $oc_test_dir
|
||||||
|
make test 1> /dev/null
|
||||||
|
./test pcv "${out_pcv}main.elf"
|
||||||
|
./test ptm "${out_ptm}main.elf"
|
||||||
|
make clean 1> /dev/null
|
||||||
|
|
||||||
|
rm -fr $out_pcv
|
||||||
|
rm -fr $out_ptm
|
||||||
Reference in New Issue
Block a user