pre-ipl: minor naming/comment improvement

This commit is contained in:
Arthur Blot 2023-02-03 14:11:50 +01:00
parent 0c7ef6e747
commit c517e4cee6
2 changed files with 12 additions and 12 deletions

View File

@ -15,8 +15,8 @@ u8 g_19C0[64] = {
// 2.60 ipl // 2.60 ipl
_start(...) // at 0x040F0000 _start(...) // at 0x040F0000
{ {
*(s32*)0xBC100050 |= 0x7000; *(s32*)0xBC100050 |= 0x7000; // bus clock enable for NAND (EMCDDR), NAND (EMCSM), APB
*(s32*)0xBC100078 |= 2; *(s32*)0xBC100078 |= 2; // IO enable EMCSM
sp = 0x40FFF00; sp = 0x40FFF00;
sub_040F0D70(0xBFC00040, 640, g_1980, g_19C0, 0x40F1AC0, 0x5040); // decrypt function sub_040F0D70(0xBFC00040, 640, g_1980, g_19C0, 0x40F1AC0, 0x5040); // decrypt function
t0 = 0x40F1AC0; t0 = 0x40F1AC0;
@ -34,7 +34,7 @@ _start(...) // at 0x040F0000
*(s32*)0xBFD00008 = 0x01000008; // jr $t0 *(s32*)0xBFD00008 = 0x01000008; // jr $t0
*(s32*)0xBFD0000C = 0; // nop *(s32*)0xBFD0000C = 0; // nop
pspSync(); pspSync();
*(s32*)0xBC10004C |= 2; *(s32*)0xBC10004C |= 2; // reset SC
// 00F0 // 00F0
while (true) { while (true) {
pspSync(); pspSync();
@ -46,7 +46,7 @@ _start(...) // at 0x040F0000
cont: cont:
pspCop0StateSet(COP0_STATE_STATUS, 0x60000000); pspCop0StateSet(COP0_STATE_STATUS, 0x60000000);
pspCop0StateSet(COP0_STATE_CAUSE, 0); pspCop0StateSet(COP0_STATE_CAUSE, 0);
*(s32*)0xBC100004 = 0xFFFFFFFF; *(s32*)0xBC100004 = 0xFFFFFFFF; // set all NMI flags
cacheStuff3(); cacheStuff3();
sp = 0x40FFF00; sp = 0x40FFF00;
sub_040F07C0(0x4000000, 0xE0000, 0x40F1AC0, 0); // gunzip sub_040F07C0(0x4000000, 0xE0000, 0x40F1AC0, 0); // gunzip

View File

@ -55,7 +55,7 @@ check_jigkick:
start_decrypt: start_decrypt:
lui $at, %hi(read_block) lui $at, %hi(read_block)
sw $t1, %lo(read_block)($at) sw $t1, %lo(read_block)($at)
sw $zr, %lo(page_counter)($at) sw $zr, %lo(ipl_block_idx)($at)
jalr $t2 jalr $t2
nop nop
move $s7, $zr move $s7, $zr
@ -64,8 +64,8 @@ decrypt_loop:
# read one page from NAND or MS to 0xBFD00000 # read one page from NAND or MS to 0xBFD00000
lui $t9, %hi(read_block) lui $t9, %hi(read_block)
lw $t9, %lo(read_block)($t9) lw $t9, %lo(read_block)($t9)
lui $a0, %hi(page_counter) lui $a0, %hi(ipl_block_idx)
lw $a0, %lo(page_counter)($a0) lw $a0, %lo(ipl_block_idx)($a0)
jalr $t9 jalr $t9
lui $a1, 0xBFD0 lui $a1, 0xBFD0
bltz $v0, infinite_loop bltz $v0, infinite_loop
@ -133,7 +133,7 @@ skip_xor_keys:
# each decrypted page starts with four words: # each decrypted page starts with four words:
# - one giving a destination address, which must be non-zero (otherwise no copy is performed) # - one giving a destination address, which must be non-zero (otherwise no copy is performed)
# - one giving the length of the decrypted data # - one giving the length of the decrypted data
# - one which is non-zero if it is the last block # - one which is non-zero if it is the last block and specifies the entrypoint address of the IPL
# - one which must be equal to the 'checksum' of the previous block, returned by memcpy, which is just the sum of the copied words (or 0 for the first loop) # - one which must be equal to the 'checksum' of the previous block, returned by memcpy, which is just the sum of the copied words (or 0 for the first loop)
# first check the checksum # first check the checksum
lui $s0, 0xBFD0 lui $s0, 0xBFD0
@ -184,11 +184,11 @@ after_copy:
nop nop
decrypt_another: decrypt_another:
lui $at, %hi(page_counter) lui $at, %hi(ipl_block_idx)
lw $t0, %lo(page_counter)($at) lw $t0, %lo(ipl_block_idx)($at)
addiu $t0, $t0, 1 addiu $t0, $t0, 1
b decrypt_loop b decrypt_loop
sw $t0, %lo(page_counter)($at) sw $t0, %lo(ipl_block_idx)($at)
infinite_loop: infinite_loop:
b infinite_loop b infinite_loop
@ -1066,7 +1066,7 @@ save_a0: # at 0x80010804, or 0x80010A84 for v3
read_block: # at 0x80010808, or 0x80010A88 for v3 read_block: # at 0x80010808, or 0x80010A88 for v3
.word 0 .word 0
page_counter: # at 0x8001080C, or 0x80010A8C for v3 ipl_block_idx: # at 0x8001080C, or 0x80010A8C for v3
.word 0 .word 0
nand_spare_data: # at 0x80010810, or 0x80010A90 for v3 nand_spare_data: # at 0x80010810, or 0x80010A90 for v3