well, this is mainly my code that i put together:
As u can see. I am trying to creat a new thread for TESTMODE and start the thread. Everything goes fine until StartThread is called.It returns -1 and launches the Ps2browser.Whats wrong. Someone plz help me outCode:int userThreadID = 0; static char userThreadStack[16*1024] __attribute__((aligned(16))); #define MAX_ARGS 16 #define MAX_ARGLEN 256 struct argData { int flag; // Contains thread id atm int argc; char *argv[MAX_ARGS]; } __attribute__((packed)) userArgs; const char *testmode = "rom0:TESTMODE"; t_ExecData elfdata; static int pkoLoadElf(char *path) { ee_thread_t th_attr; int ret=0; int pid; SifLoadElf(path, &elfdata); FlushCache(0); FlushCache(2); th_attr.func = (void *)elfdata.epc; th_attr.stack = userThreadStack; th_attr.stack_size = sizeof(userThreadStack); th_attr.gp_reg = (void *)elfdata.gp; th_attr.initial_priority = 64; pid = CreateThread(&th_attr); return pid; } int main(int argc, char **argv) { int pid=-1,ret; pkoLoadElf(testmode); FlushCache(0); FlushCache(2); userThreadID = pid; userArgs.argc=1; userArgs.argv[0]=testmode; userArgs.flag = (int)&userThreadID; ret = StartThread(userThreadID, &userArgs); //Returns -1 if (ret < 0) { LoadExecPS2("", 0, NULL); } SleepThread; return 0; }!!!


LinkBack URL
About LinkBacks
!!!




