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.
Difference between kuKernelLoadModule and sceKernelLoadModul
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
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).
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).
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
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
it works with kukernelloadmodule but is this the good way to archive this ?
or must i use sceKernelLoadModule. ? avoiding using the 4.01M33 SDK
PSP_MODULE_INFO("kinfo", 0x1006, 2, 0);
i have made a user program that load this kinfo.prx
Code: Select all
#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;
}
or must i use sceKernelLoadModule. ? avoiding using the 4.01M33 SDK
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
was already the case because i use psp-build-export to generate it
so kinfo.S contains
Code: Select all
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
Code: Select all
.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