mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2025-01-09 22:36:18 +00:00
Merge branch 'master' into debugger_dev
This commit is contained in:
commit
9fe8b22269
13 changed files with 53 additions and 22 deletions
4
Makefile
4
Makefile
|
@ -42,8 +42,8 @@ dist: all
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000036
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000036
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000034
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000034
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000032
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/titles/0100000000000032
|
||||||
cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/fusee-secondary.bin
|
cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/atmosphere/fusee-secondary.bin
|
||||||
cp common/defaults/BCT.ini atmosphere-$(AMSVER)/BCT.ini
|
cp common/defaults/BCT.ini atmosphere-$(AMSVER)/atmosphere/BCT.ini
|
||||||
cp common/defaults/loader.ini atmosphere-$(AMSVER)/atmosphere/loader.ini
|
cp common/defaults/loader.ini atmosphere-$(AMSVER)/atmosphere/loader.ini
|
||||||
cp -r common/defaults/kip_patches atmosphere-$(AMSVER)/atmosphere/kip_patches
|
cp -r common/defaults/kip_patches atmosphere-$(AMSVER)/atmosphere/kip_patches
|
||||||
cp stratosphere/creport/creport.nsp atmosphere-$(AMSVER)/atmosphere/titles/0100000000000036/exefs.nsp
|
cp stratosphere/creport/creport.nsp atmosphere-$(AMSVER)/atmosphere/titles/0100000000000036/exefs.nsp
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
BCT0
|
BCT0
|
||||||
[stage1]
|
[stage1]
|
||||||
stage2_path = fusee-secondary.bin
|
stage2_path = atmosphere/fusee-secondary.bin
|
||||||
stage2_addr = 0xF0000000
|
stage2_addr = 0xF0000000
|
||||||
stage2_entrypoint = 0xF0000000
|
stage2_entrypoint = 0xF0000000
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "configitem.h"
|
#include "configitem.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "uart.h"
|
||||||
#include "bpmp.h"
|
#include "bpmp.h"
|
||||||
#include "sysreg.h"
|
#include "sysreg.h"
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
|
@ -213,6 +214,11 @@ void bootup_misc_mmio(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_has_booted_up) {
|
if (!g_has_booted_up) {
|
||||||
|
/* N doesn't do this, but we should for compatibility. */
|
||||||
|
uart_select(UART_A);
|
||||||
|
clkrst_reboot(CARDEVICE_UARTA);
|
||||||
|
uart_init(UART_A, 115200);
|
||||||
|
|
||||||
intr_register_handler(INTERRUPT_ID_SECURITY_ENGINE, se_operation_completed);
|
intr_register_handler(INTERRUPT_ID_SECURITY_ENGINE, se_operation_completed);
|
||||||
if (exosphere_get_target_firmware() >= EXOSPHERE_TARGET_FIRMWARE_400) {
|
if (exosphere_get_target_firmware() >= EXOSPHERE_TARGET_FIRMWARE_400) {
|
||||||
intr_register_handler(INTERRUPT_ID_ACTIVITY_MONITOR_4X, actmon_interrupt_handler);
|
intr_register_handler(INTERRUPT_ID_ACTIVITY_MONITOR_4X, actmon_interrupt_handler);
|
||||||
|
|
|
@ -38,8 +38,8 @@ uint32_t configitem_set(bool privileged, ConfigItem item, uint64_t value) {
|
||||||
case CONFIGITEM_NEEDS_REBOOT_TO_RCM:
|
case CONFIGITEM_NEEDS_REBOOT_TO_RCM:
|
||||||
/* Force a reboot to RCM, if requested. */
|
/* Force a reboot to RCM, if requested. */
|
||||||
if (value != 0) {
|
if (value != 0) {
|
||||||
MAKE_REG32(0x7000E450) = 0x2;
|
MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_RTC_PMC) + 0x450ull) = 0x2;
|
||||||
MAKE_REG32(0x7000E400) = 0x10;
|
MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_RTC_PMC) + 0x400ull) = 0x10;
|
||||||
while (1) { }
|
while (1) { }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -72,6 +72,15 @@ bool configitem_should_profile_battery(void) {
|
||||||
return g_battery_profile;
|
return g_battery_profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool configitem_is_debugmode_priv(void) {
|
||||||
|
uint64_t debugmode = 0;
|
||||||
|
if (configitem_get(true, CONFIGITEM_ISDEBUGMODE, &debugmode) != 0) {
|
||||||
|
generic_panic();
|
||||||
|
}
|
||||||
|
|
||||||
|
return debugmode != 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t configitem_get_hardware_type(void) {
|
uint64_t configitem_get_hardware_type(void) {
|
||||||
uint64_t hardware_type;
|
uint64_t hardware_type;
|
||||||
if (configitem_get(true, CONFIGITEM_HARDWARETYPE, &hardware_type) != 0) {
|
if (configitem_get(true, CONFIGITEM_HARDWARETYPE, &hardware_type) != 0) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ uint32_t configitem_get(bool privileged, ConfigItem item, uint64_t *p_outvalue);
|
||||||
bool configitem_is_recovery_boot(void);
|
bool configitem_is_recovery_boot(void);
|
||||||
bool configitem_is_retail(void);
|
bool configitem_is_retail(void);
|
||||||
bool configitem_should_profile_battery(void);
|
bool configitem_should_profile_battery(void);
|
||||||
|
bool configitem_is_debugmode_priv(void);
|
||||||
|
|
||||||
void configitem_set_debugmode_override(bool user, bool priv);
|
void configitem_set_debugmode_override(bool user, bool priv);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "smc_api.h"
|
#include "smc_api.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "uart.h"
|
||||||
#include "exocfg.h"
|
#include "exocfg.h"
|
||||||
|
|
||||||
#define u8 uint8_t
|
#define u8 uint8_t
|
||||||
|
@ -241,7 +242,7 @@ void save_se_and_power_down_cpu(void) {
|
||||||
save_se_state();
|
save_se_state();
|
||||||
|
|
||||||
if (!configitem_is_retail()) {
|
if (!configitem_is_retail()) {
|
||||||
/* TODO: uart_log("OYASUMI"); */
|
uart_send(UART_A, "OYASUMI", 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
finalize_powerdown();
|
finalize_powerdown();
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "car.h"
|
#include "car.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "uart.h"
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
|
|
||||||
#include "pmc.h"
|
#include "pmc.h"
|
||||||
|
@ -55,8 +56,16 @@ void __attribute__((noreturn)) warmboot_main(void) {
|
||||||
|
|
||||||
/* On warmboot (not cpu_on) only */
|
/* On warmboot (not cpu_on) only */
|
||||||
if (VIRT_MC_SECURITY_CFG3 == 0) {
|
if (VIRT_MC_SECURITY_CFG3 == 0) {
|
||||||
|
/* N only does this on dev units, but we will do it unconditionally. */
|
||||||
|
{
|
||||||
|
uart_select(UART_A);
|
||||||
|
clkrst_reboot(CARDEVICE_UARTA);
|
||||||
|
uart_init(UART_A, 115200);
|
||||||
|
}
|
||||||
|
|
||||||
if (!configitem_is_retail()) {
|
if (!configitem_is_retail()) {
|
||||||
/* TODO: uart_log("OHAYO"); */
|
uart_send(UART_A, "OHAYO", 6);
|
||||||
|
uart_wait_idle(UART_A, UART_VENDOR_STATE_TX_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check the Security Engine. */
|
/* Sanity check the Security Engine. */
|
||||||
|
|
|
@ -40,12 +40,12 @@ static char g_bct0_buffer[BCTO_MAX_SIZE];
|
||||||
#define DEFAULT_BCT0_FOR_DEBUG \
|
#define DEFAULT_BCT0_FOR_DEBUG \
|
||||||
"BCT0\n"\
|
"BCT0\n"\
|
||||||
"[stage1]\n"\
|
"[stage1]\n"\
|
||||||
"stage2_path = fusee-secondary.bin\n"\
|
"stage2_path = atmosphere/fusee-secondary.bin\n"\
|
||||||
"stage2_addr = 0xF0000000\n"\
|
"stage2_addr = 0xF0000000\n"\
|
||||||
"stage2_entrypoint = 0xF0000000\n"
|
"stage2_entrypoint = 0xF0000000\n"
|
||||||
|
|
||||||
static const char *load_config(void) {
|
static const char *load_config(void) {
|
||||||
if (!read_from_file(g_bct0_buffer, BCTO_MAX_SIZE, "BCT.ini")) {
|
if (!read_from_file(g_bct0_buffer, BCTO_MAX_SIZE, "atmosphere/BCT.ini")) {
|
||||||
print(SCREEN_LOG_LEVEL_DEBUG, "Failed to read BCT0 from SD!\n");
|
print(SCREEN_LOG_LEVEL_DEBUG, "Failed to read BCT0 from SD!\n");
|
||||||
print(SCREEN_LOG_LEVEL_DEBUG, "Using default BCT0!\n");
|
print(SCREEN_LOG_LEVEL_DEBUG, "Using default BCT0!\n");
|
||||||
memcpy(g_bct0_buffer, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG));
|
memcpy(g_bct0_buffer, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG));
|
||||||
|
@ -133,6 +133,9 @@ int main(void) {
|
||||||
uint32_t stage2_version = 0;
|
uint32_t stage2_version = 0;
|
||||||
ScreenLogLevel log_level = SCREEN_LOG_LEVEL_MANDATORY;
|
ScreenLogLevel log_level = SCREEN_LOG_LEVEL_MANDATORY;
|
||||||
|
|
||||||
|
/* Override the global logging level. */
|
||||||
|
log_set_log_level(log_level);
|
||||||
|
|
||||||
/* Initialize the display, console, etc. */
|
/* Initialize the display, console, etc. */
|
||||||
setup_env();
|
setup_env();
|
||||||
|
|
||||||
|
@ -144,9 +147,6 @@ int main(void) {
|
||||||
fatal_error("Failed to parse BCT.ini!\n");
|
fatal_error("Failed to parse BCT.ini!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override the global logging level. */
|
|
||||||
log_set_log_level(log_level);
|
|
||||||
|
|
||||||
/* Say hello. */
|
/* Say hello. */
|
||||||
print(SCREEN_LOG_LEVEL_MANDATORY, "Welcome to Atmosph\xe8re Fus\xe9" "e!\n");
|
print(SCREEN_LOG_LEVEL_MANDATORY, "Welcome to Atmosph\xe8re Fus\xe9" "e!\n");
|
||||||
print(SCREEN_LOG_LEVEL_DEBUG, "Using color linear framebuffer at 0x%p!\n", g_framebuffer);
|
print(SCREEN_LOG_LEVEL_DEBUG, "Using color linear framebuffer at 0x%p!\n", g_framebuffer);
|
||||||
|
@ -159,7 +159,7 @@ int main(void) {
|
||||||
strcpy(g_chainloader_arg_data, stage2_path);
|
strcpy(g_chainloader_arg_data, stage2_path);
|
||||||
stage2_args = (stage2_args_t *)(g_chainloader_arg_data + strlen(stage2_path) + 1); /* May be unaligned. */
|
stage2_args = (stage2_args_t *)(g_chainloader_arg_data + strlen(stage2_path) + 1); /* May be unaligned. */
|
||||||
memcpy(&stage2_args->version, &stage2_version, 4);
|
memcpy(&stage2_args->version, &stage2_version, 4);
|
||||||
stage2_args->log_level = log_level;
|
memcpy(&stage2_args->log_level, &log_level, sizeof(log_level));
|
||||||
stage2_args->display_initialized = false;
|
stage2_args->display_initialized = false;
|
||||||
strcpy(stage2_args->bct0, bct0);
|
strcpy(stage2_args->bct0, bct0);
|
||||||
g_chainloader_argc = 2;
|
g_chainloader_argc = 2;
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
#define MAILBOX_EXOSPHERE_CONFIGURATION ((volatile exosphere_config_t *)(0x40002E40))
|
#define MAILBOX_EXOSPHERE_CONFIGURATION ((volatile exosphere_config_t *)(0x40002E40))
|
||||||
|
|
||||||
#define EXOSPHERE_TARGETFW_KEY "target_firmware"
|
#define EXOSPHERE_TARGETFW_KEY "target_firmware"
|
||||||
#define EXOSPHERE_DEBUGMODE_PRIV_KEY "debug_mode"
|
#define EXOSPHERE_DEBUGMODE_PRIV_KEY "debugmode"
|
||||||
#define EXOSPHERE_DEBUGMODE_USER_KEY "debug_mode_user"
|
#define EXOSPHERE_DEBUGMODE_USER_KEY "debugmode_user"
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -442,6 +442,11 @@ static const kernel_hook_t g_kernel_hooks_600[] = {
|
||||||
|
|
||||||
/* Kernel Infos. */
|
/* Kernel Infos. */
|
||||||
static const kernel_info_t g_kernel_infos[] = {
|
static const kernel_info_t g_kernel_infos[] = {
|
||||||
|
{ /* 1.0.0-7. */
|
||||||
|
.hash = {0x64, 0x44, 0x07, 0x2F, 0x56, 0x44, 0x73, 0xDD, 0xD5, 0x46, 0x1B, 0x8C, 0xDC, 0xEF, 0x54, 0x98, 0x16, 0xDA, 0x81, 0xDE, 0x5B, 0x1C, 0x9D, 0xD7, 0x5A, 0x13, 0x91, 0xD9, 0x53, 0xAB, 0x8D, 0x8D},
|
||||||
|
.free_code_space_offset = 0x4797C,
|
||||||
|
KERNEL_HOOKS(100)
|
||||||
|
},
|
||||||
{ /* 1.0.0. */
|
{ /* 1.0.0. */
|
||||||
.hash = {0xB8, 0xC5, 0x0C, 0x68, 0x25, 0xA9, 0xB9, 0x5B, 0xD2, 0x4D, 0x2C, 0x7C, 0x81, 0x7F, 0xE6, 0x96, 0xF2, 0x42, 0x4E, 0x1D, 0x78, 0xDF, 0x3B, 0xCA, 0x3D, 0x6B, 0x68, 0x12, 0xDD, 0xA9, 0xCB, 0x9C},
|
.hash = {0xB8, 0xC5, 0x0C, 0x68, 0x25, 0xA9, 0xB9, 0x5B, 0xD2, 0x4D, 0x2C, 0x7C, 0x81, 0x7F, 0xE6, 0x96, 0xF2, 0x42, 0x4E, 0x1D, 0x78, 0xDF, 0x3B, 0xCA, 0x3D, 0x6B, 0x68, 0x12, 0xDD, 0xA9, 0xCB, 0x9C},
|
||||||
.free_code_space_offset = 0x4797C,
|
.free_code_space_offset = 0x4797C,
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
"title_id_range_min": "0x0100000000000034",
|
"title_id_range_min": "0x0100000000000034",
|
||||||
"title_id_range_max": "0x0100000000000034",
|
"title_id_range_max": "0x0100000000000034",
|
||||||
"main_thread_stack_size": "0x00010000",
|
"main_thread_stack_size": "0x00010000",
|
||||||
"main_thread_priority": 37,
|
"main_thread_priority": 15,
|
||||||
"default_cpu_id": 3,
|
"default_cpu_id": 3,
|
||||||
"process_category": 0,
|
"process_category": 0,
|
||||||
"is_retail": true,
|
"is_retail": true,
|
||||||
"pool_partition": 2,
|
"pool_partition": 2,
|
||||||
"is_64_bit": true,
|
"is_64_bit": true,
|
||||||
"address_space_type": 3,
|
"address_space_type": 1,
|
||||||
"filesystem_access": {
|
"filesystem_access": {
|
||||||
"permissions": "0xFFFFFFFFFFFFFFFF"
|
"permissions": "0xFFFFFFFFFFFFFFFF"
|
||||||
},
|
},
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"type": "min_kernel_version",
|
"type": "min_kernel_version",
|
||||||
"value": "0x0060"
|
"value": "0x0030"
|
||||||
}, {
|
}, {
|
||||||
"type": "handle_table_size",
|
"type": "handle_table_size",
|
||||||
"value": 128
|
"value": 128
|
||||||
|
|
|
@ -69,7 +69,7 @@ void Utils::InitializeSdThreadFunc(void *args) {
|
||||||
|
|
||||||
/* Mount SD. */
|
/* Mount SD. */
|
||||||
while (R_FAILED(fsMountSdcard(&g_sd_filesystem))) {
|
while (R_FAILED(fsMountSdcard(&g_sd_filesystem))) {
|
||||||
svcSleepThread(1000ULL);
|
svcSleepThread(1000000ULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Back up CAL0, if it's not backed up already. */
|
/* Back up CAL0, if it's not backed up already. */
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"is_retail": true,
|
"is_retail": true,
|
||||||
"pool_partition": 2,
|
"pool_partition": 2,
|
||||||
"is_64_bit": true,
|
"is_64_bit": true,
|
||||||
"address_space_type": 3,
|
"address_space_type": 1,
|
||||||
"filesystem_access": {
|
"filesystem_access": {
|
||||||
"permissions": "0xFFFFFFFFFFFFFFFF"
|
"permissions": "0xFFFFFFFFFFFFFFFF"
|
||||||
},
|
},
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "min_kernel_version",
|
"type": "min_kernel_version",
|
||||||
"value": "0x0060"
|
"value": "0x0030"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in a new issue