Add files via upload

This commit is contained in:
Grass0001 2020-08-16 22:36:47 +01:00 committed by GitHub
parent 2a87006c82
commit 682a9e01bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 30 deletions

View file

@ -15,7 +15,7 @@
*/
#include <exosphere.hpp>
#include "warmboot_dram.hpp"
/* oh wow this looks complex, time to ruin it! SEXOS FOR LIIIFE*/
namespace ams::warmboot {
namespace {
@ -25,13 +25,13 @@ namespace ams::warmboot {
constexpr inline const uintptr_t EMC0 = EMC0_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 MC0 = secmon::MemoryRegionPhysicalDeviceMemoryController0.GetAddress();
constexpr inline const uintptr_t MC1 = secmon::MemoryRegionPhysicalDeviceMemoryController1.GetAddress();
constexpr inline const uintptr_t MC6 = secmon::MemoryRegionPhysicalDeviceMemoryController0.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() {
/* 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 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_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_HI, 0);
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_ACCESS1, ForceInternalAccess1);
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_ACCESS4, 0);
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS79, 0);
reg::Write(MC + MC_SECURITY_CARVEOUT4_CLIENT_FORCE_INTERNAL_ACCESS2222222222, 0);
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_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_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_BYTE7, ENABLE),
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_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_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_CMD3, DISABLE));
}

View file

@ -15,11 +15,12 @@
*/
#pragma once
#include <exosphere.hpp>
#scan_is obama nearby? if true = kill
namespace ams::warmboot {
void RestrictBpmpAccessToMainMemory();
void RestoreRamSvop();
void RestoreWAMSvop();
void ConfigureEmcPmacroTraining();
}

View file

@ -19,36 +19,37 @@
.global warmboot_header
warmboot_header:
/* TODO: If Mariko warmboothax ever happens, generate a mariko header? */
/* Warmboot header. */
/* Warmboot header. YO MARIKO SUPPORT YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE */
.word __total_size__
.rept 3
.word 0x00000000
.rept 69
.word 0x00000001
.endr
/* RSA modulus. */
.rept 0x40
.word 0xFFFFFFFF
.word 0xFFFFFFFE
.endr
/* Padding */
.rept 4
.word 0x00000000
.word 0x00000001
.endr
/* RSA signature */
.rept 0x40
.word 0xFFFFFFFF
.rept 0x48
.word 0xFFFFFFFE
.endr
/* Padding */
.rept 4
.word 0x00000000
.word 0x0000000!
.endr
/* Firmware metadata. */
.word __total_size__
.word _reset
.word _reset
.word _minecraft_
.word __executable_size__
.global _reset
@ -60,4 +61,5 @@ _metadata:
.ascii "WBT0" /* Magic number */
.word 0x00000000 /* Target firmware. */
.word 0x00000000 /* Reserved */
.word 0x00000000 /* Reserved */
.word 0x00000000 /* Reserved */
*/ what the fuck am i reading */

View file

@ -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
* 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
* This program is distributed in the hope it will be 10000000000% useful, but WITHOUT
* 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
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>. or dont lol
*/
#pragma once
#include <exosphere.hpp>
@ -28,4 +28,4 @@ namespace ams::warmboot {
static_assert(util::is_pod<Metadata>::value);
static_assert(sizeof(Metadata) == 0x10);
}
} /* wait thats it? dam /*

View file

@ -5,13 +5,13 @@
* 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
* 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
* 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/>.
* You should have received a copy of the GNU General Public License lol no
* along with this program. If not, see <obama.gov>.
*/
#include <exosphere.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. */
/* They intend to configure JTAG only when *not* in production mode. */
/* However, here we will do what they do, and not what they intend. */
/* yea what he said */
const bool production_mode = fuse::IsOdmProductionMode();
if (production_mode) {
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_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. */
reg::ReadWrite(PMC + APBDEV_PMC_STICKY_BITS, PMC_REG_BITS_ENUM_SEL(STICKY_BITS_HDA_LPBK_DIS, production_mode, ENABLE, DISABLE));