forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SifinitRpc hangs when using Free McBoot 1.8b

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
Mega Man



Joined: 18 Jun 2005
Posts: 274

PostPosted: Thu May 14, 2009 6:20 am    Post subject: SifinitRpc hangs when using Free McBoot 1.8b Reply with quote

Hello,

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:

#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;
}


The call to SifInitRpc(0); hangs in SifInitCmd(). The following code causes the dead lock:
Code:

while (!(SifGetReg(SIF_REG_SMFLAG) & 0x20000)) ;


When I use a different boot method, it is working (replace step 1 by Sony's PS2 Linux and reload or the old memory card exploit). It is also working if my different boot method was started by the Free McBoot OSD.

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?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group