 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Sat Sep 29, 2007 11:32 pm Post subject: Exporting functions from user mode module |
|
|
Hi, i'm having a little problem exporting some functions from an user mode module to be used by a kernel mode module. First question is it possible ? I think it should be since we can export kernel functions to be used by an user mode module. When i call one of the exported functions, the psp hang.
I want to do this because i want to use pspgu library in my kernel module, but i would have to change a lot of nids to do this on 3.71 kernel. So here is my main code :
| Code: |
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspgu.h>
#include <malloc.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pspgum.h>
#include "main.h"
PSP_MODULE_INFO("Cfe Export Module", 0, 1, 0);
PSP_NO_CREATE_MAIN_THREAD();
typedef struct
{
Color color;
float x, y, z;
} CFE2DVERTEX;
... ... ...
... ... ...
... ... ...
... ... ...
void drawingStart()
{
sceGuStart(GU_DIRECT, displayList);
}
void drawingEnd()
{
sceGuFinish();
sceGuSync(0, 0);
sceDisplayWaitVblankStart();
}
int module_start (SceSize argc, void* argp)
{
return 0;
}
int module_stop (SceSize args, void *argp)
{
return 0;
}
|
Here is my exports.exp file :
| Code: |
# 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(module_start)
PSP_EXPORT_VAR(module_info)
PSP_EXPORT_END
PSP_EXPORT_START(cfeDraw, 0, 0x4001)
PSP_EXPORT_FUNC(drawingStart)
PSP_EXPORT_FUNC(drawFont)
PSP_EXPORT_FUNC(drawingEnd)
PSP_EXPORT_END
PSP_END_EXPORTS
|
And finally my makefile :
| Code: |
# Target Name
TARGET = cfe_exports
# Source Files
OBJS = font_raw.o main.o exports.o
#EXPORTS = 1
# Use LIBC (Not selected by default?)
USE_PSPSDK_LIBC = 1
# Libraries
LIBS = -lpspgum -lpspgu -lm
# Misc.
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LDFLAGS =
LIBDIR =
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
|
Then in my kernel module, i add the exports needed with this code :
| Code: |
.set noreorder
#include "pspimport.s"
IMPORT_START "cfeDraw",0x00090000
IMPORT_FUNC "cfeDraw",0x291C6394,drawingStart
IMPORT_FUNC "cfeDraw",0xC2F24398,drawFont
IMPORT_FUNC "cfeDraw",0xF876BFC8,drawingEnd
|
I'm new in dealing with exports, so any help would be appreciated !
Thanks in advance,
Cpasjuste. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sat Sep 29, 2007 11:51 pm Post subject: |
|
|
| Nope it isn't possible at least to do it automatically, you cannot link user mode libraries into kernel mode modules. Best you are going to be able to do is pass the kernel module a big list of functions it can call, but I probably wouldn't recommend that either :) |
|
| Back to top |
|
 |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Sat Sep 29, 2007 11:51 pm Post subject: |
|
|
| Ok so i'v identified the first problem, and can't do a syscall by putting the flag "0x4001" in my exports. |
|
| Back to top |
|
 |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Sat Sep 29, 2007 11:53 pm Post subject: |
|
|
| Ho ok. Thanks for the fast reply, this save me some time. I go in another direction :) |
|
| 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
|