| View previous topic :: View next topic |
| Author |
Message |
vegito-93
Joined: 18 Feb 2006 Posts: 12
|
Posted: Mon Apr 03, 2006 10:30 am Post subject: SifLoadElf problem |
|
|
k i tried a simple:
| Code: |
t_ExecData elfdata;
.............................//all the other code
SifLoadElf(path,&elfdata); |
and it returned -1.
Whats wrong
*EDIT*
ok i got around that but ran into another problem.
The complete code:
| Code: | 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;
} |
Everything goes fine until StartThread(); is called. HELP!!! |
|
| Back to top |
|
 |
vegito-93
Joined: 18 Feb 2006 Posts: 12
|
Posted: Sat Apr 08, 2006 8:39 am Post subject: |
|
|
| I really need to get this right. Anyone know what i am doing wrong. |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Sat Apr 08, 2006 11:56 am Post subject: |
|
|
You may want to start with error checking the sifloadelf call...
It looks like you ripped this code straight out of ps2link, except you removed all the error checking code... why? _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
vegito-93
Joined: 18 Feb 2006 Posts: 12
|
Posted: Sat Apr 08, 2006 12:22 pm Post subject: |
|
|
i had some error checks before but for some reason i removed them. I will put them on again.
*EDIT*
Well i just put all the checks back and for some reason it worked. Now if u don't mind i got a random. Might be crazy.
When an elf is runing, are all the comands, calls and everything else runing from the ee not the iop? |
|
| Back to top |
|
 |
|