chore: clean up repo

This commit is contained in:
souldbminersmwc
2026-01-31 17:19:33 -05:00
parent 8de1191ed5
commit 4692529346
14 changed files with 1 additions and 1221 deletions

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) Atmosphère-NX
*
* 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/>.
*/
#define __ACCESS_TABLE_NAME__ EmcAccessTable
#define __ACCESS_TABLE_ADDRESS__ MemoryRegionPhysicalDeviceExternalMemoryController.GetAddress()
#define __ACCESS_TABLE_INC__ "secmon_emc_access_table_data.inc"
#include "secmon_define_access_table.inc"
#undef __ACCESS_TABLE_INC__
#undef __ACCESS_TABLE_ADDRESS__
#undef __ACCESS_TABLE_NAME__

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) Atmosphère-NX
*
* 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/>.
*/
#define __ACCESS_TABLE_NAME__ SocthermAccessTable
#define __ACCESS_TABLE_ADDRESS__ MemoryRegionPhysicalDeviceSoctherm.GetAddress()
#define __ACCESS_TABLE_INC__ "secmon_soctherm_access_table_data.inc"
#include "secmon_define_access_table.inc"
#undef __ACCESS_TABLE_INC__
#undef __ACCESS_TABLE_ADDRESS__
#undef __ACCESS_TABLE_NAME__

View File

