mirror of
https://github.com/d0k3/SafeB9SInstaller.git
synced 2025-06-26 21:52:46 +00:00
Compare commits
No commits in common. "master" and "v0.0.7" have entirely different histories.
@ -1 +1 @@
|
|||||||
Subproject commit d181cdb97d9ace244cf06845e914a59c1749aaaf
|
Subproject commit 8f783782ad2a1c1f6f6cdd60ba53ca3a91a26e29
|
8
Makefile
8
Makefile
@ -25,15 +25,15 @@ INCLUDES := source source/common source/font source/fs source/crypto source/fatf
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
ARCH := -mthumb -mthumb-interwork
|
ARCH := -mthumb -mthumb-interwork -flto
|
||||||
|
|
||||||
CFLAGS := -g -Wall -Wextra -Wpedantic -Wcast-align -Wno-main -O2\
|
CFLAGS := -g -Wall -Wextra -Wpedantic -Wcast-align -Wno-main -O2\
|
||||||
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -std=gnu11\
|
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -std=gnu11\
|
||||||
-fno-builtin-memcpy $(ARCH) -fdata-sections -ffunction-sections
|
$(ARCH)
|
||||||
|
|
||||||
CFLAGS += $(INCLUDE) -DARM9
|
CFLAGS += $(INCLUDE) -DARM9
|
||||||
|
|
||||||
CFLAGS += -DBUILD_NAME="\"$(TARGET) `date +'%Y/%m/%d'`\""
|
CFLAGS += -DBUILD_NAME="\"$(TARGET) (`date +'%Y/%m/%d'`)\""
|
||||||
|
|
||||||
ifeq ($(FONT),ORIG)
|
ifeq ($(FONT),ORIG)
|
||||||
CFLAGS += -DFONT_ORIGINAL
|
CFLAGS += -DFONT_ORIGINAL
|
||||||
@ -53,7 +53,7 @@ endif
|
|||||||
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||||
|
|
||||||
ASFLAGS := -g -mcpu=arm946e-s $(ARCH)
|
ASFLAGS := -g $(ARCH)
|
||||||
LDFLAGS = -T../link.ld -nostartfiles -g $(ARCH) -Wl,-Map,$(TARGET).map
|
LDFLAGS = -T../link.ld -nostartfiles -g $(ARCH) -Wl,-Map,$(TARGET).map
|
||||||
|
|
||||||
LIBS :=
|
LIBS :=
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
#ifndef OPEN_INSTALLER
|
#ifndef OPEN_INSTALLER
|
||||||
#define APP_TITLE "SafeB9SInstaller" " v" VERSION
|
#define APP_TITLE "SafeB9SInstaller" " v" VERSION
|
||||||
#define APP_URL "https://github.com/d0k3/SafeB9SInstaller"
|
#define APP_URL "https://github.com/d0k3/SafeB9SInstaller"
|
||||||
#define APP_USAGE "Usage instructions: https://%s.hacks.guide/", IS_DEVKIT ? "panda" : "3ds"
|
#define APP_USAGE "Usage instructions: https://%s3ds.guide/", IS_DEVKIT ? "dev." : ""
|
||||||
#else
|
#else
|
||||||
#define APP_TITLE "OpenFirmInstaller" " v" VERSION
|
#define APP_TITLE "OpenFirmInstaller" " v" VERSION
|
||||||
#define APP_URL "https://github.com/d0k3/SafeB9SInstaller"
|
#define APP_URL "https://github.com/d0k3/SafeB9SInstaller"
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
@ memcpy_arm946e-s - hand written reimplementation of memcpy to be sequential
|
|
||||||
@ Written in 2019 by luigoalma <luigoalma at gmail dot com>
|
|
||||||
@ To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
|
|
||||||
@ For a copy of CC0 Public Domain Dedication, see <https://creativecommons.org/publicdomain/zero/1.0/>.
|
|
||||||
.cpu arm946e-s
|
|
||||||
.arch armv5te
|
|
||||||
.arm
|
|
||||||
.section .text.memcpy, "ax", %progbits
|
|
||||||
.align 2
|
|
||||||
.global memcpy
|
|
||||||
.syntax unified
|
|
||||||
.type memcpy, %function
|
|
||||||
memcpy:
|
|
||||||
@ r0 = dest
|
|
||||||
@ r1 = src
|
|
||||||
@ r2 = length
|
|
||||||
@ check if length 0 and return if so
|
|
||||||
cmp r2, #0
|
|
||||||
bxeq lr
|
|
||||||
push {r0,r4-r9,lr}
|
|
||||||
@ pre-fetch data
|
|
||||||
pld [r1]
|
|
||||||
@ alignment check with word size
|
|
||||||
@ if not aligned but both are in the same misalignment, fix it up
|
|
||||||
@ otherwise jump to basic loop
|
|
||||||
orr r12, r0, r1
|
|
||||||
ands r12, r12, #3
|
|
||||||
beq .L1
|
|
||||||
and r4, r0, #3
|
|
||||||
and r5, r1, #3
|
|
||||||
cmp r4, r5
|
|
||||||
bne .L6
|
|
||||||
rsb r4, r4, #4
|
|
||||||
.L0:
|
|
||||||
ldrb r3, [r1], #1
|
|
||||||
strb r3, [r0], #1
|
|
||||||
subs r2, r2, #1
|
|
||||||
popeq {r0,r4-r9,pc}
|
|
||||||
subs r4, r4, #1
|
|
||||||
bne .L0
|
|
||||||
.L1:
|
|
||||||
@ check if length higher than 32
|
|
||||||
@ if so, do the 32 byte block copy loop,
|
|
||||||
@ until there's nothing left or remainder to copy is less than 32
|
|
||||||
movs r3, r2, LSR#5
|
|
||||||
beq .L3
|
|
||||||
.L2:
|
|
||||||
ldm r1!, {r4-r9,r12,lr}
|
|
||||||
stm r0!, {r4-r9,r12,lr}
|
|
||||||
subs r3, r3, #1
|
|
||||||
bne .L2
|
|
||||||
ands r2, r2, #0x1F
|
|
||||||
popeq {r0,r4-r9,pc}
|
|
||||||
.L3:
|
|
||||||
@ copy in word size the remaining data,
|
|
||||||
@ and finish off with basic loop if can't copy all by word size.
|
|
||||||
movs r3, r2, LSR#2
|
|
||||||
beq .L6
|
|
||||||
.L4:
|
|
||||||
ldr r12, [r1], #4
|
|
||||||
str r12, [r0], #4
|
|
||||||
subs r3, r3, #1
|
|
||||||
bne .L4
|
|
||||||
ands r2, r2, #0x3
|
|
||||||
.L5: @ the basic loop
|
|
||||||
popeq {r0,r4-r9,pc}
|
|
||||||
.L6:
|
|
||||||
ldrb r3, [r1], #1
|
|
||||||
strb r3, [r0], #1
|
|
||||||
subs r2, r2, #1
|
|
||||||
b .L5
|
|
||||||
.size memcpy, .-memcpy
|
|
@ -3,7 +3,6 @@
|
|||||||
#include "validator.h"
|
#include "validator.h"
|
||||||
#include "unittype.h"
|
#include "unittype.h"
|
||||||
#include "nand.h"
|
#include "nand.h"
|
||||||
#include "sdmmc.h"
|
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "qff.h"
|
#include "qff.h"
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
@ -18,8 +17,6 @@
|
|||||||
#define NAME_FIRMBACKUP INPUT_PATH "/firm%lu_enc.bak"
|
#define NAME_FIRMBACKUP INPUT_PATH "/firm%lu_enc.bak"
|
||||||
#define NAME_SECTORBACKUP INPUT_PATH "/sector0x96_enc.bak"
|
#define NAME_SECTORBACKUP INPUT_PATH "/sector0x96_enc.bak"
|
||||||
|
|
||||||
#define MAX_STAGE2_SIZE 0x89A00
|
|
||||||
|
|
||||||
#define STATUS_GREY -1
|
#define STATUS_GREY -1
|
||||||
#define STATUS_GREEN 0
|
#define STATUS_GREEN 0
|
||||||
#define STATUS_YELLOW 1
|
#define STATUS_YELLOW 1
|
||||||
@ -282,11 +279,6 @@ u32 SafeB9SInstaller(void) {
|
|||||||
ShowInstallerStatus();
|
ShowInstallerStatus();
|
||||||
}
|
}
|
||||||
if (ret != 0) break;
|
if (ret != 0) break;
|
||||||
uint8_t emptyStage2[MAX_STAGE2_SIZE]={0};
|
|
||||||
// Uninstall a9lh stage 2 always if firm flashed ok
|
|
||||||
// This prevents false positives in the event of cfw uninstall
|
|
||||||
ret = sdmmc_nand_writesectors(0x5C000, MAX_STAGE2_SIZE / 0x200, emptyStage2);
|
|
||||||
if (ret != 0) break;
|
|
||||||
if ((IS_A9LH && !IS_SIGHAX)) {
|
if ((IS_A9LH && !IS_SIGHAX)) {
|
||||||
snprintf(msgInstall, 64, "0x96 revert...");
|
snprintf(msgInstall, 64, "0x96 revert...");
|
||||||
ShowInstallerStatus();
|
ShowInstallerStatus();
|
||||||
@ -319,7 +311,7 @@ u32 SafeB9SInstaller(void) {
|
|||||||
|
|
||||||
|
|
||||||
// if we end up here: uhoh
|
// if we end up here: uhoh
|
||||||
ShowPrompt(false, APP_TITLE " failed!\nThis really should not have happened :/.");
|
ShowPrompt(false, "SafeB9SInstaller failed!\nThis really should not have happened :/.");
|
||||||
ShowPrompt(false, "Your system is now reverted to\nit's earlier state.\n \nDO NOT TURN OFF YOUR 3DS NOW!");
|
ShowPrompt(false, "Your system is now reverted to\nit's earlier state.\n \nDO NOT TURN OFF YOUR 3DS NOW!");
|
||||||
|
|
||||||
// try to revert to the earlier state
|
// try to revert to the earlier state
|
||||||
|
@ -29,9 +29,9 @@ void main(int argc, char** argv)
|
|||||||
ClearScreenF(true, true, COLOR_STD_BG);
|
ClearScreenF(true, true, COLOR_STD_BG);
|
||||||
u32 ret = SafeB9SInstaller();
|
u32 ret = SafeB9SInstaller();
|
||||||
ShowInstallerStatus(); // update installer status one last time
|
ShowInstallerStatus(); // update installer status one last time
|
||||||
fs_deinit();
|
|
||||||
if (ret) ShowPrompt(false, "SigHaxed FIRM was not installed!\nCheck lower screen for info.");
|
if (ret) ShowPrompt(false, "SigHaxed FIRM was not installed!\nCheck lower screen for info.");
|
||||||
else ShowPrompt(false, "SigHaxed FIRM install success!");
|
else ShowPrompt(false, "SigHaxed FIRM install success!");
|
||||||
ClearScreenF(true, true, COLOR_STD_BG);
|
ClearScreenF(true, true, COLOR_STD_BG);
|
||||||
|
fs_deinit();
|
||||||
Reboot();
|
Reboot();
|
||||||
}
|
}
|
||||||
|
@ -98,25 +98,6 @@ _skip_gw:
|
|||||||
bic r4, #(1<<0) @ - mpu disable
|
bic r4, #(1<<0) @ - mpu disable
|
||||||
mcr p15, 0, r4, c1, c0, 0 @ write control register
|
mcr p15, 0, r4, c1, c0, 0 @ write control register
|
||||||
|
|
||||||
@ Disable FIQs and IRQs
|
|
||||||
msr cpsr_cxsf, #0xD3 @ PSR_SVC_MODE | PSR_I | PSR_F
|
|
||||||
|
|
||||||
@ Disable and acknowledge interrupts
|
|
||||||
mov r2, #0x10000000
|
|
||||||
add r2, r2, #0x1000
|
|
||||||
mov r0, #0
|
|
||||||
mvn r1, #0 @ 0xFFFFFFFF
|
|
||||||
strd r0, r1, [r2] @ REG_IE/IF
|
|
||||||
|
|
||||||
@ Clear NDMA registers
|
|
||||||
add r2, r2, #0x1000 @ NDMA_GLOBAL_CNT, 0x10002000 = 0x10001000 + 0x1000
|
|
||||||
add r1, r2, #0xFC
|
|
||||||
add r2, r2, #0x1C
|
|
||||||
dma_clear_loop:
|
|
||||||
str r0, [r2], #0x1C
|
|
||||||
cmp r1, r2
|
|
||||||
bne dma_clear_loop
|
|
||||||
|
|
||||||
@ Clear bss
|
@ Clear bss
|
||||||
ldr r0, =__bss_start
|
ldr r0, =__bss_start
|
||||||
ldr r1, =__bss_end
|
ldr r1, =__bss_end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user