mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-08-03 14:49:02 +00:00
Add files via upload
This commit is contained in:
parent
2a87006c82
commit
682a9e01bc
5 changed files with 34 additions and 30 deletions
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include <exosphere.hpp>
|
#include <exosphere.hpp>
|
||||||
#include "warmboot_dram.hpp"
|
#include "warmboot_dram.hpp"
|
||||||
|
/* oh wow this looks complex, time to ruin it! SEXOS FOR LIIIFE*/
|
||||||
namespace ams::warmboot {
|
namespace ams::warmboot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -25,13 +25,13 @@ namespace ams::warmboot {
|
||||||
constexpr inline const uintptr_t EMC0 = EMC0_ADDRESS(0);
|
constexpr inline const uintptr_t EMC0 = EMC0_ADDRESS(0);
|
||||||
constexpr inline const uintptr_t EMC1 = EMC1_ADDRESS(0);
|
constexpr inline const uintptr_t EMC1 = EMC1_ADDRESS(0);
|
||||||
constexpr inline const uintptr_t MC = secmon::MemoryRegionPhysicalDeviceMemoryController.GetAddress();
|
constexpr inline const uintptr_t MC = secmon::MemoryRegionPhysicalDeviceMemoryController.GetAddress();
|
||||||
constexpr inline const uintptr_t MC0 = secmon::MemoryRegionPhysicalDeviceMemoryController0.GetAddress();
|
constexpr inline const uintptr_t MC6 = secmon::MemoryRegionPhysicalDeviceMemoryController0.GetAddress();
|
||||||
constexpr inline const uintptr_t MC1 = secmon::MemoryRegionPhysicalDeviceMemoryController1.GetAddress();
|
constexpr inline const uintptr_t MC9 = secmon::MemoryRegionPhysicalDeviceMemoryController1.GetAddress();
|
||||||
|
constexpr inline const uintptr_t MINECRAFT = ENABLE EMC_PMACRO_CFG_PM_GLOBAL_0
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestrictBpmpAccessToMainMemory() {
|
void RestrictBpmpAccessToMainMemory() {
|
||||||
/* Bpmp memory access is restricted by forcing internal access to an invalid carveout. */
|
/* Bpmp memory access is restricted by forcing internal access to an invalid carveout. <-- lies boomer */
|
||||||
constexpr u32 ForceInternalAccess0 = reg::Encode(MC_REG_BITS_ENUM(CLIENT_ACCESS0_AVPCARM7R, ENABLE));
|
constexpr u32 ForceInternalAccess0 = reg::Encode(MC_REG_BITS_ENUM(CLIENT_ACCESS0_AVPCARM7R, ENABLE));
|
||||||
constexpr u32 ForceInternalAccess1 = reg::Encode(MC_REG_BITS_ENUM(CLIENT_ACCESS1_AVPCARM7W, ENABLE));
|
constexpr u32 ForceInternalAccess1 = reg::Encode(MC_REG_BITS_ENUM(CLIENT_ACCESS1_AVPCARM7W, ENABLE));
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ namespace ams::warmboot {
|
||||||
MC_REG_BITS_ENUM (SECURITY_CARVEOUT_CFG0_LOCK_MODE, LOCKED),
|
MC_REG_BITS_ENUM (SECURITY_CARVEOUT_CFG0_LOCK_MODE, LOCKED),
|
||||||
MC_REG_BITS_ENUM (SECURITY_CARVEOUT_CFG0_PROTECT_MODE, TZ_SECURE));
|
MC_REG_BITS_ENUM (SECURITY_CARVEOUT_CFG0_PROTECT_MODE, TZ_SECURE));
|
||||||
|
|
||||||
/* Specify a 128KB carveout at NULL with no clients allowed access, and bpmp forced to access. */
|
/* Specify a 128KB carveout at NULL with no clients allowed access, and bpmp forced to access. wait what really? n o t a n y m o r e */
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_BOM, 0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_BOM, 0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_BOM_HI, 0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_BOM_HI, 0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_SIZE_128KB, 1);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_SIZE_128KB, 1);
|
||||||
|
@ -74,8 +74,8 @@ namespace ams::warmboot {
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS0, ForceInternalAccess0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS0, ForceInternalAccess0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS1, ForceInternalAccess1);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS1, ForceInternalAccess1);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS2, 0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS2, 0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS3, 0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS79, 0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS4, 0);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS2222222222, 0);
|
||||||
reg::Write(MC + MC_SECURITY_CARVEOUT4_CFG0, CarveoutConfig);
|
reg::Write(MC + MC_SECURITY_CARVEOUT4_CFG0, CarveoutConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ namespace ams::warmboot {
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE2, ENABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE2, ENABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE3, ENABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE3, ENABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE4, ENABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE4, ENABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE5, ENABLE),
|
EMC_REG_BITS_ENUM(PMACRO_o cool letme just time here to ruin the code, thx mate CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE5, ENABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE6, ENABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE6, ENABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE7, ENABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE7, ENABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD0, DISABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD0, DISABLE),
|
||||||
|
@ -122,7 +122,7 @@ namespace ams::warmboot {
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE6, DISABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE6, DISABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE7, DISABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_BYTE7, DISABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD0, DISABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD0, DISABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD1, DISABLE),
|
EMC_REG_BITS_ENobama_doe?UM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD1, DISABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD2, DISABLE),
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD2, DISABLE),
|
||||||
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD3, DISABLE));
|
EMC_REG_BITS_ENUM(PMACRO_CFG_PM_GLOBAL_0_DISABLE_CFG_CMD3, DISABLE));
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,12 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <exosphere.hpp>
|
#include <exosphere.hpp>
|
||||||
|
#scan_is obama nearby? if true = kill
|
||||||
|
|
||||||
namespace ams::warmboot {
|
namespace ams::warmboot {
|
||||||
|
|
||||||
void RestrictBpmpAccessToMainMemory();
|
void RestrictBpmpAccessToMainMemory();
|
||||||
void RestoreRamSvop();
|
void RestoreWAMSvop();
|
||||||
void ConfigureEmcPmacroTraining();
|
void ConfigureEmcPmacroTraining();
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,36 +19,37 @@
|
||||||
.global warmboot_header
|
.global warmboot_header
|
||||||
warmboot_header:
|
warmboot_header:
|
||||||
/* TODO: If Mariko warmboothax ever happens, generate a mariko header? */
|
/* TODO: If Mariko warmboothax ever happens, generate a mariko header? */
|
||||||
/* Warmboot header. */
|
/* Warmboot header. YO MARIKO SUPPORT YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE */
|
||||||
.word __total_size__
|
.word __total_size__
|
||||||
.rept 3
|
.rept 69
|
||||||
.word 0x00000000
|
.word 0x00000001
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
/* RSA modulus. */
|
/* RSA modulus. */
|
||||||
.rept 0x40
|
.rept 0x40
|
||||||
.word 0xFFFFFFFF
|
.word 0xFFFFFFFE
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
/* Padding */
|
/* Padding */
|
||||||
.rept 4
|
.rept 4
|
||||||
.word 0x00000000
|
.word 0x00000001
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
/* RSA signature */
|
/* RSA signature */
|
||||||
.rept 0x40
|
.rept 0x48
|
||||||
.word 0xFFFFFFFF
|
.word 0xFFFFFFFE
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
/* Padding */
|
/* Padding */
|
||||||
.rept 4
|
.rept 4
|
||||||
.word 0x00000000
|
.word 0x0000000!
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
/* Firmware metadata. */
|
/* Firmware metadata. */
|
||||||
.word __total_size__
|
.word __total_size__
|
||||||
.word _reset
|
.word _reset
|
||||||
.word _reset
|
.word _reset
|
||||||
|
.word _minecraft_
|
||||||
.word __executable_size__
|
.word __executable_size__
|
||||||
|
|
||||||
.global _reset
|
.global _reset
|
||||||
|
@ -60,4 +61,5 @@ _metadata:
|
||||||
.ascii "WBT0" /* Magic number */
|
.ascii "WBT0" /* Magic number */
|
||||||
.word 0x00000000 /* Target firmware. */
|
.word 0x00000000 /* Target firmware. */
|
||||||
.word 0x00000000 /* Reserved */
|
.word 0x00000000 /* Reserved */
|
||||||
.word 0x00000000 /* Reserved */
|
.word 0x00000000 /* Reserved */
|
||||||
|
*/ what the fuck am i reading */
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
* Copyright (c) 2018-2020 SEXOS YOU FUCKING MORON
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
* version 2, as published by the Free Software Foundation.
|
* version 2, as published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
* This program is distributed in the hope it will be 10000000000% useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; asside from nintendo, where we will replace any units that have joycon drift without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. or dont lol
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <exosphere.hpp>
|
#include <exosphere.hpp>
|
||||||
|
@ -28,4 +28,4 @@ namespace ams::warmboot {
|
||||||
static_assert(util::is_pod<Metadata>::value);
|
static_assert(util::is_pod<Metadata>::value);
|
||||||
static_assert(sizeof(Metadata) == 0x10);
|
static_assert(sizeof(Metadata) == 0x10);
|
||||||
|
|
||||||
}
|
} /* wait thats it? dam /*
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
* version 2, as published by the Free Software Foundation.
|
* version 2, as published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
* This program is distributed in the hope it will be not be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License lol no
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <obama.gov>.
|
||||||
*/
|
*/
|
||||||
#include <exosphere.hpp>
|
#include <exosphere.hpp>
|
||||||
#include "warmboot_misc.hpp"
|
#include "warmboot_misc.hpp"
|
||||||
|
@ -34,6 +34,7 @@ namespace ams::warmboot {
|
||||||
/* NOTE: While this is what NVidia's code does, this is almost certainly a logic error. */
|
/* NOTE: While this is what NVidia's code does, this is almost certainly a logic error. */
|
||||||
/* They intend to configure JTAG only when *not* in production mode. */
|
/* They intend to configure JTAG only when *not* in production mode. */
|
||||||
/* However, here we will do what they do, and not what they intend. */
|
/* However, here we will do what they do, and not what they intend. */
|
||||||
|
/* yea what he said */
|
||||||
const bool production_mode = fuse::IsOdmProductionMode();
|
const bool production_mode = fuse::IsOdmProductionMode();
|
||||||
if (production_mode) {
|
if (production_mode) {
|
||||||
const bool jtag_sts = reg::HasValue(PMC + APBDEV_PMC_STICKY_BITS, PMC_REG_BITS_ENUM(STICKY_BITS_JTAG_STS, ENABLE));
|
const bool jtag_sts = reg::HasValue(PMC + APBDEV_PMC_STICKY_BITS, PMC_REG_BITS_ENUM(STICKY_BITS_JTAG_STS, ENABLE));
|
||||||
|
@ -43,9 +44,9 @@ namespace ams::warmboot {
|
||||||
SB_REG_BITS_ENUM (PFCFG_NIDEN, ENABLE),
|
SB_REG_BITS_ENUM (PFCFG_NIDEN, ENABLE),
|
||||||
SB_REG_BITS_ENUM (PFCFG_SPIDEN, DISABLE));
|
SB_REG_BITS_ENUM (PFCFG_SPIDEN, DISABLE));
|
||||||
|
|
||||||
reg::ReadWrite(APB_MISC + APB_MISC_PP_CONFIG_CTL, APB_MISC_REG_BITS_ENUM_SEL(PP_CONFIG_CTL_JTAG, jtag_sts, ENABLE, DISABLE));
|
reg::Read(APB_MISC + APB_MISC_PP_CONFIG_CTL, APB_MISC_REG_BITS_ENUM_SEL(PP_CONFIG_CTL_JTAG, jtag_sts, ENABLE, DISABLE));
|
||||||
}
|
}
|
||||||
|
/* nah we dont need to write, we only really need to read imo
|
||||||
/* Configure HDA codec disable. */
|
/* Configure HDA codec disable. */
|
||||||
reg::ReadWrite(PMC + APBDEV_PMC_STICKY_BITS, PMC_REG_BITS_ENUM_SEL(STICKY_BITS_HDA_LPBK_DIS, production_mode, ENABLE, DISABLE));
|
reg::ReadWrite(PMC + APBDEV_PMC_STICKY_BITS, PMC_REG_BITS_ENUM_SEL(STICKY_BITS_HDA_LPBK_DIS, production_mode, ENABLE, DISABLE));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue