Skip to content

Commit 9dc793f

Browse files
committed
Load plugins in usermode lv2 module_start
For 4.84 REX only, can be easily ported to other fws. will look for `/dev_hdd0/game_plugin_bootloader.sprx` and start it. if you have exceptions enabled in shellcode, you'll get exceptions to find out any errors.
1 parent 208bb8d commit 9dc793f

File tree

4 files changed

+395
-4
lines changed

4 files changed

+395
-4
lines changed

8.3/4.84/REBUG/REX/SRC/lv2/include/lv2/patch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
#define MAKE_JUMP_VALUE(addr, to) ((0x12 << 26) | ((((to-(uint64_t)(addr))>>2)&0xFFFFFF) << 2))
4646
#define MAKE_CALL_VALUE(addr, to) ((0x12 << 26) | ((((to-(uint64_t)(addr))>>2)&0xFFFFFF) << 2)) | 1
4747

48+
#define READ_JUMP_OFFSET(value) ((int32_t)(((value) & 0x03FFFFFC) << 6) >> 6)
49+
#define READ_CALL_OFFSET(value) ((int32_t)((((value) & ~1) & 0x03FFFFFC) << 6) >> 6)
50+
4851
#define B(A) MAKE_JUMP_VALUE(0, A)
4952
#define BL(A) MAKE_CALL_VALUE(0, A)
5053

8.3/4.84/REBUG/REX/SRC/make_stage2.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if not exist ..\BIN mkdir ..\BIN
1212
cd stage2
1313

1414
rm -f *.o *.elf *.bin *.release *.debug *.map *.lzma ../lv2/src/*.o ../lv1/src/*.o ../debug/src/*.o
15-
make --silent all
15+
make all
1616
rm -f *.o *.elf *.map *.lzma ../lv2/src/*.o ../lv1/src/*.o ../debug/src/*.o
17-
18-
pause
17+
cd ..
18+
rem pause

8.3/4.84/REBUG/REX/SRC/stage2/common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212

1313
#undef printf
1414
#define printf _debug_printf
15+
#if DEBUG
16+
#define DPRINTF(...)
17+
#define DPRINTF2 _debug_printf
18+
#else
1519
#define DPRINTF _debug_printf
20+
#endif
1621
#define DPRINT_HEX debug_print_hex
1722
#define DPRINT_HEX_C debug_print_hex_c
1823

@@ -120,6 +125,7 @@ static INLINE void dump_stack_trace4(uint64_t *stack, unsigned int n)
120125
#define fatal(s) { while(1); }
121126
#define printf(...)
122127
#define DPRINTF(...)
128+
#define DPRINTF2(...)
123129
#define DPRINT_HEX(b, s)
124130
#define DPRINT_HEX_C(b, s)
125131
#define dump_stack_trace(n)

0 commit comments

Comments
 (0)