when I start a program the following way (tested on fat PS2 and slim PSTwo):
1. Free Mc Boot 1.8b
2. uLaunchELF v4.39
3. ps2link (current from SVN)
4. My program (IOP reset, all programs making IOP reset seem not to work):
Code: Select all
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <kernel.h>
#include <iopheap.h>
#include <loadfile.h>
#include <sbv_patches.h>
#include <sifrpc.h>
#include <iopcontrol.h>
#include <debug.h>
static char s_pUDNL [] __attribute__( ( section( ".data" ), aligned( 1 ) ) ) = "rom0:UDNL rom0:EELOADCNF";
int main()
{
u32 value;
u32 iopbuffer;
init_scr();
value = SifGetReg(0x80000000);
scr_printf("SifReg 0x80000000 = 0x%08x\n", value);
iopbuffer = value;
value = SifGetReg(0x80000002);
scr_printf("SifReg 0x80000002 = 0x%08x\n", value);
FlushCache(0);
SifExitIopHeap();
SifLoadFileExit();
SifExitRpc();
SifStopDma();
SifIopReset(s_pUDNL, 0);
while (SifIopSync());
scr_printf("Working %s:%d\n", __FILE__, __LINE__);
value = SifGetReg(0x80000000);
scr_printf("SifReg 0x80000000 = 0x%08x\n", value);
value = SifGetReg(0x80000002);
scr_printf("SifReg 0x80000002 = 0x%08x\n", value);
#if 0
SifSetReg(0x80000000, iopbuffer);
SifSetReg(0x80000002, 1);
#endif
SifInitRpc(0);
scr_printf("Working %s:%d\n", __FILE__, __LINE__);
sbv_patch_enable_lmb();
scr_printf("Working %s:%d\n", __FILE__, __LINE__);
sbv_patch_disable_prefix_check();
scr_printf("Working %s:%d\n", __FILE__, __LINE__);
return 0;
}
Code: Select all
while (!(SifGetReg(SIF_REG_SMFLAG) & 0x20000)) ;
When I replace "#if 0" in the above code by "#if 1", SifInitRpc() is executed normally. RPC is not usable after this.
As I have written a replacement PS2 kernel in the past, I believed that the SMFLAG stuff is not working (only working at system startup one time). I simulated it by setting the SifRegs manually in my PS2 replacement kernel. I now detected that this assumption is wrong.
I reverse engineered in the past that the SifReg 0x80000000 is only set by the IOP at startup via an SifSendCmd() (0x80000000 stores the pointer to the IOP buffer for RPC messages. 0x80000002 is set to 1 when RPC is initialised). The SifReg 0x80000000 and 0x80000002 is set to 0 after IOP reset (in both cases, working and not working loader). So I assume that IOP sets the register successfully to 0 while IOP reset. The conculsion is that the IOP has been crashed after IOP reset (or dead lock).
Maybe some hardware engine need to be disabled by ps2link, before starting an EE program.
I need a fix to be able to test kernelloader as it is used by slim PSTwo owners. Do somebody know why IOP is not reacting after reset when using Free McBoot?