@@ -0,0 +1,967 @@
/*
* Copyright (c) Atmosphère-NX
*
* 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/>.
*/
SetRegisterAllowed(0x0);
SetRegisterAllowed(0x4);
SetRegisterAllowed(0x8);
SetRegisterAllowed(0xC);
SetRegisterAllowed(0x10);
SetRegisterAllowed(0x14);
SetRegisterAllowed(0x18);
SetRegisterAllowed(0x1C);
SetRegisterAllowed(0x20);
SetRegisterAllowed(0x24);
SetRegisterAllowed(0x28);
SetRegisterAllowed(0x2C);
SetRegisterAllowed(0x30);
SetRegisterAllowed(0x34);
SetRegisterAllowed(0x38);
SetRegisterAllowed(0x3C);
SetRegisterAllowed(0x40);
SetRegisterAllowed(0x44);
SetRegisterAllowed(0x48);
SetRegisterAllowed(0x4C);
SetRegisterAllowed(0x50);
SetRegisterAllowed(0x54);
SetRegisterAllowed(0x58);
SetRegisterAllowed(0x5C);
SetRegisterAllowed(0x60);
SetRegisterAllowed(0x64);
SetRegisterAllowed(0x68);
SetRegisterAllowed(0x6C);
SetRegisterAllowed(0x70);
SetRegisterAllowed(0x74);
SetRegisterAllowed(0x78);
SetRegisterAllowed(0x7C);
SetRegisterAllowed(0x80);
SetRegisterAllowed(0x84);
SetRegisterAllowed(0x88);
SetRegisterAllowed(0x8C);
SetRegisterAllowed(0x90);
SetRegisterAllowed(0x94);
SetRegisterAllowed(0x98);
SetRegisterAllowed(0x9C);
SetRegisterAllowed(0xA0);
SetRegisterAllowed(0xA4);
SetRegisterAllowed(0xA8);
SetRegisterAllowed(0xAC);
SetRegisterAllowed(0xB0);
SetRegisterAllowed(0xB4);
SetRegisterAllowed(0xB8);
SetRegisterAllowed(0xBC);
SetRegisterAllowed(0xC0);
SetRegisterAllowed(0xC4);
SetRegisterAllowed(0xC8);
SetRegisterAllowed(0xCC);
SetRegisterAllowed(0xD0);
SetRegisterAllowed(0xD4);
SetRegisterAllowed(0xD8);
SetRegisterAllowed(0xDC);
SetRegisterAllowed(0xE0);
SetRegisterAllowed(0xE4);
SetRegisterAllowed(0xE8);
SetRegisterAllowed(0xEC);
SetRegisterAllowed(0xF0);
SetRegisterAllowed(0xF4);
SetRegisterAllowed(0xF8);
SetRegisterAllowed(0xFC);
SetRegisterAllowed(0x100);
SetRegisterAllowed(0x104);
SetRegisterAllowed(0x108);
SetRegisterAllowed(0x10C);
SetRegisterAllowed(0x110);
SetRegisterAllowed(0x114);
SetRegisterAllowed(0x118);
SetRegisterAllowed(0x11C);
SetRegisterAllowed(0x120);
SetRegisterAllowed(0x124);
SetRegisterAllowed(0x128);
SetRegisterAllowed(0x12C);
SetRegisterAllowed(0x130);
SetRegisterAllowed(0x134);
SetRegisterAllowed(0x138);
SetRegisterAllowed(0x13C);
SetRegisterAllowed(0x140);
SetRegisterAllowed(0x144);
SetRegisterAllowed(0x148);
SetRegisterAllowed(0x14C);
SetRegisterAllowed(0x150);
SetRegisterAllowed(0x154);
SetRegisterAllowed(0x158);
SetRegisterAllowed(0x15C);
SetRegisterAllowed(0x160);
SetRegisterAllowed(0x164);
SetRegisterAllowed(0x168);
SetRegisterAllowed(0x16C);
SetRegisterAllowed(0x170);
SetRegisterAllowed(0x174);
SetRegisterAllowed(0x178);
SetRegisterAllowed(0x17C);
SetRegisterAllowed(0x180);
SetRegisterAllowed(0x184);
SetRegisterAllowed(0x188);
SetRegisterAllowed(0x18C);
SetRegisterAllowed(0x190);
SetRegisterAllowed(0x194);
SetRegisterAllowed(0x198);
SetRegisterAllowed(0x19C);
SetRegisterAllowed(0x1A0);
SetRegisterAllowed(0x1A4);
SetRegisterAllowed(0x1A8);
SetRegisterAllowed(0x1AC);
SetRegisterAllowed(0x1B0);
SetRegisterAllowed(0x1B4);
SetRegisterAllowed(0x1B8);
SetRegisterAllowed(0x1BC);
SetRegisterAllowed(0x1C0);
SetRegisterAllowed(0x1C4);
SetRegisterAllowed(0x1C8);
SetRegisterAllowed(0x1CC);
SetRegisterAllowed(0x1D0);
SetRegisterAllowed(0x1D4);
SetRegisterAllowed(0x1D8);
SetRegisterAllowed(0x1DC);
SetRegisterAllowed(0x1E0);
SetRegisterAllowed(0x1E4);
SetRegisterAllowed(0x1E8);
SetRegisterAllowed(0x1EC);
SetRegisterAllowed(0x1F0);
SetRegisterAllowed(0x1F4);
SetRegisterAllowed(0x1F8);
SetRegisterAllowed(0x1FC);
SetRegisterAllowed(0x200);
SetRegisterAllowed(0x204);
SetRegisterAllowed(0x208);
SetRegisterAllowed(0x20C);
SetRegisterAllowed(0x210);
SetRegisterAllowed(0x214);
SetRegisterAllowed(0x218);
SetRegisterAllowed(0x21C);
SetRegisterAllowed(0x220);
SetRegisterAllowed(0x224);
SetRegisterAllowed(0x228);
SetRegisterAllowed(0x22C);
SetRegisterAllowed(0x230);
SetRegisterAllowed(0x234);
SetRegisterAllowed(0x238);
SetRegisterAllowed(0x23C);
SetRegisterAllowed(0x240);
SetRegisterAllowed(0x244);
SetRegisterAllowed(0x248);
SetRegisterAllowed(0x24C);
SetRegisterAllowed(0x250);
SetRegisterAllowed(0x254);
SetRegisterAllowed(0x258);
SetRegisterAllowed(0x25C);
SetRegisterAllowed(0x260);
SetRegisterAllowed(0x264);
SetRegisterAllowed(0x268);
SetRegisterAllowed(0x26C);
SetRegisterAllowed(0x270);
SetRegisterAllowed(0x274);
SetRegisterAllowed(0x278);
SetRegisterAllowed(0x27C);
SetRegisterAllowed(0x280);
SetRegisterAllowed(0x284);
SetRegisterAllowed(0x288);
SetRegisterAllowed(0x28C);
SetRegisterAllowed(0x290);
SetRegisterAllowed(0x294);
SetRegisterAllowed(0x298);
SetRegisterAllowed(0x29C);
SetRegisterAllowed(0x2A0);
SetRegisterAllowed(0x2A4);
SetRegisterAllowed(0x2A8);
SetRegisterAllowed(0x2AC);
SetRegisterAllowed(0x2B0);
SetRegisterAllowed(0x2B4);
SetRegisterAllowed(0x2B8);
SetRegisterAllowed(0x2BC);
SetRegisterAllowed(0x2C0);
SetRegisterAllowed(0x2C4);
SetRegisterAllowed(0x2C8);
SetRegisterAllowed(0x2CC);
SetRegisterAllowed(0x2D0);
SetRegisterAllowed(0x2D4);
SetRegisterAllowed(0x2D8);
SetRegisterAllowed(0x2DC);
SetRegisterAllowed(0x2E0);
SetRegisterAllowed(0x2E4);
SetRegisterAllowed(0x2E8);
SetRegisterAllowed(0x2EC);
SetRegisterAllowed(0x2F0);
SetRegisterAllowed(0x2F4);
SetRegisterAllowed(0x2F8);
SetRegisterAllowed(0x2FC);
SetRegisterAllowed(0x300);
SetRegisterAllowed(0x304);
SetRegisterAllowed(0x308);
SetRegisterAllowed(0x30C);
SetRegisterAllowed(0x310);
SetRegisterAllowed(0x314);
SetRegisterAllowed(0x318);
SetRegisterAllowed(0x31C);
SetRegisterAllowed(0x320);
SetRegisterAllowed(0x324);
SetRegisterAllowed(0x328);
SetRegisterAllowed(0x32C);
SetRegisterAllowed(0x330);
SetRegisterAllowed(0x334);
SetRegisterAllowed(0x338);
SetRegisterAllowed(0x33C);
SetRegisterAllowed(0x340);
SetRegisterAllowed(0x344);
SetRegisterAllowed(0x348);
SetRegisterAllowed(0x34C);
SetRegisterAllowed(0x350);
SetRegisterAllowed(0x354);
SetRegisterAllowed(0x358);
SetRegisterAllowed(0x35C);
SetRegisterAllowed(0x360);
SetRegisterAllowed(0x364);
SetRegisterAllowed(0x368);
SetRegisterAllowed(0x36C);
SetRegisterAllowed(0x370);
SetRegisterAllowed(0x374);
SetRegisterAllowed(0x378);
SetRegisterAllowed(0x37C);
SetRegisterAllowed(0x380);
SetRegisterAllowed(0x384);
SetRegisterAllowed(0x388);
SetRegisterAllowed(0x38C);
SetRegisterAllowed(0x390);
SetRegisterAllowed(0x394);
SetRegisterAllowed(0x398);
SetRegisterAllowed(0x39C);
SetRegisterAllowed(0x3A0);
SetRegisterAllowed(0x3A4);
SetRegisterAllowed(0x3A8);
SetRegisterAllowed(0x3AC);
SetRegisterAllowed(0x3B0);
SetRegisterAllowed(0x3B4);
SetRegisterAllowed(0x3B8);
SetRegisterAllowed(0x3BC);
SetRegisterAllowed(0x3C0);
SetRegisterAllowed(0x3C4);
SetRegisterAllowed(0x3C8);
SetRegisterAllowed(0x3CC);
SetRegisterAllowed(0x3D0);
SetRegisterAllowed(0x3D4);
SetRegisterAllowed(0x3D8);
SetRegisterAllowed(0x3DC);
SetRegisterAllowed(0x3E0);
SetRegisterAllowed(0x3E4);
SetRegisterAllowed(0x3E8);
SetRegisterAllowed(0x3EC);
SetRegisterAllowed(0x3F0);
SetRegisterAllowed(0x3F4);
SetRegisterAllowed(0x3F8);
SetRegisterAllowed(0x3FC);
SetRegisterAllowed(0x400);
SetRegisterAllowed(0x404);
SetRegisterAllowed(0x408);
SetRegisterAllowed(0x40C);
SetRegisterAllowed(0x410);
SetRegisterAllowed(0x414);
SetRegisterAllowed(0x418);
SetRegisterAllowed(0x41C);
SetRegisterAllowed(0x420);
SetRegisterAllowed(0x424);
SetRegisterAllowed(0x428);
SetRegisterAllowed(0x42C);
SetRegisterAllowed(0x430);
SetRegisterAllowed(0x434);
SetRegisterAllowed(0x438);
SetRegisterAllowed(0x43C);
SetRegisterAllowed(0x440);
SetRegisterAllowed(0x444);
SetRegisterAllowed(0x448);
SetRegisterAllowed(0x44C);
SetRegisterAllowed(0x450);
SetRegisterAllowed(0x454);
SetRegisterAllowed(0x458);
SetRegisterAllowed(0x45C);
SetRegisterAllowed(0x460);
SetRegisterAllowed(0x464);
SetRegisterAllowed(0x468);
SetRegisterAllowed(0x46C);
SetRegisterAllowed(0x470);
SetRegisterAllowed(0x474);
SetRegisterAllowed(0x478);
SetRegisterAllowed(0x47C);
SetRegisterAllowed(0x480);
SetRegisterAllowed(0x484);
SetRegisterAllowed(0x488);
SetRegisterAllowed(0x48C);
SetRegisterAllowed(0x490);
SetRegisterAllowed(0x494);
SetRegisterAllowed(0x498);
SetRegisterAllowed(0x49C);
SetRegisterAllowed(0x4A0);
SetRegisterAllowed(0x4A4);
SetRegisterAllowed(0x4A8);
SetRegisterAllowed(0x4AC);
SetRegisterAllowed(0x4B0);
SetRegisterAllowed(0x4B4);
SetRegisterAllowed(0x4B8);
SetRegisterAllowed(0x4BC);
SetRegisterAllowed(0x4C0);
SetRegisterAllowed(0x4C4);
SetRegisterAllowed(0x4C8);
SetRegisterAllowed(0x4CC);
SetRegisterAllowed(0x4D0);
SetRegisterAllowed(0x4D4);
SetRegisterAllowed(0x4D8);
SetRegisterAllowed(0x4DC);
SetRegisterAllowed(0x4E0);
SetRegisterAllowed(0x4E4);
SetRegisterAllowed(0x4E8);
SetRegisterAllowed(0x4EC);
SetRegisterAllowed(0x4F0);
SetRegisterAllowed(0x4F4);
SetRegisterAllowed(0x4F8);
SetRegisterAllowed(0x4FC);
SetRegisterAllowed(0x500);
SetRegisterAllowed(0x504);
SetRegisterAllowed(0x508);
SetRegisterAllowed(0x50C);
SetRegisterAllowed(0x510);
SetRegisterAllowed(0x514);
SetRegisterAllowed(0x518);
SetRegisterAllowed(0x51C);
SetRegisterAllowed(0x520);
SetRegisterAllowed(0x524);
SetRegisterAllowed(0x528);
SetRegisterAllowed(0x52C);
SetRegisterAllowed(0x530);
SetRegisterAllowed(0x534);
SetRegisterAllowed(0x538);
SetRegisterAllowed(0x53C);
SetRegisterAllowed(0x540);
SetRegisterAllowed(0x544);
SetRegisterAllowed(0x548);
SetRegisterAllowed(0x54C);
SetRegisterAllowed(0x550);
SetRegisterAllowed(0x554);
SetRegisterAllowed(0x558);
SetRegisterAllowed(0x55C);
SetRegisterAllowed(0x560);
SetRegisterAllowed(0x564);
SetRegisterAllowed(0x568);
SetRegisterAllowed(0x56C);
SetRegisterAllowed(0x570);
SetRegisterAllowed(0x574);
SetRegisterAllowed(0x578);
SetRegisterAllowed(0x57C);
SetRegisterAllowed(0x580);
SetRegisterAllowed(0x584);
SetRegisterAllowed(0x588);
SetRegisterAllowed(0x58C);
SetRegisterAllowed(0x590);
SetRegisterAllowed(0x594);
SetRegisterAllowed(0x598);
SetRegisterAllowed(0x59C);
SetRegisterAllowed(0x5A0);
SetRegisterAllowed(0x5A4);
SetRegisterAllowed(0x5A8);
SetRegisterAllowed(0x5AC);
SetRegisterAllowed(0x5B0);
SetRegisterAllowed(0x5B4);
SetRegisterAllowed(0x5B8);
SetRegisterAllowed(0x5BC);
SetRegisterAllowed(0x5C0);
SetRegisterAllowed(0x5C4);
SetRegisterAllowed(0x5C8);
SetRegisterAllowed(0x5CC);
SetRegisterAllowed(0x5D0);
SetRegisterAllowed(0x5D4);
SetRegisterAllowed(0x5D8);
SetRegisterAllowed(0x5DC);
SetRegisterAllowed(0x5E0);
SetRegisterAllowed(0x5E4);
SetRegisterAllowed(0x5E8);
SetRegisterAllowed(0x5EC);
SetRegisterAllowed(0x5F0);
SetRegisterAllowed(0x5F4);
SetRegisterAllowed(0x5F8);
SetRegisterAllowed(0x5FC);
SetRegisterAllowed(0x600);
SetRegisterAllowed(0x604);
SetRegisterAllowed(0x608);
SetRegisterAllowed(0x60C);
SetRegisterAllowed(0x610);
SetRegisterAllowed(0x614);
SetRegisterAllowed(0x618);
SetRegisterAllowed(0x61C);
SetRegisterAllowed(0x620);
SetRegisterAllowed(0x624);
SetRegisterAllowed(0x628);
SetRegisterAllowed(0x62C);
SetRegisterAllowed(0x630);
SetRegisterAllowed(0x634);
SetRegisterAllowed(0x638);
SetRegisterAllowed(0x63C);
SetRegisterAllowed(0x640);
SetRegisterAllowed(0x644);
SetRegisterAllowed(0x648);
SetRegisterAllowed(0x64C);
SetRegisterAllowed(0x650);
SetRegisterAllowed(0x654);
SetRegisterAllowed(0x658);
SetRegisterAllowed(0x65C);
SetRegisterAllowed(0x660);
SetRegisterAllowed(0x664);
SetRegisterAllowed(0x668);
SetRegisterAllowed(0x66C);
SetRegisterAllowed(0x670);
SetRegisterAllowed(0x674);
SetRegisterAllowed(0x678);
SetRegisterAllowed(0x67C);
SetRegisterAllowed(0x680);
SetRegisterAllowed(0x684);
SetRegisterAllowed(0x688);
SetRegisterAllowed(0x68C);
SetRegisterAllowed(0x690);
SetRegisterAllowed(0x694);
SetRegisterAllowed(0x698);
SetRegisterAllowed(0x69C);
SetRegisterAllowed(0x6A0);
SetRegisterAllowed(0x6A4);
SetRegisterAllowed(0x6A8);
SetRegisterAllowed(0x6AC);
SetRegisterAllowed(0x6B0);
SetRegisterAllowed(0x6B4);
SetRegisterAllowed(0x6B8);
SetRegisterAllowed(0x6BC);
SetRegisterAllowed(0x6C0);
SetRegisterAllowed(0x6C4);
SetRegisterAllowed(0x6C8);
SetRegisterAllowed(0x6CC);
SetRegisterAllowed(0x6D0);
SetRegisterAllowed(0x6D4);
SetRegisterAllowed(0x6D8);
SetRegisterAllowed(0x6DC);
SetRegisterAllowed(0x6E0);
SetRegisterAllowed(0x6E4);
SetRegisterAllowed(0x6E8);
SetRegisterAllowed(0x6EC);
SetRegisterAllowed(0x6F0);
SetRegisterAllowed(0x6F4);
SetRegisterAllowed(0x6F8);
SetRegisterAllowed(0x6FC);
SetRegisterAllowed(0x700);
SetRegisterAllowed(0x704);
SetRegisterAllowed(0x708);
SetRegisterAllowed(0x70C);
SetRegisterAllowed(0x710);
SetRegisterAllowed(0x714);
SetRegisterAllowed(0x718);
SetRegisterAllowed(0x71C);
SetRegisterAllowed(0x720);
SetRegisterAllowed(0x724);
SetRegisterAllowed(0x728);
SetRegisterAllowed(0x72C);
SetRegisterAllowed(0x730);
SetRegisterAllowed(0x734);
SetRegisterAllowed(0x738);
SetRegisterAllowed(0x73C);
SetRegisterAllowed(0x740);
SetRegisterAllowed(0x744);
SetRegisterAllowed(0x748);
SetRegisterAllowed(0x74C);
SetRegisterAllowed(0x750);
SetRegisterAllowed(0x754);
SetRegisterAllowed(0x758);
SetRegisterAllowed(0x75C);
SetRegisterAllowed(0x760);
SetRegisterAllowed(0x764);
SetRegisterAllowed(0x768);
SetRegisterAllowed(0x76C);
SetRegisterAllowed(0x770);
SetRegisterAllowed(0x774);
SetRegisterAllowed(0x778);
SetRegisterAllowed(0x77C);
SetRegisterAllowed(0x780);
SetRegisterAllowed(0x784);
SetRegisterAllowed(0x788);
SetRegisterAllowed(0x78C);
SetRegisterAllowed(0x790);
SetRegisterAllowed(0x794);
SetRegisterAllowed(0x798);
SetRegisterAllowed(0x79C);
SetRegisterAllowed(0x7A0);
SetRegisterAllowed(0x7A4);
SetRegisterAllowed(0x7A8);
SetRegisterAllowed(0x7AC);
SetRegisterAllowed(0x7B0);
SetRegisterAllowed(0x7B4);
SetRegisterAllowed(0x7B8);
SetRegisterAllowed(0x7BC);
SetRegisterAllowed(0x7C0);
SetRegisterAllowed(0x7C4);
SetRegisterAllowed(0x7C8);
SetRegisterAllowed(0x7CC);
SetRegisterAllowed(0x7D0);
SetRegisterAllowed(0x7D4);
SetRegisterAllowed(0x7D8);
SetRegisterAllowed(0x7DC);
SetRegisterAllowed(0x7E0);
SetRegisterAllowed(0x7E4);
SetRegisterAllowed(0x7E8);
SetRegisterAllowed(0x7EC);
SetRegisterAllowed(0x7F0);
SetRegisterAllowed(0x7F4);
SetRegisterAllowed(0x7F8);
SetRegisterAllowed(0x7FC);
SetRegisterAllowed(0x800);
SetRegisterAllowed(0x804);
SetRegisterAllowed(0x808);
SetRegisterAllowed(0x80C);
SetRegisterAllowed(0x810);
SetRegisterAllowed(0x814);
SetRegisterAllowed(0x818);
SetRegisterAllowed(0x81C);
SetRegisterAllowed(0x820);
SetRegisterAllowed(0x824);
SetRegisterAllowed(0x828);
SetRegisterAllowed(0x82C);
SetRegisterAllowed(0x830);
SetRegisterAllowed(0x834);
SetRegisterAllowed(0x838);
SetRegisterAllowed(0x83C);
SetRegisterAllowed(0x840);
SetRegisterAllowed(0x844);
SetRegisterAllowed(0x848);
SetRegisterAllowed(0x84C);
SetRegisterAllowed(0x850);
SetRegisterAllowed(0x854);
SetRegisterAllowed(0x858);
SetRegisterAllowed(0x85C);
SetRegisterAllowed(0x860);
SetRegisterAllowed(0x864);
SetRegisterAllowed(0x868);
SetRegisterAllowed(0x86C);
SetRegisterAllowed(0x870);
SetRegisterAllowed(0x874);
SetRegisterAllowed(0x878);
SetRegisterAllowed(0x87C);
SetRegisterAllowed(0x880);
SetRegisterAllowed(0x884);
SetRegisterAllowed(0x888);
SetRegisterAllowed(0x88C);
SetRegisterAllowed(0x890);
SetRegisterAllowed(0x894);
SetRegisterAllowed(0x898);
SetRegisterAllowed(0x89C);
SetRegisterAllowed(0x8A0);
SetRegisterAllowed(0x8A4);
SetRegisterAllowed(0x8A8);
SetRegisterAllowed(0x8AC);
SetRegisterAllowed(0x8B0);
SetRegisterAllowed(0x8B4);
SetRegisterAllowed(0x8B8);
SetRegisterAllowed(0x8BC);
SetRegisterAllowed(0x8C0);
SetRegisterAllowed(0x8C4);
SetRegisterAllowed(0x8C8);
SetRegisterAllowed(0x8CC);
SetRegisterAllowed(0x8D0);
SetRegisterAllowed(0x8D4);
SetRegisterAllowed(0x8D8);
SetRegisterAllowed(0x8DC);
SetRegisterAllowed(0x8E0);
SetRegisterAllowed(0x8E4);
SetRegisterAllowed(0x8E8);
SetRegisterAllowed(0x8EC);
SetRegisterAllowed(0x8F0);
SetRegisterAllowed(0x8F4);
SetRegisterAllowed(0x8F8);
SetRegisterAllowed(0x8FC);
SetRegisterAllowed(0x900);
SetRegisterAllowed(0x904);
SetRegisterAllowed(0x908);
SetRegisterAllowed(0x90C);
SetRegisterAllowed(0x910);
SetRegisterAllowed(0x914);
SetRegisterAllowed(0x918);
SetRegisterAllowed(0x91C);
SetRegisterAllowed(0x920);
SetRegisterAllowed(0x924);
SetRegisterAllowed(0x928);
SetRegisterAllowed(0x92C);
SetRegisterAllowed(0x930);
SetRegisterAllowed(0x934);
SetRegisterAllowed(0x938);
SetRegisterAllowed(0x93C);
SetRegisterAllowed(0x940);
SetRegisterAllowed(0x944);
SetRegisterAllowed(0x948);
SetRegisterAllowed(0x94C);
SetRegisterAllowed(0x950);
SetRegisterAllowed(0x954);
SetRegisterAllowed(0x958);
SetRegisterAllowed(0x95C);
SetRegisterAllowed(0x960);
SetRegisterAllowed(0x964);
SetRegisterAllowed(0x968);
SetRegisterAllowed(0x96C);
SetRegisterAllowed(0x970);
SetRegisterAllowed(0x974);
SetRegisterAllowed(0x978);
SetRegisterAllowed(0x97C);
SetRegisterAllowed(0x980);
SetRegisterAllowed(0x984);
SetRegisterAllowed(0x988);
SetRegisterAllowed(0x98C);
SetRegisterAllowed(0x990);
SetRegisterAllowed(0x994);
SetRegisterAllowed(0x998);
SetRegisterAllowed(0x99C);
SetRegisterAllowed(0x9A0);
SetRegisterAllowed(0x9A4);
SetRegisterAllowed(0x9A8);
SetRegisterAllowed(0x9AC);
SetRegisterAllowed(0x9B0);
SetRegisterAllowed(0x9B4);
SetRegisterAllowed(0x9B8);
SetRegisterAllowed(0x9BC);
SetRegisterAllowed(0x9C0);
SetRegisterAllowed(0x9C4);
SetRegisterAllowed(0x9C8);
SetRegisterAllowed(0x9CC);
SetRegisterAllowed(0x9D0);
SetRegisterAllowed(0x9D4);
SetRegisterAllowed(0x9D8);
SetRegisterAllowed(0x9DC);
SetRegisterAllowed(0x9E0);
SetRegisterAllowed(0x9E4);
SetRegisterAllowed(0x9E8);
SetRegisterAllowed(0x9EC);
SetRegisterAllowed(0x9F0);
SetRegisterAllowed(0x9F4);
SetRegisterAllowed(0x9F8);
SetRegisterAllowed(0x9FC);
SetRegisterAllowed(0xA00);
SetRegisterAllowed(0xA04);
SetRegisterAllowed(0xA08);
SetRegisterAllowed(0xA0C);
SetRegisterAllowed(0xA10);
SetRegisterAllowed(0xA14);
SetRegisterAllowed(0xA18);
SetRegisterAllowed(0xA1C);
SetRegisterAllowed(0xA20);
SetRegisterAllowed(0xA24);
SetRegisterAllowed(0xA28);
SetRegisterAllowed(0xA2C);
SetRegisterAllowed(0xA30);
SetRegisterAllowed(0xA34);
SetRegisterAllowed(0xA38);
SetRegisterAllowed(0xA3C);
SetRegisterAllowed(0xA40);
SetRegisterAllowed(0xA44);
SetRegisterAllowed(0xA48);
SetRegisterAllowed(0xA4C);
SetRegisterAllowed(0xA50);
SetRegisterAllowed(0xA54);
SetRegisterAllowed(0xA58);
SetRegisterAllowed(0xA5C);
SetRegisterAllowed(0xA60);
SetRegisterAllowed(0xA64);
SetRegisterAllowed(0xA68);
SetRegisterAllowed(0xA6C);
SetRegisterAllowed(0xA70);
SetRegisterAllowed(0xA74);
SetRegisterAllowed(0xA78);
SetRegisterAllowed(0xA7C);
SetRegisterAllowed(0xA80);
SetRegisterAllowed(0xA84);
SetRegisterAllowed(0xA88);
SetRegisterAllowed(0xA8C);
SetRegisterAllowed(0xA90);
SetRegisterAllowed(0xA94);
SetRegisterAllowed(0xA98);
SetRegisterAllowed(0xA9C);
SetRegisterAllowed(0xAA0);
SetRegisterAllowed(0xAA4);
SetRegisterAllowed(0xAA8);
SetRegisterAllowed(0xAAC);
SetRegisterAllowed(0xAB0);
SetRegisterAllowed(0xAB4);
SetRegisterAllowed(0xAB8);
SetRegisterAllowed(0xABC);
SetRegisterAllowed(0xAC0);
SetRegisterAllowed(0xAC4);
SetRegisterAllowed(0xAC8);
SetRegisterAllowed(0xACC);
SetRegisterAllowed(0xAD0);
SetRegisterAllowed(0xAD4);
SetRegisterAllowed(0xAD8);
SetRegisterAllowed(0xADC);
SetRegisterAllowed(0xAE0);
SetRegisterAllowed(0xAE4);
SetRegisterAllowed(0xAE8);
SetRegisterAllowed(0xAEC);
SetRegisterAllowed(0xAF0);
SetRegisterAllowed(0xAF4);
SetRegisterAllowed(0xAF8);
SetRegisterAllowed(0xAFC);
SetRegisterAllowed(0xB00);
SetRegisterAllowed(0xB04);
SetRegisterAllowed(0xB08);
SetRegisterAllowed(0xB0C);
SetRegisterAllowed(0xB10);
SetRegisterAllowed(0xB14);
SetRegisterAllowed(0xB18);
SetRegisterAllowed(0xB1C);
SetRegisterAllowed(0xB20);
SetRegisterAllowed(0xB24);
SetRegisterAllowed(0xB28);
SetRegisterAllowed(0xB2C);
SetRegisterAllowed(0xB30);
SetRegisterAllowed(0xB34);
SetRegisterAllowed(0xB38);
SetRegisterAllowed(0xB3C);
SetRegisterAllowed(0xB40);
SetRegisterAllowed(0xB44);
SetRegisterAllowed(0xB48);
SetRegisterAllowed(0xB4C);
SetRegisterAllowed(0xB50);
SetRegisterAllowed(0xB54);
SetRegisterAllowed(0xB58);
SetRegisterAllowed(0xB5C);
SetRegisterAllowed(0xB60);
SetRegisterAllowed(0xB64);
SetRegisterAllowed(0xB68);
SetRegisterAllowed(0xB6C);
SetRegisterAllowed(0xB70);
SetRegisterAllowed(0xB74);
SetRegisterAllowed(0xB78);
SetRegisterAllowed(0xB7C);
SetRegisterAllowed(0xB80);
SetRegisterAllowed(0xB84);
SetRegisterAllowed(0xB88);
SetRegisterAllowed(0xB8C);
SetRegisterAllowed(0xB90);
SetRegisterAllowed(0xB94);
SetRegisterAllowed(0xB98);
SetRegisterAllowed(0xB9C);
SetRegisterAllowed(0xBA0);
SetRegisterAllowed(0xBA4);
SetRegisterAllowed(0xBA8);
SetRegisterAllowed(0xBAC);
SetRegisterAllowed(0xBB0);
SetRegisterAllowed(0xBB4);
SetRegisterAllowed(0xBB8);
SetRegisterAllowed(0xBBC);
SetRegisterAllowed(0xBC0);
SetRegisterAllowed(0xBC4);
SetRegisterAllowed(0xBC8);
SetRegisterAllowed(0xBCC);
SetRegisterAllowed(0xBD0);
SetRegisterAllowed(0xBD4);
SetRegisterAllowed(0xBD8);
SetRegisterAllowed(0xBDC);
SetRegisterAllowed(0xBE0);
SetRegisterAllowed(0xBE4);
SetRegisterAllowed(0xBE8);
SetRegisterAllowed(0xBEC);
SetRegisterAllowed(0xBF0);
SetRegisterAllowed(0xBF4);
SetRegisterAllowed(0xBF8);
SetRegisterAllowed(0xBFC);
SetRegisterAllowed(0xC00);
SetRegisterAllowed(0xC04);
SetRegisterAllowed(0xC08);
SetRegisterAllowed(0xC0C);
SetRegisterAllowed(0xC10);
SetRegisterAllowed(0xC14);
SetRegisterAllowed(0xC18);
SetRegisterAllowed(0xC1C);
SetRegisterAllowed(0xC20);
SetRegisterAllowed(0xC24);
SetRegisterAllowed(0xC28);
SetRegisterAllowed(0xC2C);
SetRegisterAllowed(0xC30);
SetRegisterAllowed(0xC34);
SetRegisterAllowed(0xC38);
SetRegisterAllowed(0xC3C);
SetRegisterAllowed(0xC40);
SetRegisterAllowed(0xC44);
SetRegisterAllowed(0xC48);
SetRegisterAllowed(0xC4C);
SetRegisterAllowed(0xC50);
SetRegisterAllowed(0xC54);
SetRegisterAllowed(0xC58);
SetRegisterAllowed(0xC5C);
SetRegisterAllowed(0xC60);
SetRegisterAllowed(0xC64);
SetRegisterAllowed(0xC68);
SetRegisterAllowed(0xC6C);
SetRegisterAllowed(0xC70);
SetRegisterAllowed(0xC74);
SetRegisterAllowed(0xC78);
SetRegisterAllowed(0xC7C);
SetRegisterAllowed(0xC80);
SetRegisterAllowed(0xC84);
SetRegisterAllowed(0xC88);
SetRegisterAllowed(0xC8C);
SetRegisterAllowed(0xC90);
SetRegisterAllowed(0xC94);
SetRegisterAllowed(0xC98);
SetRegisterAllowed(0xC9C);
SetRegisterAllowed(0xCA0);
SetRegisterAllowed(0xCA4);
SetRegisterAllowed(0xCA8);
SetRegisterAllowed(0xCAC);
SetRegisterAllowed(0xCB0);
SetRegisterAllowed(0xCB4);
SetRegisterAllowed(0xCB8);
SetRegisterAllowed(0xCBC);
SetRegisterAllowed(0xCC0);
SetRegisterAllowed(0xCC4);
SetRegisterAllowed(0xCC8);
SetRegisterAllowed(0xCCC);
SetRegisterAllowed(0xCD0);
SetRegisterAllowed(0xCD4);
SetRegisterAllowed(0xCD8);
SetRegisterAllowed(0xCDC);
SetRegisterAllowed(0xCE0);
SetRegisterAllowed(0xCE4);
SetRegisterAllowed(0xCE8);
SetRegisterAllowed(0xCEC);
SetRegisterAllowed(0xCF0);
SetRegisterAllowed(0xCF4);
SetRegisterAllowed(0xCF8);
SetRegisterAllowed(0xCFC);
SetRegisterAllowed(0xD00);
SetRegisterAllowed(0xD04);
SetRegisterAllowed(0xD08);
SetRegisterAllowed(0xD0C);
SetRegisterAllowed(0xD10);
SetRegisterAllowed(0xD14);
SetRegisterAllowed(0xD18);
SetRegisterAllowed(0xD1C);
SetRegisterAllowed(0xD20);
SetRegisterAllowed(0xD24);
SetRegisterAllowed(0xD28);
SetRegisterAllowed(0xD2C);
SetRegisterAllowed(0xD30);
SetRegisterAllowed(0xD34);
SetRegisterAllowed(0xD38);
SetRegisterAllowed(0xD3C);
SetRegisterAllowed(0xD40);
SetRegisterAllowed(0xD44);
SetRegisterAllowed(0xD48);
SetRegisterAllowed(0xD4C);
SetRegisterAllowed(0xD50);
SetRegisterAllowed(0xD54);
SetRegisterAllowed(0xD58);
SetRegisterAllowed(0xD5C);
SetRegisterAllowed(0xD60);
SetRegisterAllowed(0xD64);
SetRegisterAllowed(0xD68);
SetRegisterAllowed(0xD6C);
SetRegisterAllowed(0xD70);
SetRegisterAllowed(0xD74);
SetRegisterAllowed(0xD78);
SetRegisterAllowed(0xD7C);
SetRegisterAllowed(0xD80);
SetRegisterAllowed(0xD84);
SetRegisterAllowed(0xD88);
SetRegisterAllowed(0xD8C);
SetRegisterAllowed(0xD90);
SetRegisterAllowed(0xD94);
SetRegisterAllowed(0xD98);
SetRegisterAllowed(0xD9C);
SetRegisterAllowed(0xDA0);
SetRegisterAllowed(0xDA4);
SetRegisterAllowed(0xDA8);
SetRegisterAllowed(0xDAC);
SetRegisterAllowed(0xDB0);
SetRegisterAllowed(0xDB4);
SetRegisterAllowed(0xDB8);
SetRegisterAllowed(0xDBC);
SetRegisterAllowed(0xDC0);
SetRegisterAllowed(0xDC4);
SetRegisterAllowed(0xDC8);
SetRegisterAllowed(0xDCC);
SetRegisterAllowed(0xDD0);
SetRegisterAllowed(0xDD4);
SetRegisterAllowed(0xDD8);
SetRegisterAllowed(0xDDC);
SetRegisterAllowed(0xDE0);
SetRegisterAllowed(0xDE4);
SetRegisterAllowed(0xDE8);
SetRegisterAllowed(0xDEC);
SetRegisterAllowed(0xDF0);
SetRegisterAllowed(0xDF4);
SetRegisterAllowed(0xDF8);
SetRegisterAllowed(0xDFC);
SetRegisterAllowed(0xE00);
SetRegisterAllowed(0xE04);
SetRegisterAllowed(0xE08);
SetRegisterAllowed(0xE0C);
SetRegisterAllowed(0xE10);
SetRegisterAllowed(0xE14);
SetRegisterAllowed(0xE18);
SetRegisterAllowed(0xE1C);
SetRegisterAllowed(0xE20);
SetRegisterAllowed(0xE24);
SetRegisterAllowed(0xE28);
SetRegisterAllowed(0xE2C);
SetRegisterAllowed(0xE30);
SetRegisterAllowed(0xE34);
SetRegisterAllowed(0xE38);
SetRegisterAllowed(0xE3C);
SetRegisterAllowed(0xE40);
SetRegisterAllowed(0xE44);
SetRegisterAllowed(0xE48);
SetRegisterAllowed(0xE4C);
SetRegisterAllowed(0xE50);
SetRegisterAllowed(0xE54);
SetRegisterAllowed(0xE58);
SetRegisterAllowed(0xE5C);
SetRegisterAllowed(0xE60);
SetRegisterAllowed(0xE64);
SetRegisterAllowed(0xE68);
SetRegisterAllowed(0xE6C);
SetRegisterAllowed(0xE70);
SetRegisterAllowed(0xE74);
SetRegisterAllowed(0xE78);
SetRegisterAllowed(0xE7C);
SetRegisterAllowed(0xE80);
SetRegisterAllowed(0xE84);
SetRegisterAllowed(0xE88);
SetRegisterAllowed(0xE8C);
SetRegisterAllowed(0xE90);
SetRegisterAllowed(0xE94);
SetRegisterAllowed(0xE98);
SetRegisterAllowed(0xE9C);
SetRegisterAllowed(0xEA0);
SetRegisterAllowed(0xEA4);
SetRegisterAllowed(0xEA8);
SetRegisterAllowed(0xEAC);
SetRegisterAllowed(0xEB0);
SetRegisterAllowed(0xEB4);
SetRegisterAllowed(0xEB8);
SetRegisterAllowed(0xEBC);
SetRegisterAllowed(0xEC0);
SetRegisterAllowed(0xEC4);
SetRegisterAllowed(0xEC8);
SetRegisterAllowed(0xECC);
SetRegisterAllowed(0xED0);
SetRegisterAllowed(0xED4);
SetRegisterAllowed(0xED8);

