 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
jockyw2001
Joined: 29 Sep 2005 Posts: 339
|
Posted: Fri Feb 09, 2007 7:58 am Post subject: |
|
|
I've now succesfully built a user mode app which calls ME functions from a kernel mode prx. After the app has initialized the ME it calls scePowerSetClockFrequency() and then freezes. I removed that call and then the app freezes somewhere else, at this stage I don't know where. None of this problems occur if the app is a kernel mode module which statically links the ME routines.
Can anyone explain this behaviour?
EDIT: I can upload the application source code if someone requires it, it's pmpmod 202b with Raphael's subtitle patch. |
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Fri Feb 09, 2007 9:14 am Post subject: |
|
|
| jockyw2001 wrote: | I've now succesfully built a user mode app which calls ME functions from a kernel mode prx. After the app has initialized the ME it calls scePowerSetClockFrequency() and then freezes. I removed that call and then the app freezes somewhere else, at this stage I don't know where. None of this problems occur if the app is a kernel mode module which statically links the ME routines.
Can anyone explain this behaviour?
EDIT: I can upload the application source code if someone requires it, it's pmpmod 202b with Raphael's subtitle patch. |
Are you making your functions look like this?
| Code: |
int k1 = pspSdkSetK1(0);
code...;
pspSdkSetK1(k1);
return something;
|
well, the source would probably help more :p |
|
| Back to top |
|
 |
jockyw2001
Joined: 29 Sep 2005 Posts: 339
|
Posted: Sun Feb 11, 2007 8:39 pm Post subject: |
|
|
moonlight: Is that a suggestion for avoiding the freeze caused by calling scePowerSetClockFrequency() ? Is it just surrounding the call with it? Didn't find much about pspSdkSetK1() other than here:
http://forums.ps2dev.org/viewtopic.php?t=5866&highlight=pspsdksetk1
I found the cause for the other freezes: the ME can only access kernel mode memory and I was passing it function pointers which are in user mode memory. The solution is a self contained kernel mode ME prx which unfortunately isn't as small as originally intended.
By doing that I stumbled over another problem, exporting variables, which I will post in the "building PRXes" thread:
http://forums.ps2dev.org/viewtopic.php?t=4269
EDIT1:
moonlight: I thought about your reply, do you mean with pspSdkSetK1(0) I can run user mode functions in the ME like this?
| Code: | void me_function(int unused)
{
while (1) // ME runs this loop forever
{
while (nocache->start == 0); // me_start() breaks out of this loop by setting start=1 and end=0
nocache->start = 0;
nocache->k1 = pspSdkSetK1(0);
nocache->func(nocache->param); // run our function in ME
pspSdkSetK1(nocache->k1);
nocache->end = 1;
}
} |
EDIT2: I found some more info about pspSdkSetK1()
| Code: | Set the processors K1 register to a known value.
Note:
This function is for use in kernel mode syscall exports. The kernel sets the k1 register to indicate what mode called the function, i.e. whether it was directly called, was called via a syscall from a kernel thread or called via a syscall from a user thread. By setting k1 to 0 before doing anything in your code you can make the other functions think you are calling from a kernel thread and therefore disable numerous protections.
Parameters:
k1 - The k1 value to set
Returns:
The previous value of k1 |
|
|
| Back to top |
|
 |
|
|
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
|