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 

user/kernel API how do identify them on the SDK API?

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



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Fri May 30, 2008 10:19 pm    Post subject: user/kernel API how do identify them on the SDK API? Reply with quote

Hi guys,

How can I know if a function I'm using runs in either kernel mode or user mode?

It would be nice to add it to docs in the .h files.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri May 30, 2008 11:08 pm    Post subject: Reply with quote

One quick way is look at the lib it's in - if the name ends in _driver, it's kernel mode.

libpspaudio.a - user
libpspaudio_driver.a - kernel

libpspctrl.a - user
libpspctrl_driver.a - kernel

libpspdisplay.a - user
libpspdisplay_driver.a - kernel

libpspge.a - user
libpspge_driver.a - kernel
Back to top
View user's profile Send private message AIM Address
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Sat May 31, 2008 2:38 am    Post subject: Reply with quote

Thanks, that's a good start, still related to the initial question but maybe a bit off topic, does anyone know how can i use the http://silverspring.lan.st doc,stubs information?

I see that there are some new functions decoded however there is no info on return values/arguments, is there a place to see it? or this hasn't been decoded yet?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
SilverSpring



Joined: 27 Feb 2007
Posts: 115

PostPosted: Sun Jun 01, 2008 3:48 pm    Post subject: Reply with quote

Yep look at the lib name. Some say ___ForUser and some say ___ForKernel

Eg.

IoFileMgrForUser
IoFileMgrForKernel

LoadExecForUser
LoadExecForKernel

If the libname start with sce then the ones with _driver at the end are kernel libs.

Eg.

sceCtrl
sceCtrl_driver

scePower
scePower_driver

If it doesnt have the _driver suffix then it's almost certainly a user lib.

Also almost all usermode functions have kernelmode equivalents.

Regarding the libdocs, I added the stubs with updated functions so you can add to the OBJS = in your makefile to use them.

They are new-style stubs but to be honest I never got the new-style stubs to work, only the old-style stubs.

Code:
prxtool -n libdoc.xml -u somemodule.prx


will create an old-style stub for somemodule.prx. Then just add to OBJS in your makefile.

Or alternatively you can create the stub from an individual module's xml. Download an xml, eg. http://silverspring.lan.st/1.5x/kd/i2c.xml and

Code:
prxtool -t i2c.xml


add sceI2c_driver.o to the OBJS and start using one of the functions in your app.

Regarding the prototype for a particular function, it's upto the dev to work out the prototype and proper usage if they want to use the function. The api is too large to fully document so it's upto each individual to work it out themselves. You don't need to create a .h file, as long as you pass the correct arguments that the function is expecting (though the compiler will throw you a warning).

The libdoc.xml can also be used in prxtool to resolve symbols for disassembly.

Code:
prxtool -n libdoc.xml -o somemodule.asm -w somemodule.prx


will disassemble somemodule.prx with the updated names added in the libdoc.

or alternatively

Code:
prxtool -n libdoc.xml -o somemodule.idc -c somemodule.prx


will create an IDC script to use in IDA disassembly.
Back to top
View user's profile Send private message Visit poster's website
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Sun Jun 01, 2008 6:57 pm    Post subject: Reply with quote

Thanks! Very valuable information.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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