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: Select all
#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;
}
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(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
Code: Select all
# 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: Select all
.set noreorder
#include "pspimport.s"
IMPORT_START "cfeDraw",0x00090000
IMPORT_FUNC "cfeDraw",0x291C6394,drawingStart
IMPORT_FUNC "cfeDraw",0xC2F24398,drawFont
IMPORT_FUNC "cfeDraw",0xF876BFC8,drawingEnd
Thanks in advance,
Cpasjuste.