Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions ee/kernel/src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

#define D(fmt, args...) printf("(%s:%s:%i):" #fmt, __FILE__, __FUNCTION__, __LINE__, ##args)

extern int _iop_reboot_count;
extern SifRpcClientData_t _fio_cd;
extern int _fio_init;
extern int _fio_block_mode;
extern int _fio_io_sema;
extern int _fio_completion_sema;
Expand All @@ -41,7 +39,6 @@ void _fio_intr();
SifRpcClientData_t _fio_cd;
int _fio_recv_data[512] __attribute__((aligned(64)));
int _fio_intr_data[32] __attribute__((aligned(64)));
int _fio_init = 0;
int _fio_block_mode;
int _fio_io_sema = -1;
int _fio_completion_sema = -1;
Expand All @@ -52,15 +49,16 @@ int fioInit(void)
{
int res;
ee_sema_t sema;
static int _rb_count = 0;

if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;

fioExit();
{
static int _rb_count;
extern int _iop_reboot_count;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
fioExit();
}
}

if (_fio_init)
if (_fio_cd.server)
return 0;

sceSifInitRpc(0);
Expand All @@ -87,7 +85,6 @@ int fioInit(void)
if (_fio_io_sema < 0)
return -E_LIB_SEMA_CREATE;

_fio_init = 1;
_fio_block_mode = FIO_WAIT;

return 0;
Expand Down Expand Up @@ -151,8 +148,7 @@ void fioSetBlockMode(int blocking)
#ifdef F_fio_exit
void fioExit(void)
{
if (_fio_init) {
_fio_init = 0;
if (_fio_cd.server) {
memset(&_fio_cd, 0, sizeof _fio_cd);
if (_fio_completion_sema >= 0) {
DeleteSema(_fio_completion_sema);
Expand Down
25 changes: 9 additions & 16 deletions ee/kernel/src/iopheap.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,24 @@

#include "iopheap.h"

#define IH_C_BOUND 0x0001

extern int _iop_reboot_count;
extern SifRpcClientData_t _ih_cd;
extern int _ih_caps;

#ifdef F_SifInitIopHeap
SifRpcClientData_t _ih_cd;
int _ih_caps = 0;

int SifInitIopHeap()
{
int res;

static int _rb_count = 0;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
memset(&_ih_cd, 0, sizeof _ih_cd);
_ih_caps = 0;
memset(&_ih_caps, 0, sizeof _ih_caps);
{
static int _rb_count;
extern int _iop_reboot_count;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
SifExitIopHeap();
}
}

if (_ih_caps)
if (_ih_cd.server)
return 0;

sceSifInitRpc(0);
Expand All @@ -52,16 +47,14 @@ int SifInitIopHeap()
if (res < 0)
return -E_SIF_RPC_BIND;

_ih_caps |= IH_C_BOUND;

return 0;
}
#endif

#ifdef F_SifExitIopHeap
void SifExitIopHeap()
{
_ih_caps = 0;
memset(&_ih_cd, 0, sizeof _ih_cd);
}
#endif

Expand Down
19 changes: 8 additions & 11 deletions ee/kernel/src/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,27 @@
#include <fcntl.h>
#include <unistd.h>

extern int _iop_reboot_count;
extern SifRpcClientData_t _lf_cd;
extern int _lf_init;

int _SifLoadElfPart(const char *path, const char *secname, t_ExecData *data, int fno);
int _SifLoadModuleBuffer(void *ptr, int arg_len, const char *args, int *modres);

#if defined(F_SifLoadFileInit)
SifRpcClientData_t _lf_cd;
int _lf_init = 0;

int SifLoadFileInit()
{
int res;
static int _rb_count = 0;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
memset(&_lf_cd, 0, sizeof _lf_cd);
_lf_init = 0;
{
static int _rb_count;
extern int _iop_reboot_count;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
SifLoadFileExit();
}
}

if (_lf_init)
if (_lf_cd.server)
return 0;

sceSifInitRpc(0);
Expand All @@ -58,15 +57,13 @@ int SifLoadFileInit()
if (res < 0)
return -E_SIF_RPC_BIND;

_lf_init = 1;
return 0;
}
#endif

#if defined(F_SifLoadFileExit)
void SifLoadFileExit()
{
_lf_init = 0;
memset(&_lf_cd, 0, sizeof _lf_cd);
}
#endif
Expand Down
26 changes: 12 additions & 14 deletions ee/kernel/src/sifcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ struct cmd_data
int *sregs;
} __attribute__((aligned(64)));

extern int _iop_reboot_count;
extern struct cmd_data _sif_cmd_data;
extern unsigned int _SifSendCmd(int cid, int mode, void *pkt, int pktsize, void *src,
void *dest, int size);
Expand Down Expand Up @@ -182,7 +181,6 @@ static SifCmdSysHandlerData_t sys_cmd_handlers[SYS_CMD_HANDLER_MAX];
static int sregs[32];

struct cmd_data _sif_cmd_data;
static int init = 0;
static int sif0_id = -1;

struct ca_pkt
Expand Down Expand Up @@ -218,17 +216,16 @@ void sceSifInitCmd(void)
{
static struct ca_pkt packet __attribute((aligned(64)));
int i;
static int _rb_count = 0;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
if (sif0_id >= 0) {
DisableDmac(DMAC_SIF0);
RemoveDmacHandler(DMAC_SIF0, sif0_id);
{
static int _rb_count;
extern int _iop_reboot_count;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
sceSifExitCmd();
}
init = 0;
}

if (init)
if (sif0_id >= 0)
return;

DI();
Expand Down Expand Up @@ -267,7 +264,6 @@ void sceSifInitCmd(void)
sif0_id = AddDmacHandler(DMAC_SIF0, &_SifCmdIntHandler, 0);
EnableDmac(DMAC_SIF0);

init = 1;

_sif_cmd_data.iopbuf = (void *)sceSifGetReg(SIF_SYSREG_SUBADDR);
if (_sif_cmd_data.iopbuf) {
Expand All @@ -293,9 +289,11 @@ void sceSifInitCmd(void)

void sceSifExitCmd(void)
{
DisableDmac(DMAC_SIF0);
RemoveDmacHandler(DMAC_SIF0, sif0_id);
init = 0;
if (sif0_id >= 0) {
DisableDmac(DMAC_SIF0);
RemoveDmacHandler(DMAC_SIF0, sif0_id);
sif0_id = -1;
}
}
#endif

Expand Down
14 changes: 8 additions & 6 deletions ee/kernel/src/sifrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ struct rpc_data
void *active_queue;
} __attribute__((aligned(64)));

extern int _iop_reboot_count;
extern struct rpc_data _sif_rpc_data;

void *_rpc_get_packet(struct rpc_data *rpc_data);
Expand Down Expand Up @@ -415,11 +414,14 @@ void sceSifInitRpc(int mode)

(void)mode;

static int _rb_count = 0;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
sceSifExitCmd();
init = 0;
{
static int _rb_count;
extern int _iop_reboot_count;
if (_rb_count != _iop_reboot_count) {
_rb_count = _iop_reboot_count;
sceSifExitCmd();
init = 0;
}
}

if (init)
Expand Down
Loading
Loading