Browse Source

Add support for upcoming Luma and B9S versions

master
d0k3 4 years ago
parent
commit
0369452723
6 changed files with 44 additions and 17 deletions
  1. +0
    -4
      .gitmodules
  2. +2
    -2
      Makefile
  3. +0
    -1
      firmtool
  4. +4
    -2
      source/common/ui.h
  5. +14
    -2
      source/main.c
  6. +24
    -6
      source/start.s

+ 0
- 4
.gitmodules View File

@ -13,7 +13,3 @@
path = 2xrsa
url = https://github.com/b1l1s/2xrsa.git
ignore = dirty
[submodule "firmtool"]
path = firmtool
url = https://github.com/TuxSH/firmtool.git
ignore = dirty

+ 2
- 2
Makefile View File

@ -28,7 +28,7 @@ INCLUDES := source source/common source/font source/fs source/crypto source/fatf
ARCH := -mthumb -mthumb-interwork -flto
CFLAGS := -g -Wall -Wextra -Wpedantic -Wcast-align -Wno-main -O2\
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -std=gnu99\
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -std=gnu11\
$(ARCH)
CFLAGS += $(INCLUDE) -DARM9
@ -120,7 +120,7 @@ binary: common
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
firm: binary
@firmtool/firmtool build $(OUTPUT).firm -n 0x23F00000 -e 0 -D $(OUTPUT).bin -A 0x23F00000 -C NDMA -i
@firmtool build $(OUTPUT).firm -n 0x23F00000 -e 0 -D $(OUTPUT).bin -A 0x23F00000 -C NDMA -i
gateway: binary
@cp resources/LauncherTemplate.dat $(OUTPUT_D)/Launcher.dat


+ 0
- 1
firmtool

@ -1 +0,0 @@
Subproject commit 375e66c946968c8d39258b01038817a628b88e89

+ 4
- 2
source/common/ui.h View File

@ -52,8 +52,10 @@
#define COLOR_STD_BG COLOR_BLACK
#define COLOR_STD_FONT COLOR_WHITE
#define TOP_SCREEN (u8*)(*(u32*)0x23FFFE00)
#define BOT_SCREEN (u8*)(*(u32*)0x23FFFE08)
#define TOP_SCREEN top_screen
#define BOT_SCREEN bottom_screen
extern u8 *top_screen, *bottom_screen;
void ClearScreen(unsigned char *screen, int color);
void ClearScreenF(bool clear_top, bool clear_bottom, int color);


+ 14
- 2
source/main.c View File

@ -11,8 +11,21 @@ void Reboot()
}
int main()
u8 *top_screen, *bottom_screen;
void main(int argc, char** argv)
{
// Fetch the framebuffer addresses
if(argc >= 2) {
// newer entrypoints
u8 **fb = (u8 **)(void *)argv[1];
top_screen = fb[0];
bottom_screen = fb[2];
} else {
// outdated entrypoints
top_screen = (u8*)(*(u32*)0x23FFFE00);
bottom_screen = (u8*)(*(u32*)0x23FFFE08);
}
ClearScreenF(true, true, COLOR_STD_BG);
u32 ret = SafeB9SInstaller();
ShowInstallerStatus(); // update installer status one last time
@ -21,5 +34,4 @@ int main()
ClearScreenF(true, true, COLOR_STD_BG);
fs_deinit();
Reboot();
return 0;
}

+ 24
- 6
source/start.s View File

@ -65,6 +65,13 @@ _start_gw:
stmia r0, {r1,r2,r3}
@ framebuffers properly set
ldr r3, =0xFFFF0830 @ flush (clean & invalidate) entire dcache b9 func
blx r3
mov r3, #0
mcr p15, 0, r3, c7, c5, 0 @ invalidate I-cache
mov r2, #0
ldr r3, .entry
bx r3
@ -74,8 +81,18 @@ _start_gw:
.entry: .word 0x23F00000
_skip_gw:
mov r9, r0 @ argc
mov r10, r1 @ argv
ldr r4, =0xBEEF
lsl r2, #16
lsr r2, #16
cmp r2, r4 @ magic word
movne r9, #0
@ Disable caches / mpu
mrc p15, 0, r4, c1, c0, 0 @ read control register
bic r4, #(1<<16) @ - dtcm disable (mandated by the docs, before you change the dtcm's address)
bic r4, #(1<<12) @ - instruction cache disable
bic r4, #(1<<2) @ - data cache disable
bic r4, #(1<<0) @ - mpu disable
@ -91,10 +108,10 @@ _skip_gw:
strlt r2, [r0], #4
blt .bss_clr
@ Flush caches
@ Invalidate caches
mov r5, #0
mcr p15, 0, r5, c7, c5, 0 @ flush I-cache
mcr p15, 0, r5, c7, c6, 0 @ flush D-cache
mcr p15, 0, r5, c7, c5, 0 @ invalidate I-cache
mcr p15, 0, r5, c7, c6, 0 @ invalidate D-cache
mcr p15, 0, r5, c7, c10, 4 @ drain write buffer
@ Give read/write access to all the memory regions
@ -142,9 +159,10 @@ _skip_gw:
mov r1, #0x340
str r1, [r0]
mov sp, #0x27000000
ldr sp, =0x23F00000
blx main
b _start
mov r0, r9
mov r1, r10
b main
.pool

Loading…
Cancel
Save