ams_mitm: Implement emummc Nintendo folder redirection

This commit is contained in:
Michael Scire
2019-12-05 23:41:33 -08:00
committed by SciresM
parent 733f2b3cdd
commit 746dbfe018
78 changed files with 2190 additions and 187 deletions

View File

@@ -34,7 +34,7 @@ namespace ams::boot {
/* Helpers. */
bool IsUsbClockValid() {
uintptr_t car_regs = dd::GetIoMapping(0x60006000ul, 0x1000);
uintptr_t car_regs = dd::GetIoMapping(0x60006000ul, os::MemoryPageSize);
const u32 pllu = reg::Read(car_regs + 0xC0);
const u32 utmip = reg::Read(car_regs + 0x480);

View File

@@ -42,18 +42,19 @@ namespace ams::boot {
constexpr size_t FrameBufferHeight = 1280;
constexpr size_t FrameBufferSize = FrameBufferHeight * FrameBufferWidth * sizeof(u32);
constexpr uintptr_t Disp1Base = 0x54200000ul;
constexpr uintptr_t DsiBase = 0x54300000ul;
constexpr uintptr_t ClkRstBase = 0x60006000ul;
constexpr uintptr_t GpioBase = 0x6000D000ul;
constexpr uintptr_t Disp1Base = 0x54200000ul;
constexpr uintptr_t DsiBase = 0x54300000ul;
constexpr uintptr_t ClkRstBase = 0x60006000ul;
constexpr uintptr_t GpioBase = 0x6000D000ul;
constexpr uintptr_t ApbMiscBase = 0x70000000ul;
constexpr uintptr_t MipiCalBase = 0x700E3000ul;
constexpr size_t Disp1Size = 0x3000;
constexpr size_t DsiSize = 0x1000;
constexpr size_t ClkRstSize = 0x1000;
constexpr size_t GpioSize = 0x1000;
constexpr size_t ApbMiscSize = 0x1000;
constexpr size_t MipiCalSize = 0x1000;
constexpr size_t Disp1Size = 3 * os::MemoryPageSize;
constexpr size_t DsiSize = os::MemoryPageSize;
constexpr size_t ClkRstSize = os::MemoryPageSize;
constexpr size_t GpioSize = os::MemoryPageSize;
constexpr size_t ApbMiscSize = os::MemoryPageSize;
constexpr size_t MipiCalSize = os::MemoryPageSize;
/* Types. */

View File

@@ -45,7 +45,7 @@ extern "C" {
void __appExit(void);
/* Exception handling. */
alignas(16) u8 __nx_exception_stack[0x1000];
alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize];
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx);
}

View File

@@ -27,7 +27,7 @@ namespace ams::boot {
constexpr size_t IramPayloadMaxSize = 0x2E000;
/* Globals. */
u8 __attribute__ ((aligned (0x1000))) g_work_page[0x1000];
alignas(os::MemoryPageSize) u8 g_work_page[os::MemoryPageSize];
/* Helpers. */
void ClearIram() {
@@ -45,9 +45,9 @@ namespace ams::boot {
ClearIram();
/* Copy in payload. */
for (size_t ofs = 0; ofs < fusee_primary_bin_size; ofs += 0x1000) {
std::memcpy(g_work_page, &fusee_primary_bin[ofs], std::min(static_cast<size_t>(fusee_primary_bin_size - ofs), size_t(0x1000)));
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, 0x1000);
for (size_t ofs = 0; ofs < fusee_primary_bin_size; ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, &fusee_primary_bin[ofs], std::min(static_cast<size_t>(fusee_primary_bin_size - ofs), sizeof(g_work_page)));
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, sizeof(g_work_page));
}

View File

@@ -21,7 +21,7 @@ namespace ams::boot {
namespace {
/* Globals. */
alignas(0x1000) u8 g_boot_image_work_buffer[0x10000];
alignas(os::MemoryPageSize) u8 g_boot_image_work_buffer[0x10000];
}

View File

@@ -39,7 +39,7 @@ namespace ams::gpio {
uintptr_t GetBaseAddress() {
if (!g_initialized_gpio_vaddr) {
g_gpio_vaddr = dd::GetIoMapping(PhysicalBase, 0x1000);
g_gpio_vaddr = dd::GetIoMapping(PhysicalBase, os::MemoryPageSize);
g_initialized_gpio_vaddr = true;
}
return g_gpio_vaddr;

View File

@@ -83,7 +83,7 @@ namespace ams::i2c::driver::impl {
12, 22, 3, 7, 15, 6
};
const uintptr_t registers = dd::GetIoMapping(0x60006000ul, 0x1000);
const uintptr_t registers = dd::GetIoMapping(0x60006000ul, os::MemoryPageSize);
const size_t idx = ConvertToIndex(bus);
this->clk_src_reg = registers + s_clk_src_offsets[idx];
this->clk_en_reg = registers + s_clk_en_offsets[idx];
@@ -97,7 +97,7 @@ namespace ams::i2c::driver::impl {
0x0000, 0x0400, 0x0500, 0x0700, 0x1000, 0x1100
};
const uintptr_t registers = dd::GetIoMapping(0x7000c000ul, 0x2000) + s_offsets[ConvertToIndex(bus)];
const uintptr_t registers = dd::GetIoMapping(0x7000c000ul, 2 * os::MemoryPageSize) + s_offsets[ConvertToIndex(bus)];
return reinterpret_cast<Registers *>(registers);
}