-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init is an alternative for bigpayload in CakeHax and can be an entry point for delebile's arm9loaderhax. # Conflicts: # rxtools/Makefile # rxtools/source/tool/MainMenu.h # rxtools/source/tool/cstart.c # rxtools/source/tool/features/AdvancedFileManager.c # rxtools/source/tool/features/CTRDecryptor.c # rxtools/source/tool/features/NandDumper.c # rxtools/source/tool/features/TitleKeyDecrypt.c # rxtools/source/tool/features/downgradeapp.c # rxtools/source/tool/features/fileexplorer.c # rxtools/source/tool/features/nandtools.c # rxtools/source/tool/features/padgen.c # rxtools/source/tool/lib/jsmn # rxtools/source/tool/lib/menu.c
- Loading branch information
Showing
38 changed files
with
232 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2015-2016 The PASTA Team | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation | ||
* | ||
* This program is distributed in the hope that 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, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
OUTPUT_FORMAT("elf32-littlearm") | ||
OUTPUT_ARCH(arm) | ||
ENTRY(initStart) | ||
|
||
SECTIONS | ||
{ | ||
. = 0x23F00000; | ||
.text : | ||
{ | ||
KEEP(*(.text.start)) | ||
KEEP(*(.text.cstart)) | ||
*(.text*) | ||
} | ||
|
||
.rodata : { *(.rodata*) } | ||
.data : { *(.data*) } | ||
.bss : { *(.bss*) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (C) 2015-2016 The PASTA Team | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation | ||
* | ||
* This program is distributed in the hope that 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, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <lib/fatfs/ff.h> | ||
#include <lib/ui/draw.h> | ||
#include <lib/fs.h> | ||
|
||
__attribute__((section(".text.cstart"), noreturn)) void initStart() | ||
{ | ||
const uintptr_t p = 0x23E00000; | ||
const wchar_t *msg; | ||
UINT br; | ||
int r; | ||
FIL f; | ||
|
||
// Enable TMIO IRQ | ||
*(volatile uint32_t *)0x10001000 = 0x00010000; | ||
|
||
// Unknown register to fix mounting of SDMC | ||
*(volatile uint32_t *)0x10000020 = 0x340; | ||
|
||
if (!FSInit()) { | ||
msg = L"Failed to initialize FS"; | ||
goto fatal; | ||
} | ||
|
||
r = f_open(&f, L"" SYS_PATH "/tool.bin", FA_READ); | ||
if (r != FR_OK) { | ||
msg = L"Failed to open tool"; | ||
goto fatal; | ||
} | ||
|
||
r = f_read(&f, (void *)p, 0x100000, &br); | ||
if (r != FR_OK) { | ||
msg = L"Failed to read tool"; | ||
goto fatal; | ||
} | ||
|
||
f_close(&f); | ||
|
||
((void (*)())p)(); | ||
__builtin_unreachable(); | ||
|
||
fatal: | ||
DrawString(BOT_SCREEN, msg, | ||
BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK); | ||
while (1); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Copyright (C) 2016 The PASTA Team | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# version 2 as published by the Free Software Foundation | ||
# | ||
# This program is distributed in the hope that 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, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
||
.section .text.start | ||
.arm | ||
|
||
msr CPSR_c, #0xD3 @ Disable IRQ and FIQ and enter supervisor mode | ||
|
||
mov sp, #0x28000000 | ||
|
||
mov r0, #0x18000000 @ address: 0x18000000 | ||
orr r0, #0x2D @ size: 8M, enable | ||
mcr p15, 0, r0, c6, c0, 0 @ MPU area 0 | ||
|
||
ldr r0, =0x01FF801D @ address: 0x01FF8000, size: 32K, enable | ||
mcr p15, 0, r0, c6, c1, 0 @ MPU area 1 | ||
|
||
mov r0, #0x08000000 @ address 0x08000000 | ||
orr r0, #0x29 @ size: 2M, enable | ||
mcr p15, 0, r0, c6, c2, 0 @ MPU area 2 | ||
|
||
mov r0, #0x10000000 @ address: 0x1000000 | ||
orr r0, #0x21 @ size: 128K, enable | ||
mcr p15, 0, r0, c6, c3, 0 @ MPU area 3 | ||
|
||
ldr r0, =0x10100025 @ address: 10100000, size: 512K, enable | ||
mcr p15, 0, r0, c6, c4, 0 @ MPU area 4 | ||
|
||
mov r0, #0x20000000 @ address: 0x20000000 | ||
orr r0, #0x35 @ size: 128M, enable | ||
mcr p15, 0, r0, c6, c5, 0 @ MPU area 5 | ||
|
||
mov r0, #0 @ disable | ||
mcr p15, 0, r0, c6, c6, 0 @ MPU area 6 | ||
mcr p15, 0, r0, c6, c7, 0 @ MPU area 7 | ||
|
||
ldr r0, =0x00333333 @ permit reading and writing for all areas | ||
mcr p15, 0, r0, c5, c0, 2 @ write data permission bits | ||
|
||
mov r0, #0x00600000 @ permit reading for area 2 | ||
orr r0, #0x00000600 @ permit reading for area 5 | ||
mcr p15, 0, r0, c5, c0, 3 @ write instruction permission bits | ||
|
||
mov r0, #0x25 @ area 0, 2, and 5 | ||
mcr p15, 0, r0, c3, c0, 0 @ write data bufferable bits | ||
mcr p15, 0, r0, c2, c0, 0 @ write data cacheable bits | ||
|
||
mov r0, #0x24 @ area 2 and 5 | ||
mcr p15, 0, r12, c2, c0, 1 @ write instruction cacheable bits | ||
|
||
mov r0, #0x43000 @ enable ITCM, use alternative vector | ||
orr r0, #0x00005 @ enable instruction and data cache, enable MPU | ||
mcr p15, 0, r0, c1, c0, 0 @ write control register | ||
|
||
b initStart |
Oops, something went wrong.