moonlight wrote:Btw, this library... is to be used from another kernel module or from an user one? BEcause if it is gonna be used by an user one, you should use:
PSP_EXPORT_START(MyLib, 0, 0x4001)
My test program is a user mode app which calls exported functions from a kernel mode library fails with:
Code: Select all
host0:/> ./wifisimp03.prx
Failed to Load/Start module 'host0:/wifisimp03.prx' Error: 0x8002013C
The user app is linked with this MyLib.S
Code: Select all
.set noreorder
#include "pspstub.s"
STUB_START "MyLib",0x40010000,0x00060005
STUB_FUNC 0x6C0D2848,me_start
STUB_FUNC 0x972E503B,me_struct_init
STUB_FUNC 0x6DB328C6,me_sceKernelDcacheWritebackInvalidateAll
STUB_FUNC 0xE04FEB89,me_wait
STUB_FUNC 0x5BAC29CF,me_unused
STUB_FUNC 0x563FF2B2,getModuleInfo
STUB_END
and this is exports.exp of the kernel mode me library:
Code: Select all
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END
# Export our function
PSP_EXPORT_START(MyLib, 0, 0x4001)
PSP_EXPORT_FUNC_HASH(me_start)
PSP_EXPORT_FUNC_HASH(me_struct_init)
PSP_EXPORT_FUNC_HASH(me_sceKernelDcacheWritebackInvalidateAll)
PSP_EXPORT_FUNC_HASH(me_wait)
PSP_EXPORT_FUNC_HASH(me_unused)
PSP_EXPORT_FUNC_HASH(getModuleInfo)
PSP_EXPORT_END
PSP_END_EXPORTS
In the user app I start the kernel mode library with:
sceKernelLoadModule("host0:/memodule.prx", 0, NULL);
prxtool shows following modules in the kernel mode library:
Code: Select all
$ prxtool.exe -m memodule.prx
PRXTool v1.0 : (c) TyRaNiD 2k6
Built: Jan 21 2007 10:55:07
Loaded PRX memodule.prx successfully
Module information
Name: MEPRX
Attrib: 1000
Version: 1.1
GP: 0000CF00
Exports:
Export 0, Name syslib, Functions 1, Variables 1, flags 80000000
Export 1, Name MyLib, Functions 6, Variables 0, flags 40010000
Imports:
Import 0, Name IoFileMgrForUser, Functions 1, Variables 0, flags 40010000
Import 1, Name ModuleMgrForUser, Functions 1, Variables 0, flags 40010000
Import 2, Name SysMemUserForUser, Functions 4, Variables 0, flags 40000000
Import 3, Name ThreadManForUser, Functions 4, Variables 0, flags 40010000
Import 4, Name UtilsForUser, Functions 2, Variables 0, flags 40010000
Import 5, Name sceSysreg_driver, Functions 3, Variables 0, flags 00010000
Done
prxtool shows following modules in the user mode app:
Code: Select all
$ prxtool.exe -m wifisimp03.prx
PRXTool v1.0 : (c) TyRaNiD 2k6
Built: Jan 21 2007 10:55:07
Loaded PRX wifisimp03.prx successfully
Module information
Name: WIFI_TEST_APP
Attrib: 0000
Version: 1.1
GP: 000157C0
Exports:
Export 0, Name syslib, Functions 1, Variables 1, flags 80000000
Imports:
Import 0, Name sceMpegbase, Functions 1, Variables 0, flags 00090000
Import 1, Name sceUtility, Functions 2, Variables 0, flags 40010000
Import 2, Name MyLib, Functions 6, Variables 0, flags 40010000
Import 3, Name sceMpeg, Functions 10, Variables 0, flags 00090000
Import 4, Name sceDisplay, Functions 2, Variables 0, flags 40010000
Import 5, Name sceGe_user, Functions 1, Variables 0, flags 40010000
Import 6, Name sceNet, Functions 2, Variables 0, flags 00090000
Import 7, Name sceNetInet, Functions 12, Variables 0, flags 00090000
Import 8, Name sceNetApctl, Functions 6, Variables 0, flags 00090000
Import 9, Name sceNetResolver, Functions 2, Variables 0, flags 00090000
Import 10, Name sceUtility, Functions 2, Variables 0, flags 40010000
Import 11, Name IoFileMgrForUser, Functions 8, Variables 0, flags 40010000
Import 12, Name ModuleMgrForUser, Functions 3, Variables 0, flags 40010000
Import 13, Name StdioForUser, Functions 3, Variables 0, flags 40010000
Import 14, Name SysMemUserForUser, Functions 4, Variables 0, flags 40000000
Import 15, Name ThreadManForUser, Functions 12, Variables 0, flags 40010000
Import 16, Name UtilsForUser, Functions 1, Variables 0, flags 40010000
Import 17, Name LoadExecForUser, Functions 1, Variables 0, flags 40010000
Import 18, Name LoadCoreForKernel, Functions 1, Variables 0, flags 00010000
Import 19, Name UtilsForKernel, Functions 1, Variables 0, flags 00090000
Done
I'm on 3.03 oe-c
Any hints ?