View File

@@ -0,0 +1,349 @@
/*
* Copyright (c) Atmosphère-NX
*
* 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/>.
*/
#pragma once
#include <vapours.hpp>
#include <exosphere/mmu.hpp>
namespace ams::secmon {
using Address = u64;
struct MemoryRegion {
private:
Address m_start_address;
Address m_end_address;
public:
consteval MemoryRegion(Address address, size_t size) : m_start_address(address), m_end_address(address + size) {
if (m_end_address < m_start_address) {
__builtin_unreachable();
}
}
constexpr Address GetStartAddress() const {
return m_start_address;
}
constexpr Address GetAddress() const {
return this->GetStartAddress();
}
constexpr Address GetEndAddress() const {
return m_end_address;
}
constexpr Address GetLastAddress() const {
return m_end_address - 1;
}
constexpr size_t GetSize() const {
return m_end_address - m_start_address;
}
constexpr bool Contains(Address address, size_t size) const {
return m_start_address <= address && (address + size - 1) <= this->GetLastAddress();
}
constexpr bool Contains(const MemoryRegion &rhs) const {
return this->Contains(rhs.GetStartAddress(), rhs.GetSize());
}
template<typename T = void> requires (std::is_same<T, void>::value || util::is_pod<T>::value)
ALWAYS_INLINE T *GetPointer() const {
return reinterpret_cast<T *>(this->GetAddress());
}
template<typename T = void> requires (std::is_same<T, void>::value || util::is_pod<T>::value)
ALWAYS_INLINE T *GetEndPointer() const {
return reinterpret_cast<T *>(this->GetEndAddress());
}
};
constexpr inline const MemoryRegion MemoryRegionVirtual = MemoryRegion(UINT64_C(0x1F0000000), 2_MB);
constexpr inline const MemoryRegion MemoryRegionPhysical = MemoryRegion(UINT64_C( 0x40000000), 1_GB);
constexpr inline const MemoryRegion MemoryRegionDram = MemoryRegion(UINT64_C( 0x80000000), 2_GB);
constexpr inline const MemoryRegion MemoryRegionDramHigh = MemoryRegion(MemoryRegionDram.GetEndAddress(), 2_GB);
constexpr inline const MemoryRegion MemoryRegionDramForMarikoProgram = MemoryRegion(UINT64_C(0xC0000000), 1_GB);
constexpr inline const MemoryRegion MemoryRegionDramDcFramebuffer = MemoryRegion(UINT64_C(0xC0000000), 4_MB);
static_assert(MemoryRegionDram.Contains(MemoryRegionDramForMarikoProgram));
static_assert(MemoryRegionDramForMarikoProgram.Contains(MemoryRegionDramDcFramebuffer));
constexpr inline const MemoryRegion MemoryRegionDramGpuCarveout = MemoryRegion(UINT64_C(0x80020000), UINT64_C(0x40000));
static_assert(MemoryRegionDram.Contains(MemoryRegionDramGpuCarveout));
constexpr inline const MemoryRegion MemoryRegionDramDefaultKernelCarveout = MemoryRegion(UINT64_C(0x80060000), UINT64_C(0x1FFE0000));
static_assert(MemoryRegionDram.Contains(MemoryRegionDramDefaultKernelCarveout));
constexpr inline const MemoryRegion MemoryRegionDramPackage2Payloads = MemoryRegion(MemoryRegionDram.GetAddress(), 8_MB);
static_assert(MemoryRegionDram.Contains(MemoryRegionDramPackage2Payloads));
constexpr inline const MemoryRegion MemoryRegionDramPackage2 = MemoryRegion(UINT64_C(0xA9800000), UINT64_C(0x07FC0000));
static_assert(MemoryRegionDram.Contains(MemoryRegionDramPackage2));
constexpr inline const MemoryRegion MemoryRegionPhysicalIram = MemoryRegion(UINT64_C(0x40000000), 0x40000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzram = MemoryRegion(UINT64_C(0x7C010000), 0x10000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMariko = MemoryRegion(UINT64_C(0x7C010000), 0x40000);
static_assert(MemoryRegionPhysical.Contains(MemoryRegionPhysicalIram));
static_assert(MemoryRegionPhysical.Contains(MemoryRegionPhysicalTzram));
static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzram));
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramVolatile(UINT64_C(0x7C010000), 0x2000);
static_assert(MemoryRegionPhysicalTzram.Contains(MemoryRegionPhysicalTzramVolatile));
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramNonVolatile(UINT64_C(0x7C012000), 0xE000);
static_assert(MemoryRegionPhysicalTzram.Contains(MemoryRegionPhysicalTzramNonVolatile));
static_assert(MemoryRegionPhysicalTzram.GetSize() == MemoryRegionPhysicalTzramNonVolatile.GetSize() + MemoryRegionPhysicalTzramVolatile.GetSize());
constexpr inline const MemoryRegion MemoryRegionVirtualL1 = MemoryRegion(util::AlignDown(MemoryRegionVirtual.GetAddress(), mmu::L1EntrySize), mmu::L1EntrySize);
constexpr inline const MemoryRegion MemoryRegionPhysicalL1 = MemoryRegion(util::AlignDown(MemoryRegionPhysical.GetAddress(), mmu::L1EntrySize), mmu::L1EntrySize);
static_assert(MemoryRegionVirtualL1.Contains(MemoryRegionVirtual));
static_assert(MemoryRegionPhysicalL1.Contains(MemoryRegionPhysical));
constexpr inline const MemoryRegion MemoryRegionVirtualL2 = MemoryRegion(util::AlignDown(MemoryRegionVirtual.GetAddress(), mmu::L2EntrySize), mmu::L2EntrySize);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramL2 = MemoryRegion(util::AlignDown(MemoryRegionPhysicalIram.GetAddress(), mmu::L2EntrySize), mmu::L2EntrySize);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramL2 = MemoryRegion(util::AlignDown(MemoryRegionPhysicalTzram.GetAddress(), mmu::L2EntrySize), mmu::L2EntrySize);
static_assert(MemoryRegionVirtualL2.Contains(MemoryRegionVirtual));
static_assert(MemoryRegionPhysicalIramL2.Contains(MemoryRegionPhysicalIram));
static_assert(MemoryRegionPhysicalTzramL2.Contains(MemoryRegionPhysicalTzram));
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCode = MemoryRegion(UINT64_C(0x40020000), 0x20000);
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramBootCode));
constexpr inline const MemoryRegion MemoryRegionVirtualDevice = MemoryRegion(UINT64_C(0x1F0040000), UINT64_C(0x40000));
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDevice));
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceEmpty = MemoryRegion(MemoryRegionVirtualDevice.GetStartAddress(), 0);
#define AMS_SECMON_FOREACH_DEVICE_REGION(HANDLER, ...) \
HANDLER(GicDistributor, Empty, UINT64_C(0x50041000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(GicCpuInterface, GicDistributor, UINT64_C(0x50042000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
HANDLER(Uart, GicCpuInterface, UINT64_C(0x70006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
HANDLER(ClkRst, Uart, UINT64_C(0x60006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
HANDLER(RtcPmc, ClkRst, UINT64_C(0x7000E000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(Timer, RtcPmc, UINT64_C(0x60005000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(System, Timer, UINT64_C(0x6000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(SecurityEngine, System, UINT64_C(0x70012000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
HANDLER(SecurityEngine2, SecurityEngine, UINT64_C(0x70412000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
HANDLER(SysCtr0, SecurityEngine2, UINT64_C(0x700F0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(MemoryController, SysCtr0, UINT64_C(0x70019000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(ExternalMemoryController, MemoryController, UINT64_C(0x7001b000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(FuseKFuse, ExternalMemoryController, UINT64_C(0x7000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(ApbMisc, FuseKFuse, UINT64_C(0x70000000), UINT64_C(0x4000), true, ## __VA_ARGS__) \
HANDLER(FlowController, ApbMisc, UINT64_C(0x60007000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(BootloaderParams, FlowController, UINT64_C(0x40000000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(I2c5, BootloaderParams, UINT64_C(0x7000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(Gpio, I2c5, UINT64_C(0x6000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(I2c1, Gpio, UINT64_C(0x7000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(ExceptionVectors, I2c1, UINT64_C(0x6000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(MemoryController0, ExceptionVectors, UINT64_C(0x7001C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(MemoryController1, MemoryController0, UINT64_C(0x7001D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(Sdmmc, MemoryController1, UINT64_C(0x700B0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(Disp1, Sdmmc, UINT64_C(0x54200000), UINT64_C(0x3000), true, ## __VA_ARGS__) \
HANDLER(Dsi, Disp1, UINT64_C(0x54300000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(MipiCal, Dsi, UINT64_C(0x700E3000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(Soctherm, MipiCal, UINT64_C(0x700E2000), UINT64_C(0x1000), true, ## __VA_ARGS__)
#define DEFINE_DEVICE_REGION(_NAME_, _PREV_, _ADDRESS_, _SIZE_, _SECURE_) \
constexpr inline const MemoryRegion MemoryRegionVirtualDevice##_NAME_ = MemoryRegion(MemoryRegionVirtualDevice##_PREV_.GetEndAddress() + 0x1000, _SIZE_); \
constexpr inline const MemoryRegion MemoryRegionPhysicalDevice##_NAME_ = MemoryRegion(_ADDRESS_, _SIZE_); \
static_assert(MemoryRegionVirtualDevice.Contains(MemoryRegionVirtualDevice##_NAME_)); \
static_assert(MemoryRegionPhysical.Contains(MemoryRegionPhysicalDevice##_NAME_));
AMS_SECMON_FOREACH_DEVICE_REGION(DEFINE_DEVICE_REGION)
#undef DEFINE_DEVICE_REGION
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceFuses = MemoryRegion(MemoryRegionVirtualDeviceFuseKFuse.GetAddress() + 0x800, 0x400);
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceFuses = MemoryRegion(MemoryRegionPhysicalDeviceFuseKFuse.GetAddress() + 0x800, 0x400);
static_assert(MemoryRegionVirtualDeviceFuseKFuse.Contains(MemoryRegionVirtualDeviceFuses));
static_assert(MemoryRegionPhysicalDeviceFuseKFuse.Contains(MemoryRegionPhysicalDeviceFuses));
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceActivityMonitor = MemoryRegion(MemoryRegionVirtualDeviceSystem.GetAddress() + 0x800, 0x400);
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceActivityMonitor = MemoryRegion(MemoryRegionPhysicalDeviceSystem.GetAddress() + 0x800, 0x400);
static_assert(MemoryRegionVirtualDeviceSystem.Contains(MemoryRegionVirtualDeviceActivityMonitor));
static_assert(MemoryRegionPhysicalDeviceSystem.Contains(MemoryRegionPhysicalDeviceActivityMonitor));
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceUartA = MemoryRegion(MemoryRegionVirtualDeviceUart.GetAddress() + 0x000, 0x040);
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceUartB = MemoryRegion(MemoryRegionVirtualDeviceUart.GetAddress() + 0x040, 0x040);
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceUartC = MemoryRegion(MemoryRegionVirtualDeviceUart.GetAddress() + 0x200, 0x100);
static_assert(MemoryRegionVirtualDeviceUart.Contains(MemoryRegionVirtualDeviceUartA));
static_assert(MemoryRegionVirtualDeviceUart.Contains(MemoryRegionVirtualDeviceUartB));
static_assert(MemoryRegionVirtualDeviceUart.Contains(MemoryRegionVirtualDeviceUartC));
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceUartA = MemoryRegion(MemoryRegionPhysicalDeviceUart.GetAddress() + 0x000, 0x040);
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceUartB = MemoryRegion(MemoryRegionPhysicalDeviceUart.GetAddress() + 0x040, 0x040);
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceUartC = MemoryRegion(MemoryRegionPhysicalDeviceUart.GetAddress() + 0x200, 0x100);
static_assert(MemoryRegionPhysicalDeviceUart.Contains(MemoryRegionPhysicalDeviceUartA));
static_assert(MemoryRegionPhysicalDeviceUart.Contains(MemoryRegionPhysicalDeviceUartB));
static_assert(MemoryRegionPhysicalDeviceUart.Contains(MemoryRegionPhysicalDeviceUartC));
constexpr inline const MemoryRegion MemoryRegionVirtualDevicePmc = MemoryRegion(MemoryRegionVirtualDeviceRtcPmc.GetAddress() + 0x400, 0xC00);
constexpr inline const MemoryRegion MemoryRegionPhysicalDevicePmc = MemoryRegion(MemoryRegionPhysicalDeviceRtcPmc.GetAddress() + 0x400, 0xC00);
static_assert(MemoryRegionVirtualDeviceRtcPmc.Contains(MemoryRegionVirtualDevicePmc));
static_assert(MemoryRegionPhysicalDeviceRtcPmc.Contains(MemoryRegionPhysicalDevicePmc));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramReadOnlyAlias = MemoryRegion(UINT64_C(0x1F00A0000), MemoryRegionPhysicalTzram.GetSize());
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramReadOnlyAlias = MemoryRegion(MemoryRegionPhysicalTzram.GetAddress(), MemoryRegionPhysicalTzram.GetSize());
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramReadOnlyAlias));
static_assert(MemoryRegionPhysicalTzram.Contains(MemoryRegionPhysicalTzramReadOnlyAlias));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramProgram(UINT64_C(0x1F00C0000), 0xC000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramProgram));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramProgramExceptionVectors(UINT64_C(0x1F00C0000), 0x800);
static_assert(MemoryRegionVirtualTzramProgram.Contains(MemoryRegionVirtualTzramProgramExceptionVectors));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramMarikoProgram(UINT64_C(0x1F00D0000), 0x20000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMarikoProgram(UINT64_C(0x7C020000), 0x20000);
static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzramMarikoProgram));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramMarikoProgramFatalErrorContext(UINT64_C(0x1F00EF000), 0x1000);
static_assert(MemoryRegionVirtualTzramMarikoProgram.Contains(MemoryRegionVirtualTzramMarikoProgramFatalErrorContext));
constexpr inline const MemoryRegion MemoryRegionPhysicalIramFatalErrorContext(UINT64_C(0x4003E000), 0x1000);
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramFatalErrorContext));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramMarikoProgramStack(UINT64_C(0x1F00F4000), 0x8000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMarikoProgramStack(UINT64_C(0x7C040000), 0x8000);
static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzramMarikoProgramStack));
constexpr inline const MemoryRegion MemoryRegionPhysicalMarikoProgramImage(UINT64_C(0x80020000), 0x20000);
static_assert(MemoryRegionDram.Contains(MemoryRegionPhysicalMarikoProgramImage));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramProgramMain(UINT64_C(0x1F00C0800), 0xB800);
static_assert(MemoryRegionVirtualTzramProgram.Contains(MemoryRegionVirtualTzramProgramMain));
static_assert(MemoryRegionVirtualTzramProgram.GetSize() == MemoryRegionVirtualTzramProgramExceptionVectors.GetSize() + MemoryRegionVirtualTzramProgramMain.GetSize());
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramProgram(UINT64_C(0x7C012000), 0xC000);
static_assert(MemoryRegionPhysicalTzramNonVolatile.Contains(MemoryRegionPhysicalTzramProgram));
constexpr inline const Address PhysicalTzramProgramResetVector = MemoryRegionPhysicalTzramProgram.GetAddress() + MemoryRegionVirtualTzramProgramExceptionVectors.GetSize();
static_assert(static_cast<u32>(PhysicalTzramProgramResetVector) == PhysicalTzramProgramResetVector);
constexpr uintptr_t GetPhysicalTzramProgramAddress(uintptr_t virtual_address) {
return virtual_address - MemoryRegionVirtualTzramProgram.GetStartAddress() + MemoryRegionPhysicalTzramNonVolatile.GetStartAddress();
}
constexpr inline const MemoryRegion MemoryRegionVirtualIramSc7Work = MemoryRegion(UINT64_C(0x1F0120000), MemoryRegionPhysicalTzram.GetSize());
constexpr inline const MemoryRegion MemoryRegionPhysicalIramSc7Work = MemoryRegion( UINT64_C(0x40020000), MemoryRegionPhysicalTzram.GetSize());
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualIramSc7Work));
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramSc7Work));
constexpr inline const MemoryRegion MemoryRegionVirtualIramSc7Firmware = MemoryRegion(UINT64_C(0x1F0140000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramSc7Firmware = MemoryRegion( UINT64_C(0x40003000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualIramSc7Firmware));
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramSc7Firmware));
constexpr inline const MemoryRegion MemoryRegionPhysicalIramSecureMonitorDebug(UINT64_C(0x40034000), 0x4000);
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramSecureMonitorDebug));
constexpr inline const MemoryRegion MemoryRegionVirtualDebugCode = MemoryRegion(UINT64_C(0x1F0150000), 0x4000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDebugCode = MemoryRegion(UINT64_C(0x40034000), 0x4000);
static_assert(MemoryRegionPhysicalIramSecureMonitorDebug.Contains(MemoryRegionPhysicalDebugCode));
constexpr inline const MemoryRegion MemoryRegionVirtualDebug = MemoryRegion(UINT64_C(0x1F0160000), 0x10000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDebug));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramBootCode = MemoryRegion(UINT64_C(0x1F01C0000), 0x2000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramBootCode = MemoryRegion( UINT64_C(0x7C010000), 0x2000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramBootCode));
static_assert(MemoryRegionPhysicalTzramVolatile.Contains(MemoryRegionPhysicalTzramBootCode));
constexpr inline const MemoryRegion MemoryRegionPhysicalDramMonitorConfiguration = MemoryRegion( UINT64_C(0x8000F000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStore = MemoryRegion(UINT64_C(0x1F0100000), 0x10000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStore = MemoryRegion( UINT64_C(0x80010000), 0x10000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDramSecureDataStore));
static_assert(MemoryRegionDram.Contains(MemoryRegionPhysicalDramSecureDataStore));
constexpr inline const MemoryRegion MemoryRegionVirtualDramDebugDataStore = MemoryRegion(UINT64_C(0x1F0110000), 0x4000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramDebugDataStore = MemoryRegion( UINT64_C(0x8000C000), 0x4000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDramSecureDataStore));
static_assert(MemoryRegionDram.Contains(MemoryRegionPhysicalDramSecureDataStore));
constexpr inline const MemoryRegion MemoryRegionVirtualDramSdmmcMappedData = MemoryRegion(UINT64_C(0x1F0100000), 0xC000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSdmmcMappedData = MemoryRegion(UINT64_C(0x80010000), 0xC000);
constexpr inline const MemoryRegion MemoryRegionVirtualDramDcL0DevicePageTable = MemoryRegion(UINT64_C(0x1F010C000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramDcL0DevicePageTable = MemoryRegion( UINT64_C(0x8001C000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionVirtualDramSdmmc1L0DevicePageTable = MemoryRegion(UINT64_C(0x1F010E000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSdmmc1L0DevicePageTable = MemoryRegion( UINT64_C(0x8001E000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionVirtualDramSdmmc1L1DevicePageTable = MemoryRegion(UINT64_C(0x1F010F000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSdmmc1L1DevicePageTable = MemoryRegion( UINT64_C(0x8001F000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStoreTzram = MemoryRegion(UINT64_C(0x1F0100000), 0xE000);
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStoreWarmbootFirmware = MemoryRegion(UINT64_C(0x1F010E000), 0x17C0);
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStoreSecurityEngineState = MemoryRegion(UINT64_C(0x1F010F7C0), 0x0840);
static_assert(MemoryRegionVirtualDramSecureDataStore.Contains(MemoryRegionVirtualDramSecureDataStoreTzram));
static_assert(MemoryRegionVirtualDramSecureDataStore.Contains(MemoryRegionVirtualDramSecureDataStoreWarmbootFirmware));
static_assert(MemoryRegionVirtualDramSecureDataStore.Contains(MemoryRegionVirtualDramSecureDataStoreSecurityEngineState));
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStoreTzram = MemoryRegion(UINT64_C(0x80010000), 0xE000);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStoreWarmbootFirmware = MemoryRegion(UINT64_C(0x8001E000), 0x17C0);
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStoreSecurityEngineState = MemoryRegion(UINT64_C(0x8001F7C0), 0x0840);
static_assert(MemoryRegionPhysicalDramSecureDataStore.Contains(MemoryRegionPhysicalDramSecureDataStoreTzram));
static_assert(MemoryRegionPhysicalDramSecureDataStore.Contains(MemoryRegionPhysicalDramSecureDataStoreWarmbootFirmware));
static_assert(MemoryRegionPhysicalDramSecureDataStore.Contains(MemoryRegionPhysicalDramSecureDataStoreSecurityEngineState));
constexpr inline const MemoryRegion MemoryRegionVirtualAtmosphereIramPage = MemoryRegion(UINT64_C(0x1F01F0000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualAtmosphereIramPage));
constexpr inline const MemoryRegion MemoryRegionVirtualAtmosphereUserPage = MemoryRegion(UINT64_C(0x1F01F2000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualAtmosphereUserPage));
constexpr inline const MemoryRegion MemoryRegionVirtualSmcUserPage = MemoryRegion(UINT64_C(0x1F01F4000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualSmcUserPage));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramVolatileData = MemoryRegion(UINT64_C(0x1F01F6000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramVolatileData = MemoryRegion( UINT64_C(0x7C010000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramVolatileData));
static_assert(MemoryRegionPhysicalTzramVolatile.Contains(MemoryRegionPhysicalTzramVolatileData));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramVolatileStack = MemoryRegion(UINT64_C(0x1F01F8000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramVolatileStack = MemoryRegion( UINT64_C(0x7C011000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramVolatileStack));
static_assert(MemoryRegionPhysicalTzramVolatile.Contains(MemoryRegionPhysicalTzramVolatileStack));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramConfigurationData = MemoryRegion(UINT64_C(0x1F01FA000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramConfigurationData = MemoryRegion( UINT64_C(0x7C01E000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramConfigurationData));
static_assert(MemoryRegionPhysicalTzramNonVolatile.Contains(MemoryRegionPhysicalTzramConfigurationData));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramL1PageTable = MemoryRegion(UINT64_C(0x1F01FCFC0), 0x40);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramL1PageTable = MemoryRegion( UINT64_C(0x7C01EFC0), 0x40);
static_assert(MemoryRegionPhysicalTzramConfigurationData.Contains(MemoryRegionPhysicalTzramL1PageTable));
constexpr inline const MemoryRegion MemoryRegionVirtualTzramL2L3PageTable = MemoryRegion(UINT64_C(0x1F01FE000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramL2L3PageTable = MemoryRegion( UINT64_C(0x7C01F000), 0x1000);
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramL2L3PageTable));
static_assert(MemoryRegionPhysicalTzramNonVolatile.Contains(MemoryRegionPhysicalTzramL2L3PageTable));
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramFullProgramImage = MemoryRegion(UINT64_C(0x7C010800), 0xD800);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCodeImage = MemoryRegion(UINT64_C(0x40032000), 0xC000);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCodeCode = MemoryRegion(UINT64_C(0x40032000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCodeKeys = MemoryRegion(UINT64_C(0x40033000), 0x1000);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramWarmbootBin = MemoryRegion(UINT64_C(0x4003E000), 0x17F0);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootConfig = MemoryRegion(UINT64_C(0x4003F800), 0x400);
constexpr inline const MemoryRegion MemoryRegionPhysicalIramRebootStub = MemoryRegion(UINT64_C(0x4003F000), 0x1000);
}

View File

@@ -0,0 +1,198 @@
/*
* Copyright (c) Atmosphère-NX
*
* 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/>.
*/
#include <exosphere.hpp>
#include "../secmon_error.hpp"
#include "secmon_smc_register_access.hpp"
namespace ams::secmon::smc {
namespace {
template<size_t N>
constexpr void SetRegisterTableAllowed(std::array<u8, N> &arr, uintptr_t reg) {
/* All registers should be four byte aligned. */
AMS_ASSUME(reg % sizeof(u32) == 0);
/* Reduce the register to an index. */
reg /= sizeof(u32);
/* Get the index and mask. */
const auto index = reg / BITSIZEOF(u8);
const auto mask = (1u << (reg % BITSIZEOF(u8)));
/* Check that the permission bit isn't already set. */
AMS_ASSUME((arr[index] & mask) == 0);
/* Set the permission bit. */
arr[index] |= mask;
/* Ensure that indices are set in sorted order. */
for (auto i = (reg % BITSIZEOF(u8)) + 1; i < 8; ++i) {
AMS_ASSUME((arr[index] & (1u << i)) == 0);
}
for (auto i = index + 1; i < arr.size(); ++i) {
AMS_ASSUME(arr[i] == 0);
}
}
template<size_t N>
consteval std::pair<size_t, size_t> GetReducedAccessTableInfo(const std::array<u8, N> &arr) {
for (int last = arr.size() - 1; last >= 0; --last) {
if (arr[last] != 0) {
const int end = last + 1;
for (int start = 0; start < end; ++start) {
if (arr[start] != 0) {
return std::make_pair(static_cast<size_t>(start), static_cast<size_t>(end));
}
}
return std::make_pair(static_cast<size_t>(0), static_cast<size_t>(end));
}
}
/* All empty perm table is disallowed. */
AMS_ASSUME(false);
}
template<u32 _Address, auto RawTable>
struct AccessTable {
static constexpr inline auto ReducedAccessTableInfo = GetReducedAccessTableInfo(RawTable);
static constexpr inline size_t ReducedAccessTableSize = ReducedAccessTableInfo.second - ReducedAccessTableInfo.first;
static constexpr inline auto ReducedAccessTable = []() -> std::array<u8, ReducedAccessTableSize> {
std::array<u8, ReducedAccessTableSize> reduced = {};
for (size_t i = ReducedAccessTableInfo.first; i < ReducedAccessTableInfo.second; ++i) {
reduced[i - ReducedAccessTableInfo.first] = RawTable[i];
}
return reduced;
}();
static constexpr u32 Address = _Address + (ReducedAccessTableInfo.first * sizeof(u32) * BITSIZEOF(u8));
static constexpr u32 Size = static_cast<u32>(ReducedAccessTableSize * sizeof(u32) * BITSIZEOF(u8));
static_assert(Size <= 0x1000);
};
struct AccessTableEntry {
const u8 * const table;
uintptr_t virtual_address;
u32 address;
u32 size;
};
/* Include the access tables. */
#include "secmon_define_pmc_access_table.inc"
#include "secmon_define_mc_access_table.inc"
#include "secmon_define_emc_access_table.inc"
#include "secmon_define_soctherm_access_table.inc"
#include "secmon_define_mc01_access_table.inc"
constexpr const AccessTableEntry AccessTables[] = {
{ PmcAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDevicePmc.GetAddress(), PmcAccessTable::Address, PmcAccessTable::Size, },
{ McAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceMemoryController.GetAddress(), McAccessTable::Address, McAccessTable::Size, },
{ EmcAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceExternalMemoryController.GetAddress(), EmcAccessTable::Address, EmcAccessTable::Size, },
{ SocthermAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceSoctherm.GetAddress(), SocthermAccessTable::Address, SocthermAccessTable::Size, },
{ Mc01AccessTable::ReducedAccessTable.data(), Mc01AccessTable::Address + MemoryRegionVirtualDeviceMemoryController0.GetAddress(), Mc01AccessTable::Address + MemoryRegionPhysicalDeviceMemoryController0.GetAddress(), Mc01AccessTable::Size, },
{ Mc01AccessTable::ReducedAccessTable.data(), Mc01AccessTable::Address + MemoryRegionVirtualDeviceMemoryController1.GetAddress(), Mc01AccessTable::Address + MemoryRegionPhysicalDeviceMemoryController1.GetAddress(), Mc01AccessTable::Size, },
};
constexpr bool IsAccessAllowed(const AccessTableEntry &entry, uintptr_t address) {
/* Check if the address is within range. */
if (!(entry.address <= address && address < entry.address + entry.size)) {
return false;
}
/* Get the offset. */
const auto offset = address - entry.address;
/* Convert it to an index. */
const auto reg_index = offset / sizeof(u32);
/* Get the bit fields. */
const auto index = reg_index / BITSIZEOF(u8);
const auto mask = (1u << (reg_index % BITSIZEOF(u8)));
/* Validate that we're not going out of bounds. */
if (index >= entry.size / sizeof(u32)) {
return false;
}
return (entry.table[index] & mask) != 0;
}
constexpr const AccessTableEntry *GetAccessTableEntry(uintptr_t address) {
for (const auto &entry : AccessTables) {
if (IsAccessAllowed(entry, address)) {
return std::addressof(entry);
}
}
return nullptr;
}
}
SmcResult SmcReadWriteRegister(SmcArguments &args) {
/* Get the arguments. */
const uintptr_t address = args.r[1];
const u32 mask = args.r[2];
const u32 value = args.r[3];
/* Validate that the address is aligned. */
SMC_R_UNLESS(util::IsAligned(address, alignof(u32)), InvalidArgument);
/* Find the access table. */
const AccessTableEntry * const entry = GetAccessTableEntry(address);
/* Translate our entry into an address to access. */
uintptr_t virtual_address = 0;
if (entry != nullptr) {
/* Get the address to read or write. */
virtual_address = entry->virtual_address + (address - entry->address);
} else {
/* For no clearly discernable reason, SmcReadWriteRegister returns success despite not doing the read/write */
/* when accessing the SMMU controls for the BPMP and for APB-DMA. */
/* This is "probably" to fuck with hackers who got access to the SMC and are trying to get control of the */
/* BPMP to exploit jamais vu, deja vu, or other related DMA/wake-from-sleep vulnerabilities. */
constexpr uintptr_t MC = MemoryRegionPhysicalDeviceMemoryController.GetAddress();
SMC_R_UNLESS((address == (MC + MC_SMMU_AVPC_ASID) || address == (MC + MC_SMMU_PPCS1_ASID)), InvalidArgument);
/* For backwards compatibility, we'll allow access to these devices on 1.0.0. */
if (GetTargetFirmware() < TargetFirmware_2_0_0) {
virtual_address = MemoryRegionVirtualDeviceMemoryController.GetAddress() + (address - MC);
}
}
/* Perform the read or write, if we should. */
if (virtual_address != 0) {
u32 out = 0;
if (mask != ~static_cast<u32>(0)) {
out = reg::Read(virtual_address);
}
if (mask != static_cast<u32>(0)) {
reg::Write(virtual_address, (out & ~mask) | (value & mask));
}
args.r[1] = out;
}
return SmcResult::Success;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,287 +0,0 @@
diff --git a/Overlay/Makefile b/Overlay/Makefile
index 9656834..3b2ebd5 100644
--- a/Overlay/Makefile
+++ b/Overlay/Makefile
@@ -38,7 +38,7 @@ include $(DEVKITPRO)/libnx/switch_rules
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
APP_TITLE := ReverseNX-RT
-APP_VERSION := 1.1.1
+APP_VERSION := 1.1.1-OC
TARGET := ReverseNX-RT-ovl
BUILD := build
diff --git a/Overlay/source/main.cpp b/Overlay/source/main.cpp
index 810295c..2b3aa52 100644
--- a/Overlay/source/main.cpp
+++ b/Overlay/source/main.cpp
@@ -1,7 +1,202 @@
#define TESLA_INIT_IMPL // If you have more than one file using the tesla header, only define this in the main one
#include <tesla.hpp> // The Tesla Header
+#include <atomic>
#include "SaltyNX.h"
+class ModeSync {
+public:
+ enum ReverseNXMode {
+ ReverseNX_NotValid = 0,
+ ReverseNX_SystemDefault = 0,
+ ReverseNX_Handheld,
+ ReverseNX_Docked,
+ ReverseNX_Undefined,
+ };
+
+ void SetMode(bool isDefault, bool setDock, char* descBuf, size_t bufSize) {
+ auto changeHandler = [this](ReverseNXMode newMode) {
+ if (this->currentMode == ReverseNX_Undefined || this->currentMode != newMode) {
+ if (R_FAILED(this->ipc->SetMode(newMode))) {
+ this->ipc->ipcStatus = Ipc::IpcStatus_ConnectFailed;
+ return;
+ }
+ this->currentMode = newMode;
+ }
+ };
+
+ tsl::hlp::ScopeGuard updateBufGuard([&] { this->ipc->UpdateStatusDesc(descBuf, bufSize); });
+
+ if (isDefault) {
+ changeHandler(ReverseNX_SystemDefault);
+ return;
+ }
+
+ changeHandler(setDock ? ReverseNX_Docked : ReverseNX_Handheld);
+ }
+
+ ModeSync() {
+ this->ipc = new Ipc;
+ this->ipc->Init();
+ }
+
+ ~ModeSync() {
+ this->ipc->Exit();
+ delete this->ipc;
+ }
+
+protected:
+ struct Ipc {
+ #define API_VER 2
+ #define SERVICE_NAME "sysclkOC"
+
+ enum SysClkIpcCmd {
+ SysClkIpcCmd_GetApiVersion = 0,
+ SysClkIpcCmd_GetConfigValues = 9,
+ SysClkIpcCmd_SetReverseNXRTMode = 11,
+ };
+
+ enum SysClkConfigValue {
+ SysClkConfigValue_SyncReverseNXMode = 4,
+ SysClkConfigValue_EnumMax = 8,
+ };
+
+ struct SysClkConfigValueList {
+ uint64_t values[SysClkConfigValue_EnumMax];
+ };
+
+ enum IpcStatus {
+ IpcStatus_OK,
+
+ IpcStatus_Unknown,
+ IpcStatus_NotRunning,
+ IpcStatus_InitFailed,
+ IpcStatus_ConnectFailed,
+ IpcStatus_UnsupportedVer,
+
+ IpcStatus_Count,
+ };
+
+ static constexpr const char* IpcStatusStr[IpcStatus_Count] = {
+ "",
+
+ "Unknown",
+ "Err: Not running",
+ "Err: Failed to init",
+ "Err: Failed to connect",
+ "Err: Unsupported version",
+ };
+
+ Result Init() {
+ Result rc = 0;
+
+ rc = IpcInitialize();
+
+ rc = GetStatus();
+
+ return rc;
+ }
+
+ void Exit() {
+ if (--refCnt == 0)
+ serviceClose(&service);
+ }
+
+ bool IsServiceRunning() {
+ Handle handle;
+ SmServiceName name = smEncodeName(SERVICE_NAME);
+ if (R_FAILED(smRegisterService(&handle, name, false, 1))) {
+ return true;
+ }
+ svcCloseHandle(handle);
+ smUnregisterService(name);
+ return false;
+ }
+
+ Result IpcInitialize(void) {
+ Result rc = 0;
+ refCnt++;
+
+ if (serviceIsActive(&service))
+ return 0;
+
+ rc = smGetService(&service, SERVICE_NAME);
+
+ if (R_FAILED(rc)) {
+ this->ipcStatus = IpcStatus_InitFailed;
+ rc = this->ipcStatus;
+ this->Exit();
+ return rc;
+ }
+
+ return rc;
+ }
+
+ Result GetApiVersion(u32* outVer) {
+ return serviceDispatchOut(&service, SysClkIpcCmd_GetApiVersion, *outVer);
+ }
+
+ Result GetConfigValues(SysClkConfigValueList* outConfigValues) {
+ return serviceDispatchOut(&service, SysClkIpcCmd_GetConfigValues, *outConfigValues);
+ }
+
+ Result SetMode(ReverseNXMode mode) {
+ return serviceDispatchIn(&service, SysClkIpcCmd_SetReverseNXRTMode, mode);
+ }
+
+ Result GetStatus() {
+ if (!IsServiceRunning()) {
+ this->ipcStatus = IpcStatus_NotRunning;
+ return this->ipcStatus;
+ }
+
+ tsl::hlp::ScopeGuard exitSrvGuard([&] { this->Exit(); });
+
+ uint32_t api_ver;
+ if (R_FAILED(GetApiVersion(&api_ver))) {
+ this->ipcStatus = IpcStatus_ConnectFailed;
+ return this->ipcStatus;
+ }
+
+ if (api_ver != API_VER) {
+ this->ipcStatus = IpcStatus_UnsupportedVer;
+ return this->ipcStatus;
+ }
+
+ SysClkConfigValueList* list = new SysClkConfigValueList;
+ tsl::hlp::ScopeGuard listGuard([&] { delete list; });
+
+ if (R_FAILED(GetConfigValues(list))) {
+ this->ipcStatus = IpcStatus_ConnectFailed;
+ return this->ipcStatus;
+ }
+
+ exitSrvGuard.dismiss();
+
+ shouldSync = bool(list->values[SysClkConfigValue_SyncReverseNXMode]);
+ this->ipcStatus = IpcStatus_OK;
+ return this->ipcStatus;
+ }
+
+ void UpdateStatusDesc(char* buffer, size_t size) {
+ snprintf(buffer, size,
+ "Mode Sync: %s%s",
+ IpcStatusStr[ipcStatus],
+ (ipcStatus == IpcStatus_OK) ? (
+ shouldSync ? "ON" : "OFF"
+ ) : ""
+ );
+ }
+
+ Service service = {};
+ std::atomic<std::size_t> refCnt = 0;
+ IpcStatus ipcStatus = IpcStatus_Unknown;
+ bool shouldSync = false;
+ };
+
+ Ipc* ipc = nullptr;
+ ReverseNXMode currentMode = ReverseNX_Undefined;
+};
+
bool* def = 0;
bool* isDocked = 0;
bool* pluginActive = 0;
@@ -17,6 +212,7 @@ bool plugin = false;
char DockedChar[32];
char SystemChar[32];
char PluginChar[36];
+char SysclkChar[0x40];
uint64_t PID = 0;
Handle remoteSharedMemory = 1;
SharedMemory _sharedmemory = {};
@@ -73,7 +269,7 @@ bool CheckPort () {
class GuiTest : public tsl::Gui {
public:
- GuiTest(u8 arg1, u8 arg2, bool arg3) { }
+ GuiTest(ModeSync* p) : modeSync(p) { }
// Called when this Gui gets loaded to create the UI
// Allocate all elements on the heap. libtesla will make sure to clean them up when not needed anymore
@@ -112,6 +308,7 @@ public:
else {
renderer->drawString(SystemChar, false, x, y+40, 20, renderer->a(0xFFFF));
renderer->drawString(DockedChar, false, x, y+60, 20, renderer->a(0xFFFF));
+ renderer->drawString(SysclkChar, false, x, y+80, 20, renderer->a(0xFFFF));
}
}
}), 100);
@@ -190,6 +387,8 @@ public:
if (_def) sprintf(SystemChar, "Controlled by system: Yes");
else sprintf(SystemChar, "Controlled by system: No");
+
+ modeSync->SetMode(_def, _isDocked, SysclkChar, sizeof(SysclkChar));
}
else i++;
}
@@ -200,6 +399,8 @@ public:
virtual bool handleInput(u64 keysDown, u64 keysHeld, const HidTouchState &touchPos, HidAnalogStickState joyStickPosLeft, HidAnalogStickState joyStickPosRight) override {
return false; // Return true here to singal the inputs have been consumed
}
+
+ ModeSync* modeSync;
};
class OverlayTest : public tsl::Overlay {
@@ -248,9 +449,11 @@ public:
});
+ modeSync = new ModeSync;
} // Called at the start to initialize all services necessary for this Overlay
virtual void exitServices() override {
+ delete modeSync;
shmemClose(&_sharedmemory);
fsdevUnmountDevice("sdmc");
} // Callet at the end to clean up all services previously initialized
@@ -260,8 +463,10 @@ public:
virtual void onHide() override {} // Called before overlay wants to change from visible to invisible state
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override {
- return initially<GuiTest>(1, 2, true); // Initial Gui to load. It's possible to pass arguments to it's constructor like this
+ return initially<GuiTest>(modeSync); // Initial Gui to load. It's possible to pass arguments to it's constructor like this
}
+
+ ModeSync* modeSync = nullptr;
};
int main(int argc, char **argv) {

View File

@@ -1,241 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <inttypes.h>
#include <unistd.h>
#include <switch.h>
/* Recompile nx-hbloader with following added in config.json "kernel_capabilities"
{
"type": "map",
"value": {
"address": "0x60006000",
"size": "0x1000",
"is_ro": false,
"is_io": true
}
}
*/
void waitForKey(PadState pad) {
while (appletMainLoop())
{
padUpdate(&pad);
u64 kDown = padGetButtonsDown(&pad);
if (kDown & HidNpadButton_A)
break;
if (kDown & HidNpadButton_Plus || kDown & HidNpadButton_B) {
consoleExit(NULL);
exit(0);
}
consoleUpdate(NULL);
}
}
#define CLK_RST_IO_BASE 0x60006000
#define CLK_RST_IO_SIZE 0x1000
#define REG(OFFSET) (*reinterpret_cast<volatile u32 *>(OFFSET))
#define GET_BITS(VAL, HIGH, LOW) ((VAL & ((1UL << (HIGH + 1UL)) - 1UL)) >> LOW)
#define GET_BIT(VAL, BIT) GET_BITS(VAL, BIT, BIT)
static u64 clkrst_base = 0;
static u64 clkrst_size = 0;
// From jetson nano kernel
typedef enum {
/* divider = 2 */
CLK_PLLX = 5,
CLK_PLLM = 2,
CLK_PLLMB = 37,
/* PLLX & PLLG are backup PLLs for CPU & GPU */
/* divider = 1 */
CLK_CCLK_G = 18, // A57 CPU cluster
CLK_EMC = 36,
} PTO_ID; // PLL Test Output Register ID
/* See if GM20B clock GPC PLL regs are accessible. */
#define PLLX_MISC0 0xE4
#define PLLM_MISC2 0x9C
double ptoGetMHz(PTO_ID pto_id, u32 divider = 1, u32 presel_reg = 0, u32 presel_mask = 0) {
u32 pre_val, val, presel_val;
if (presel_reg) {
val = REG(clkrst_base + presel_reg);
usleep(10);
presel_val = val & presel_mask;
val &= ~presel_mask;
val |= presel_mask;
REG(clkrst_base + presel_reg) = val;
usleep(10);
}
constexpr u32 cycle_count = 16;
pre_val = REG(clkrst_base + 0x60);
val = BIT(23) | BIT(13) | (cycle_count - 1);
val |= pto_id << 14;
REG(clkrst_base + 0x60) = val;
usleep(10);
REG(clkrst_base + 0x60) = val | BIT(10);
usleep(10);
REG(clkrst_base + 0x60) = val;
usleep(10);
REG(clkrst_base + 0x60) = val | BIT(9);
usleep(500);
while(REG(clkrst_base + 0x64) & BIT(31))
;
val = REG(clkrst_base + 0x64);
val &= 0xFFFFFF;
val *= divider;
double rate_mhz = (u64)val * 32768. / cycle_count / 1000. / 1000.;
usleep(10);
REG(clkrst_base + 0x60) = pre_val;
usleep(10);
if (presel_reg) {
val = REG(clkrst_base + presel_reg);
usleep(10);
val &= ~presel_mask;
val |= presel_val;
REG(clkrst_base + presel_reg) = val;
usleep(10);
}
return rate_mhz;
}
int main() {
consoleInit(NULL);
PadState pad;
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
padInitializeDefault(&pad);
// Get clkrst MMIO virtual address
Result rc = svcQueryIoMapping(&clkrst_base, &clkrst_size, CLK_RST_IO_BASE, CLK_RST_IO_SIZE);
if (R_FAILED(rc)) {
printf("[ERROR] svcQueryIoMapping: 0x%X\n", rc);
consoleUpdate(NULL);
waitForKey(pad);
consoleExit(NULL);
}
printf("clkrst_base: 0x%lX\nclkrst_size: 0x%lX\n", clkrst_base, clkrst_size);
{
#define CLKRST_PLLX_BASE 0xE0
u32 pllx_base = REG(clkrst_base + CLKRST_PLLX_BASE);
printf("\n"\
"PLLX_BASE: 0x%X\n"\
"PLLX_ENABLE: %lu\n"\
"PLLX_REF_DIS: %lu\n"\
"PLLX_LOCK: %lu\n"\
"PLLX_DIVP: %lu\n"\
"PLLX_DIVN: %lu\n"\
"PLLX_DIVM: %lu\n",
pllx_base,
GET_BIT(pllx_base, 30),
GET_BIT(pllx_base, 29),
GET_BIT(pllx_base, 27),
GET_BITS(pllx_base, 24, 20),
GET_BITS(pllx_base, 15, 8),
GET_BITS(pllx_base, 7, 0));
}
{
#define CLKRST_PLLX_MISC 0xE4
u32 pllx_misc = REG(clkrst_base + CLKRST_PLLX_MISC);
printf("\n"\
"PLLX_MISC: 0x%X\n"\
"PLLX_FO_G_DISABLE: %lu\n"\
"PLLX_PTS: %lu\n"\
"PLLX_LOCK_ENABLE: %lu\n",
pllx_misc,
GET_BIT(pllx_misc, 28),
GET_BITS(pllx_misc, 23, 22),
GET_BIT(pllx_misc, 18));
}
{
#define CLKRST_PLLMB_SS_CFG 0x780
u32 pllmb_ss_cfg = REG(clkrst_base + CLKRST_PLLMB_SS_CFG);
printf("\n"\
"PLLMB_SS_CFG: 0x%X\n"\
"PLLMB_EN_SDM: %lu\n"\
"PLLMB_EN_SSC: %lu\n",
pllmb_ss_cfg,
GET_BIT(pllmb_ss_cfg, 31),
GET_BIT(pllmb_ss_cfg, 30));
}
{
#define CLKRST_PLLMB_SS_CTRL1 0x784
u32 pllmb_ss_ctrl1 = REG(clkrst_base + CLKRST_PLLMB_SS_CTRL1);
printf("\n"\
"PLLMB_SS_CTRL1: 0x%X\n"\
"PLLMB_SDM_SSC_MAX: %lu\n"\
"PLLMB_SDM_SSC_MIN: %lu\n",
pllmb_ss_ctrl1,
GET_BITS(pllmb_ss_ctrl1, 31, 16),
GET_BITS(pllmb_ss_ctrl1, 15, 0));
}
{
#define CLKRST_PLLM_BASE 0x90
u32 pllm_base = REG(clkrst_base + CLKRST_PLLM_BASE);
printf("\n"\
"PLLM_BASE: 0x%X\n"\
"PLLM_DIVP: %lu\n"\
"PLLM_DIVN: %lu\n"\
"PLLM_DIVM: %lu\n",
pllm_base,
GET_BITS(pllm_base, 24, 20),
GET_BITS(pllm_base, 15, 8),
GET_BITS(pllm_base, 7, 0));
}
{
#define CLKRST_PLLMB_BASE 0x5e8
u32 pllmb_base = REG(clkrst_base + CLKRST_PLLMB_BASE);
printf("\n"\
"PLLMB_BASE: 0x%X\n"\
"PLLMB_DIVP: %lu\n"\
"PLLMB_DIVN: %lu\n"\
"PLLMB_DIVM: %lu\n",
pllmb_base,
GET_BITS(pllmb_base, 24, 20),
GET_BITS(pllmb_base, 15, 8),
GET_BITS(pllmb_base, 7, 0));
}
printf("\n"\
"EMC: %6.1f MHz\n"\
"CCLK_G: %6.1f MHz\n"\
"PLLX: %6.1f MHz\n"\
"PLLM: %6.1f MHz\n"\
"PLLMB: %6.1f MHz\n",
ptoGetMHz(CLK_EMC),
ptoGetMHz(CLK_CCLK_G),
ptoGetMHz(CLK_PLLX, 2, PLLX_MISC0, BIT(22)),
ptoGetMHz(CLK_PLLM, 2, PLLM_MISC2, BIT(8)),
ptoGetMHz(CLK_PLLMB, 2, PLLM_MISC2, BIT(9))
);
waitForKey(pad);
consoleExit(NULL);
return 0;
}