 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
sauron_le_noir
Joined: 05 Jul 2008 Posts: 229
|
Posted: Tue Jun 09, 2009 3:08 am Post subject: Difference between kuKernelLoadModule and sceKernelLoadModul |
|
|
I have a prx 3.x that must load a kernel prx that export some functions that must
run in kernel mode.
In the samples that i have see some use kukernelloadmodule some use
scekernelloadmodule.
What is the difference between the two ? can scekernelloadmodule be use in a
prx 3.X (non kernel) to load a prx that must run in kernel mode or must i use the
kukernelloadmodule from the sdk oif Dark Alex. |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Tue Jun 09, 2009 4:33 am Post subject: |
|
|
kuKernelLoadModule (which must be called from a user PRX) is the same as calling sceKernelLoadModule from a kernel PRX. It will be as if your user mode PRX loaded the module using the kernel mode version of sceKernelLoadModule.
This is only needed for special modules that cannot be loaded from user mode (such as vshmain.prx and some other Sony modules). If you make a kernel mode PRX and need to load it from another user mode PRX then it is enough to call sceKernelLoadModule (which will call the user mode one, but it can load your kernel module). |
|
| Back to top |
|
 |
sauron_le_noir
Joined: 05 Jul 2008 Posts: 229
|
Posted: Tue Jun 09, 2009 4:43 am Post subject: |
|
|
torch i have made a kinfo.prx
PSP_MODULE_INFO("kinfo", 0x1006, 2, 0);
i have made a user program that load this kinfo.prx
| Code: |
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspmoduleinfo.h>
#include <kubridge.h>
#include "kinfo.h"
// #include "kernel.h"
#define printf pspDebugScreenPrintf
/* Define the module info section */
PSP_MODULE_INFO("info", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
PSP_HEAP_SIZE_KB(-64);
extern int ReadKey(int key, char *buffer);
extern int WriteKey(int key, char *buffer);
extern void GetMoboInfo(int* baryon, int* tachyon);
extern u64 GetFuseId();
int main(int argc, char *argv[])
{
int i;
pspDebugScreenInit();
int r = kuKernelLoadModule("kinfo.prx",0,NULL);
if (r < 0)
{
printf( "Error 0x%08X loading/starting kinfo.prx.\n", r);
sceKernelDelayThread(7000000);
}
sceKernelStartModule(r, 0, NULL, 0, NULL);
int bar,tac;
GetMoboInfo(&bar,&tac);
printf("baryon %x - Tachyon %x\n",bar,tac);
printf("Fuseid %#llx\n",GetFuseId());
char wifi_module_mac[512];
ReadKey(0x44, wifi_module_mac);
printf("Mac : ");
for(i=0;i<12;i++)
printf("%02X:",wifi_module_mac[i]);
sceKernelDelayThread(10000000);
return 0;
} |
it works with kukernelloadmodule but is this the good way to archive this ?
or must i use sceKernelLoadModule. ? avoiding using the 4.01M33 SDK |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Tue Jun 09, 2009 4:46 am Post subject: |
|
|
| sceKernelLoadModule is enough. Also, you are loading the kinfo module and using its exports from the same user module. Thus your stubs file for the user module must be changed for late binding (0x40090000 instead of 0x40000000). |
|
| Back to top |
|
 |
sauron_le_noir
Joined: 05 Jul 2008 Posts: 229
|
Posted: Tue Jun 09, 2009 4:59 am Post subject: |
|
|
was already the case because i use psp-build-export to generate it
| Code: |
release: all
psp-build-exports -s exports.exp
TARGET = kinfo
OBJS = main.o exports.o
INCDIR =
CFLAGS = -O2 -Os -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1
PSP_FW_VERSION = 500
LIBDIR =
LIBS =
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
|
so kinfo.S contains
| Code: |
.set noreorder
#include "pspstub.s"
STUB_START "kinfo",0x40090000,0x00040005
STUB_FUNC 0x4EB98A32,GetFuseId
STUB_FUNC 0x708AF9F6,GetMoboInfo
STUB_FUNC 0xBE861F44,ReadKey
STUB_FUNC 0x5E4510CC,WriteKey
STUB_END |
|
|
| 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
|