PSP Toolchain+PSPSDK/relocation/user vs kernel mode/LoadModu

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

PSP Toolchain+PSPSDK/relocation/user vs kernel mode/LoadModu

Post by Shazz »

Hello,

Some dumb questions but as I did not find the answers by myself, time to ask...

1. Before using the toolchain and PSPSDK makefiles, we were using custom makefiles where we had to set :
- the relocation address : 0x08900000 (-Ttext 8900000)

As now, using PSPSDK makefiles, the LDFLAG doesn't need to specify this address, where is it hardcoded ? And if I want to change it, is adding -Ttext 8040000 for example enough ? (I tried but the execution is refused)

2. As the 1st version of Tyranid's KDumper showed, it was possible to make a custom crt0.s startup to provide "mains" entrypoints for user and kernel mode, is it still possible with the pspsdk (and how ?) or should we create a user thread for the kernel thread (as the loadmodule example shows) ?

3. Does sceKernelLoadModule() reboot the kernel as sceKernelLoadExec () does ?

4. Last (very) dumb question, what is the major reason to try as much as possible to execute PSP code in user mode (and not in kernel mode), is it just for safety reason ?

Thanks in advance to make my education :D
- TiTAN Art Division -
http://www.titandemo.org
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Re: PSP Toolchain+PSPSDK/relocation/user vs kernel mode/Load

Post by mrbrown »

Shazz wrote:As now, using PSPSDK makefiles, the LDFLAG doesn't need to specify this address, where is it hardcoded ? And if I want to change it, is adding -Ttext 8040000 for example enough ? (I tried but the execution is refused)
The default address is now handled in a linker script that's part of the toolchain. As far as setting your own address, we use psp-gcc to link so if you want to use "-Ttext 8040000" you have to tell GCC to pass it to the linker: "-Wl,-Ttext -Wl,8040000".
Shazz wrote:2. As the 1st version of Tyranid's KDumper showed, it was possible to make a custom crt0.s startup to provide "mains" entrypoints for user and kernel mode, is it still possible with the pspsdk (and how ?) or should we create a user thread for the kernel thread (as the loadmodule example shows) ?
We now have a system in place to make it easy to access kernel mode (to install patches, exception handlers, stdio rerouting, etc.) and still have your main() called in user mode. See this post for an example of how it's used. You can also check out Warren's usb/storage sample in PSPSDK SVN.
Shazz wrote:3. Does sceKernelLoadModule() reboot the kernel as sceKernelLoadExec () does ?
No.
Shazz wrote:4. Last (very) dumb question, what is the major reason to try as much as possible to execute PSP code in user mode (and not in kernel mode), is it just for safety reason ?
The main reason is safety. If you make a mistake, you don't want to crash or potentially brick your PSP. Running in user mode reduces the chances of doing so considerably.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Perfect ! You thought of all ! :D amazing

Thanks Mr Brown !
- TiTAN Art Division -
http://www.titandemo.org
Post Reply