Skip to content

Commit

Permalink
Merge pull request #566 from uyjulian/loadcore
Browse files Browse the repository at this point in the history
Implementation of loadcore module
  • Loading branch information
fjtrujy authored Mar 23, 2024
2 parents 0d472b2 + 253c77b commit 73f677d
Show file tree
Hide file tree
Showing 9 changed files with 1,708 additions and 2 deletions.
23 changes: 23 additions & 0 deletions iop/kernel/include/kerr.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
#define KE_NOTFOUND_HANDLER -105
#define KE_NO_TIMER -150
#define KE_ILLEGAL_TIMERID -151
#define KE_ILLEGAL_SOURCE -152
#define KE_ILLEGAL_PRESCALE -153
#define KE_TIMER_BUSY -154
#define KE_TIMER_NOT_SETUP -155
#define KE_TIMER_NOT_INUSE -156
#define KE_UNIT_USED -160
#define KE_UNIT_NOUSE -161
#define KE_NO_ROMDIR -162
Expand All @@ -39,6 +44,21 @@
#define KE_NOFILE -203
#define KE_FILEERR -204
#define KE_MEMINUSE -205
#define KE_ALREADY_STARTED -206
#define KE_NOT_STARTED -207
#define KE_ALREADY_STOPPED -208
#define KE_CAN_NOT_STOP -209
#define KE_NOT_STOPPED -210
#define KE_NOT_REMOVABLE -211
#define KE_LIBRARY_FOUND -212
#define KE_LIBRARY_NOTFOUND -213
#define KE_ILLEGAL_LIBRARY -214
#define KE_LIBRARY_INUSE -215
#define KE_ALREADY_STOPPING -216
#define KE_ILLEGAL_OFFSET -217
#define KE_ILLEGAL_POSITION -218
#define KE_ILLEGAL_ACCESS -219
#define KE_ILLEGAL_FLAG -220
#define KE_NO_MEMORY -400
#define KE_ILLEGAL_ATTR -401
#define KE_ILLEGAL_ENTRY -402
Expand Down Expand Up @@ -67,6 +87,9 @@
#define KE_WAIT_DELETE -425
#define KE_ILLEGAL_MEMBLOCK -426
#define KE_ILLEGAL_MEMSIZE -427
#define KE_ILLEGAL_SPADADDR -428
#define KE_SPAD_INUSE -429
#define KE_SPAD_NOT_INUSE -430
#define KE_ILLEGAL_TYPE -431
#define KE_ILLEGAL_SIZE -432

Expand Down
4 changes: 2 additions & 2 deletions iop/kernel/include/loadcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ void *QueryLibraryEntryTable(iop_library_t *library);
int * QueryBootMode(int mode);
void RegisterBootMode(iop_bootmode_t *b);

int LockLibraryClient(struct irx_export_table *export);
int UnLockLibraryClient(struct irx_export_table *export);
void LockLibraryClient(struct irx_export_table *export);
void UnLockLibraryClient(struct irx_export_table *export);

void RegisterModule(ModuleInfo_t *mi);
void ReleaseModule(ModuleInfo_t *mi);
Expand Down
1 change: 1 addition & 0 deletions iop/system/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SUBDIRS = \
ioman \
iomanx \
iopmgr \
loadcore \
loadfile \
modload \
mtapman \
Expand Down
16 changes: 16 additions & 0 deletions iop/system/loadcore/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.

IOP_BIN ?= loadcore.irx

IOP_OBJS = loadcore.o exports.o imports.o

include $(PS2SDKSRC)/Defs.make
include $(PS2SDKSRC)/iop/Rules.bin.make
include $(PS2SDKSRC)/iop/Rules.make
include $(PS2SDKSRC)/iop/Rules.release
17 changes: 17 additions & 0 deletions iop/system/loadcore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Module Manager

This module provides functions to manage IRX modules.

## Configurations

There are multiple configurations of this library, allowing the choice of
balancing between size, speed, and features.

* `loadcore` -> The recommended version.

## How to use this module in your program

In order to use this module in your program, you must integrate the module into
an IOPRP image, then load the image with `UDNL`.\
Using `LoadModule` or `LoadModuleBuffer` directly will not work, because the
module is already loaded at IOP boot.
33 changes: 33 additions & 0 deletions iop/system/loadcore/src/exports.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

DECLARE_EXPORT_TABLE(loadcore, 1, 3)
DECLARE_EXPORT(_start)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(GetLoadcoreInternalData)
DECLARE_EXPORT(FlushIcache)
DECLARE_EXPORT(FlushDcache)
DECLARE_EXPORT(RegisterLibraryEntries)
DECLARE_EXPORT(ReleaseLibraryEntries)
DECLARE_EXPORT(LinkLibraryEntries)
DECLARE_EXPORT(UnLinkLibraryEntries)
DECLARE_EXPORT(RegisterNonAutoLinkEntries)
DECLARE_EXPORT(QueryLibraryEntryTable)
DECLARE_EXPORT(QueryBootMode)
DECLARE_EXPORT(RegisterBootMode)
DECLARE_EXPORT(LockLibraryClient)
DECLARE_EXPORT(UnLockLibraryClient)
DECLARE_EXPORT(RegisterModule)
DECLARE_EXPORT(ReleaseModule)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(AddRebootNotifyHandler)
DECLARE_EXPORT(SetCacheCtrl)
DECLARE_EXPORT(ProbeExecutableObject)
DECLARE_EXPORT(LoadExecutableObject)
DECLARE_EXPORT(SearchModuleCBByAddr)
DECLARE_EXPORT(ApplyElfRelSection)
DECLARE_EXPORT(CopyModInfo)
DECLARE_EXPORT(SetRebootTimeLibraryHandlingMode)
END_EXPORT_TABLE

void _retonly() {}
8 changes: 8 additions & 0 deletions iop/system/loadcore/src/imports.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

sysmem_IMPORTS_start
I_AllocSysMemory
I_FreeSysMemory
I_QueryMemSize
I_QueryBlockTopAddress
I_QueryBlockSize
sysmem_IMPORTS_end
22 changes: 22 additions & 0 deletions iop/system/loadcore/src/irx_imports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# Defines all IRX imports.
*/

#ifndef IOP_IRX_IMPORTS_H
#define IOP_IRX_IMPORTS_H

#include <irx.h>

/* Please keep these in alphabetical order! */

#include <sysmem.h>

#endif /* IOP_IRX_IMPORTS_H */
Loading

0 comments on commit 73f677d

Please sign in to comment.