ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
kernel.h File Reference
#include <stddef.h>
#include <stdarg.h>
#include <sifdma.h>
+ Include dependency graph for kernel.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ee_sema_t
 
struct  ee_thread_t
 
struct  ee_thread_status_t
 

Macros

#define DI   DIntr
 
#define EI   EIntr
 
#define ExitHandler()   asm volatile("sync\nei\n")
 
#define EE_SYNC()   __asm__ volatile ("sync")
 
#define EE_SYNCL()   __asm__ volatile ("sync.l")
 
#define EE_SYNCP()   __asm__ volatile ("sync.p")
 
#define UNCACHED_SEG(x)    ((void *)(((u32)(x)) | 0x20000000))
 
#define IS_UNCACHED_SEG(x)    (((u32)(x)) & 0x20000000)
 
#define UCAB_SEG(x)    ((void *)(((u32)(x)) | 0x30000000))
 
#define PUSHDATA(t, x, v, l)    *(t *)(x) = (v); (l) = sizeof(t)
 
#define POPDATA(t, x, v, l)    (v) = *(t *)(x); (l) = sizeof(t)
 
#define ALIGNED(x)   __attribute__((aligned((x))))
 
#define SetModuleGP()   ChangeGP(&_gp)
 
#define TH_SELF   0
 
#define MAX_THREADS   256
 
#define MAX_SEMAPHORES   256
 
#define MAX_PRIORITY   128
 
#define MAX_HANDLERS   128
 
#define MAX_ALARMS   64
 
#define WRITEBACK_DCACHE   0
 
#define INVALIDATE_DCACHE   1
 
#define INVALIDATE_ICACHE   2
 
#define INVALIDATE_CACHE   3
 
#define kINTC_GS   INTC_GS
 
#define kINTC_SBUS   INTC_SBUS
 
#define kINTC_VBLANK_START   INTC_VBLANK_S
 
#define kINTC_VBLANK_END   INTC_VBLANK_E
 
#define kINTC_VIF0   INTC_VIF0
 
#define kINTC_VIF1   INTC_VIF1
 
#define kINTC_VU0   INTC_VU0
 
#define kINTC_VU1   INTC_VU1
 
#define kINTC_IPU   INTC_IPU
 
#define kINTC_TIMER0   INTC_TIM0
 
#define kINTC_TIMER1   INTC_TIM1
 
#define INIT_DMAC   0x01
 
#define INIT_VU1   0x02
 
#define INIT_VIF1   0x04
 
#define INIT_GIF   0x08
 
#define INIT_VU0   0x10
 
#define INIT_VIF0   0x20
 
#define INIT_IPU   0x40
 
#define THS_RUN   0x01
 
#define THS_READY   0x02
 
#define THS_WAIT   0x04
 
#define THS_SUSPEND   0x08
 
#define THS_WAITSUSPEND   0x0c
 
#define THS_DORMANT   0x10
 
#define TSW_NONE   0
 
#define TSW_SLEEP   1
 
#define TSW_SEMA   2
 
#define CPU_DATA_CACHE   1
 
#define CPU_INSTRUCTION_CACHE   2
 

Enumerations

enum  {
  INTC_GS ,
  INTC_SBUS ,
  INTC_VBLANK_S ,
  INTC_VBLANK_E ,
  INTC_VIF0 ,
  INTC_VIF1 ,
  INTC_VU0 ,
  INTC_VU1 ,
  INTC_IPU ,
  INTC_TIM0 ,
  INTC_TIM1 ,
  INTC_TIM2 ,
  INTC_SFIFO = 13 ,
  INTC_VU0WD
}
 
enum  {
  DMAC_VIF0 ,
  DMAC_VIF1 ,
  DMAC_GIF ,
  DMAC_FROM_IPU ,
  DMAC_TO_IPU ,
  DMAC_SIF0 ,
  DMAC_SIF1 ,
  DMAC_SIF2 ,
  DMAC_FROM_SPR ,
  DMAC_TO_SPR ,
  DMAC_CIS = 13 ,
  DMAC_MEIS ,
  DMAC_BEIS
}
 
enum  CPU_CONFIG {
  CPU_CONFIG_ENABLE_DIE = 0 ,
  CPU_CONFIG_ENABLE_ICE ,
  CPU_CONFIG_ENABLE_DCE ,
  CPU_CONFIG_DISBLE_DIE ,
  CPU_CONFIG_DISBLE_ICE ,
  CPU_CONFIG_DISBLE_DCE
}
 

Functions

void * ChangeGP (void *gp)
 
void SetGP (void *gp)
 
void * GetGP (void)
 
static void nopdelay (void)
 
static int ee_get_opmode (void)
 
static int ee_set_opmode (u32 opmode)
 
static int ee_kmode_enter ()
 
static int ee_kmode_exit ()
 
void _InitSys (void)
 
void TerminateLibrary (void)
 
int InitThread (void)
 
s32 iWakeupThread (s32 thread_id)
 
s32 iRotateThreadReadyQueue (s32 priority)
 
s32 iSuspendThread (s32 thread_id)
 
void InitTLBFunctions (void)
 
void InitTLB (void)
 
void Exit (s32 exit_code)
 
s32 ExecPS2 (void *entry, void *gp, int num_args, char *args[])
 
void LoadExecPS2 (const char *filename, s32 num_args, char *args[])
 
void ExecOSD (int num_args, char *args[])
 
void InitAlarm (void)
 
void InitExecPS2 (void)
 
void InitOsd (void)
 
int PatchIsNeeded (void)
 
int DIntr (void)
 
int EIntr (void)
 
int EnableIntc (int intc)
 
int DisableIntc (int intc)
 
int EnableDmac (int dmac)
 
int DisableDmac (int dmac)
 
int iEnableIntc (int intc)
 
int iDisableIntc (int intc)
 
int iEnableDmac (int dmac)
 
int iDisableDmac (int dmac)
 
void SyncDCache (void *start, void *end)
 
void iSyncDCache (void *start, void *end)
 
void InvalidDCache (void *start, void *end)
 
void iInvalidDCache (void *start, void *end)
 
void ResetEE (u32 init_bitfield)
 
void SetGsCrt (s16 interlace, s16 pal_ntsc, s16 field)
 
void _Exit (s32 exit_code)
 
void _LoadExecPS2 (const char *filename, s32 num_args, char *args[])
 
s32 _ExecPS2 (void *entry, void *gp, int num_args, char *args[])
 
void RFU009 (u32 arg0, u32 arg1)
 
s32 AddSbusIntcHandler (s32 cause, void(*handler)(int call))
 
s32 RemoveSbusIntcHandler (s32 cause)
 
s32 Interrupt2Iop (s32 cause)
 
void SetVTLBRefillHandler (s32 handler_num, void *handler_func)
 
void SetVCommonHandler (s32 handler_num, void *handler_func)
 
void SetVInterruptHandler (s32 handler_num, void *handler_func)
 
s32 AddIntcHandler (s32 cause, s32(*handler_func)(s32 cause), s32 next)
 
s32 AddIntcHandler2 (s32 cause, s32(*handler_func)(s32 cause, void *arg, void *addr), s32 next, void *arg)
 
s32 RemoveIntcHandler (s32 cause, s32 handler_id)
 
s32 AddDmacHandler (s32 channel, s32(*handler)(s32 channel), s32 next)
 
s32 AddDmacHandler2 (s32 channel, s32(*handler)(s32 channel, void *arg, void *addr), s32 next, void *arg)
 
s32 RemoveDmacHandler (s32 channel, s32 handler_id)
 
s32 _EnableIntc (s32 cause)
 
s32 _DisableIntc (s32 cause)
 
s32 _EnableDmac (s32 channel)
 
s32 _DisableDmac (s32 channel)
 
s32 SetAlarm (u16 time, void(*callback)(s32 alarm_id, u16 time, void *common), void *common)
 
s32 _SetAlarm (u16 time, void(*callback)(s32 alarm_id, u16 time, void *common), void *common)
 
s32 ReleaseAlarm (s32 alarm_id)
 
s32 _ReleaseAlarm (s32 alarm_id)
 
s32 _iEnableIntc (s32 cause)
 
s32 _iDisableIntc (s32 cause)
 
s32 _iEnableDmac (s32 channel)
 
s32 _iDisableDmac (s32 channel)
 
s32 iSetAlarm (u16 time, void(*callback)(s32 alarm_id, u16 time, void *common), void *common)
 
s32 _iSetAlarm (u16 time, void(*callback)(s32 alarm_id, u16 time, void *common), void *common)
 
s32 iReleaseAlarm (s32 alarm_id)
 
s32 _iReleaseAlarm (s32 alarm_id)
 
s32 CreateThread (ee_thread_t *thread)
 
s32 DeleteThread (s32 thread_id)
 
s32 StartThread (s32 thread_id, void *args)
 
void ExitThread (void)
 
void ExitDeleteThread (void)
 
s32 TerminateThread (s32 thread_id)
 
s32 iTerminateThread (s32 thread_id)
 
s32 ChangeThreadPriority (s32 thread_id, s32 priority)
 
s32 iChangeThreadPriority (s32 thread_id, s32 priority)
 
s32 RotateThreadReadyQueue (s32 priority)
 
s32 _iRotateThreadReadyQueue (s32 priority)
 
s32 ReleaseWaitThread (s32 thread_id)
 
s32 iReleaseWaitThread (s32 thread_id)
 
s32 GetThreadId (void)
 
s32 _iGetThreadId (void)
 
s32 ReferThreadStatus (s32 thread_id, ee_thread_status_t *info)
 
s32 iReferThreadStatus (s32 thread_id, ee_thread_status_t *info)
 
s32 SleepThread (void)
 
s32 WakeupThread (s32 thread_id)
 
s32 _iWakeupThread (s32 thread_id)
 
s32 CancelWakeupThread (s32 thread_id)
 
s32 iCancelWakeupThread (s32 thread_id)
 
s32 SuspendThread (s32 thread_id)
 
s32 _iSuspendThread (s32 thread_id)
 
s32 ResumeThread (s32 thread_id)
 
s32 iResumeThread (s32 thread_id)
 
u8 RFU059 (void)
 
void * SetupThread (void *gp, void *stack, s32 stack_size, void *args, void *root_func)
 
void SetupHeap (void *heap_start, s32 heap_size)
 
void * EndOfHeap (void)
 
s32 CreateSema (ee_sema_t *sema)
 
s32 DeleteSema (s32 sema_id)
 
s32 SignalSema (s32 sema_id)
 
s32 iSignalSema (s32 sema_id)
 
s32 WaitSema (s32 sema_id)
 
s32 PollSema (s32 sema_id)
 
s32 iPollSema (s32 sema_id)
 
s32 ReferSemaStatus (s32 sema_id, ee_sema_t *sema)
 
s32 iReferSemaStatus (s32 sema_id, ee_sema_t *sema)
 
s32 iDeleteSema (s32 sema_id)
 
void SetOsdConfigParam (void *addr)
 
void GetOsdConfigParam (void *addr)
 
void GetGsHParam (void *addr1, void *addr2, void *addr3)
 
s32 GetGsVParam (void)
 
void SetGsHParam (void *addr1, void *addr2, void *addr3, void *addr4)
 
void SetGsVParam (s32 arg1)
 
int PutTLBEntry (unsigned int PageMask, unsigned int EntryHi, unsigned int EntryLo0, unsigned int EntryLo1)
 
int iPutTLBEntry (unsigned int PageMask, unsigned int EntryHi, unsigned int EntryLo0, unsigned int EntryLo1)
 
int _SetTLBEntry (unsigned int index, unsigned int PageMask, unsigned int EntryHi, unsigned int EntryLo0, unsigned int EntryLo1)
 
int iSetTLBEntry (unsigned int index, unsigned int PageMask, unsigned int EntryHi, unsigned int EntryLo0, unsigned int EntryLo1)
 
int GetTLBEntry (unsigned int index, unsigned int *PageMask, unsigned int *EntryHi, unsigned int *EntryLo0, unsigned int *EntryLo1)
 
int iGetTLBEntry (unsigned int index, unsigned int *PageMask, unsigned int *EntryHi, unsigned int *EntryLo0, unsigned int *EntryLo1)
 
int ProbeTLBEntry (unsigned int EntryHi, unsigned int *PageMask, unsigned int *EntryLo0, unsigned int *EntryLo1)
 
int iProbeTLBEntry (unsigned int EntryHi, unsigned int *PageMask, unsigned int *EntryLo0, unsigned int *EntryLo1)
 
int ExpandScratchPad (unsigned int page)
 
void EnableIntcHandler (u32 cause)
 
void iEnableIntcHandler (u32 cause)
 
void DisableIntcHandler (u32 cause)
 
void iDisableIntcHandler (u32 cause)
 
void EnableDmacHandler (u32 channel)
 
void iEnableDmacHandler (u32 channel)
 
void DisableDmacHandler (u32 channel)
 
void iDisableDmacHandler (u32 channel)
 
void KSeg0 (s32 arg1)
 
s32 EnableCache (s32 cache)
 
s32 DisableCache (s32 cache)
 
u32 GetCop0 (s32 reg_id)
 
void FlushCache (s32 operation)
 
u32 CpuConfig (u32 config)
 
u32 iGetCop0 (s32 reg_id)
 
void iFlushCache (s32 operation)
 
u32 iCpuConfig (u32 config)
 
void SetCPUTimerHandler (void(*handler)(void))
 
void SetCPUTimer (s32 compval)
 
void SetOsdConfigParam2 (void *config, s32 size, s32 offset)
 
void GetOsdConfigParam2 (void *config, s32 size, s32 offset)
 
u64 GsGetIMR (void)
 
u64 iGsGetIMR (void)
 
u64 GsPutIMR (u64 imr)
 
u64 iGsPutIMR (u64 imr)
 
void SetPgifHandler (void *handler)
 
void SetVSyncFlag (u32 *, u64 *)
 
void SetSyscall (s32 syscall_num, void *handler)
 
void SifStopDma (void)
 
s32 SifDmaStat (u32 id)
 
s32 iSifDmaStat (u32 id)
 
u32 SifSetDma (SifDmaTransfer_t *sdd, s32 len)
 
u32 iSifSetDma (SifDmaTransfer_t *sdd, s32 len)
 
void SifSetDChain (void)
 
void iSifSetDChain (void)
 
int SifSetReg (u32 register_num, int register_value)
 
int SifGetReg (u32 register_num)
 
void _ExecOSD (int num_args, char *args[])
 
s32 Deci2Call (s32, u32 *)
 
void PSMode (void)
 
s32 MachineType (void)
 
s32 GetMemorySize (void)
 
void _GetGsDxDyOffset (int mode, int *dx, int *dy, int *dw, int *dh)
 
int _InitTLB (void)
 
int SetMemoryMode (int mode)
 
void _SyncDCache (void *start, void *end)
 
void _InvalidDCache (void *start, void *end)
 
void abort (void)
 
void exit (int retval)
 
void _exit (int retval)
 
int * __errno (void)
 
void * GetSyscallHandler (int syscall_no)
 
void * GetExceptionHandler (int except_no)
 
void * GetInterruptHandler (int intr_no)
 
int kCopy (void *dest, const void *src, int size)
 
int kCopyBytes (void *dest, const void *src, int size)
 
int Copy (void *dest, const void *src, int size)
 
void setup (int syscall_num, void *handler)
 
void * GetEntryAddress (int syscall)
 

Variables

void * _gp
 
int errno
 

Detailed Description

EE Kernel prototypes

Definition in file kernel.h.

Macro Definition Documentation

◆ ALIGNED

#define ALIGNED (   x)    __attribute__((aligned((x))))

Definition at line 50 of file kernel.h.

◆ CPU_DATA_CACHE

#define CPU_DATA_CACHE   1

EnableCache & DisableCache options (multiple options may be specified)

Definition at line 279 of file kernel.h.

◆ CPU_INSTRUCTION_CACHE

#define CPU_INSTRUCTION_CACHE   2

Definition at line 280 of file kernel.h.

◆ DI

#define DI   DIntr

Definition at line 24 of file kernel.h.

◆ EE_SYNC

#define EE_SYNC ( )    __asm__ volatile ("sync")

Definition at line 31 of file kernel.h.

◆ EE_SYNCL

#define EE_SYNCL ( )    __asm__ volatile ("sync.l")

Definition at line 32 of file kernel.h.

◆ EE_SYNCP

#define EE_SYNCP ( )    __asm__ volatile ("sync.p")

Definition at line 33 of file kernel.h.

◆ EI

#define EI   EIntr

Definition at line 25 of file kernel.h.

◆ ExitHandler

#define ExitHandler ( )    asm volatile("sync\nei\n")

Definition at line 28 of file kernel.h.

◆ INIT_DMAC

#define INIT_DMAC   0x01

ResetEE argument bits

Definition at line 133 of file kernel.h.

◆ INIT_GIF

#define INIT_GIF   0x08

Definition at line 136 of file kernel.h.

◆ INIT_IPU

#define INIT_IPU   0x40

Definition at line 139 of file kernel.h.

◆ INIT_VIF0

#define INIT_VIF0   0x20

Definition at line 138 of file kernel.h.

◆ INIT_VIF1

#define INIT_VIF1   0x04

Definition at line 135 of file kernel.h.

◆ INIT_VU0

#define INIT_VU0   0x10

Definition at line 137 of file kernel.h.

◆ INIT_VU1

#define INIT_VU1   0x02

Definition at line 134 of file kernel.h.

◆ INVALIDATE_CACHE

#define INVALIDATE_CACHE   3

Definition at line 78 of file kernel.h.

◆ INVALIDATE_DCACHE

#define INVALIDATE_DCACHE   1

Definition at line 76 of file kernel.h.

◆ INVALIDATE_ICACHE

#define INVALIDATE_ICACHE   2

Definition at line 77 of file kernel.h.

◆ IS_UNCACHED_SEG

#define IS_UNCACHED_SEG (   x)     (((u32)(x)) & 0x20000000)

Definition at line 38 of file kernel.h.

◆ kINTC_GS

#define kINTC_GS   INTC_GS

Definition at line 101 of file kernel.h.

◆ kINTC_IPU

#define kINTC_IPU   INTC_IPU

Definition at line 109 of file kernel.h.

◆ kINTC_SBUS

#define kINTC_SBUS   INTC_SBUS

Definition at line 102 of file kernel.h.

◆ kINTC_TIMER0

#define kINTC_TIMER0   INTC_TIM0

Definition at line 110 of file kernel.h.

◆ kINTC_TIMER1

#define kINTC_TIMER1   INTC_TIM1

Definition at line 111 of file kernel.h.

◆ kINTC_VBLANK_END

#define kINTC_VBLANK_END   INTC_VBLANK_E

Definition at line 104 of file kernel.h.

◆ kINTC_VBLANK_START

#define kINTC_VBLANK_START   INTC_VBLANK_S

Definition at line 103 of file kernel.h.

◆ kINTC_VIF0

#define kINTC_VIF0   INTC_VIF0

Definition at line 105 of file kernel.h.

◆ kINTC_VIF1

#define kINTC_VIF1   INTC_VIF1

Definition at line 106 of file kernel.h.

◆ kINTC_VU0

#define kINTC_VU0   INTC_VU0

Definition at line 107 of file kernel.h.

◆ kINTC_VU1

#define kINTC_VU1   INTC_VU1

Definition at line 108 of file kernel.h.

◆ MAX_ALARMS

#define MAX_ALARMS   64

Definition at line 72 of file kernel.h.

◆ MAX_HANDLERS

#define MAX_HANDLERS   128

Definition at line 71 of file kernel.h.

◆ MAX_PRIORITY

#define MAX_PRIORITY   128

Definition at line 70 of file kernel.h.

◆ MAX_SEMAPHORES

#define MAX_SEMAPHORES   256

Definition at line 69 of file kernel.h.

◆ MAX_THREADS

#define MAX_THREADS   256

Limits

Definition at line 68 of file kernel.h.

◆ POPDATA

#define POPDATA (   t,
  x,
  v,
 
)     (v) = *(t *)(x); (l) = sizeof(t)

Definition at line 47 of file kernel.h.

◆ PUSHDATA

#define PUSHDATA (   t,
  x,
  v,
 
)     *(t *)(x) = (v); (l) = sizeof(t)

Definition at line 44 of file kernel.h.

◆ SetModuleGP

#define SetModuleGP ( )    ChangeGP(&_gp)

Definition at line 58 of file kernel.h.

◆ TH_SELF

#define TH_SELF   0

Special thread ID for referring to the running thread. Unlike the IOP kernel, this is only supported by ReferThreadStatus() and ChangeThreadPriority(). It can also be used by the iWakeupThread() syscall. But because the libkernel patch may call WakeupThread() to avoid the defect within iWakeupThread() that prevents the running thread from being woken up, THS_SELF should not be used with iWakeupThread().

Definition at line 65 of file kernel.h.

◆ THS_DORMANT

#define THS_DORMANT   0x10

Definition at line 244 of file kernel.h.

◆ THS_READY

#define THS_READY   0x02

Definition at line 240 of file kernel.h.

◆ THS_RUN

#define THS_RUN   0x01

Thread status

Definition at line 239 of file kernel.h.

◆ THS_SUSPEND

#define THS_SUSPEND   0x08

Definition at line 242 of file kernel.h.

◆ THS_WAIT

#define THS_WAIT   0x04

Definition at line 241 of file kernel.h.

◆ THS_WAITSUSPEND

#define THS_WAITSUSPEND   0x0c

Definition at line 243 of file kernel.h.

◆ TSW_NONE

#define TSW_NONE   0

Thread WAIT Status

Definition at line 247 of file kernel.h.

◆ TSW_SEMA

#define TSW_SEMA   2

Definition at line 249 of file kernel.h.

◆ TSW_SLEEP

#define TSW_SLEEP   1

Definition at line 248 of file kernel.h.

◆ UCAB_SEG

#define UCAB_SEG (   x)     ((void *)(((u32)(x)) | 0x30000000))

Definition at line 41 of file kernel.h.

◆ UNCACHED_SEG

#define UNCACHED_SEG (   x)     ((void *)(((u32)(x)) | 0x20000000))

Definition at line 35 of file kernel.h.

◆ WRITEBACK_DCACHE

#define WRITEBACK_DCACHE   0

Modes for FlushCache

Definition at line 75 of file kernel.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

EE Interrupt Controller (INTC) interrupt numbers

Enumerator
INTC_GS 
INTC_SBUS 
INTC_VBLANK_S 
INTC_VBLANK_E 
INTC_VIF0 
INTC_VIF1 
INTC_VU0 
INTC_VU1 
INTC_IPU 
INTC_TIM0 
INTC_TIM1 
INTC_TIM2 
INTC_SFIFO 
INTC_VU0WD 

Definition at line 81 of file kernel.h.

82 {
83  INTC_GS,
84  INTC_SBUS,
87  INTC_VIF0,
88  INTC_VIF1,
89  INTC_VU0,
90  INTC_VU1,
91  INTC_IPU,
92  INTC_TIM0,
93  INTC_TIM1,
94  INTC_TIM2,
95 // INTC_TIM3, //Reserved by the EE kernel for alarms (do not use)
96  INTC_SFIFO = 13, //Error encountered during SFIFO transfer
97  INTC_VU0WD //VU0 WatchDog; ForceBreak is sent to VU0 if left in RUN state for extended periods of time.
98 };
@ INTC_VIF0
Definition: kernel.h:87
@ INTC_VIF1
Definition: kernel.h:88
@ INTC_SFIFO
Definition: kernel.h:96
@ INTC_SBUS
Definition: kernel.h:84
@ INTC_TIM2
Definition: kernel.h:94
@ INTC_VU0
Definition: kernel.h:89
@ INTC_VU1
Definition: kernel.h:90
@ INTC_VBLANK_S
Definition: kernel.h:85
@ INTC_GS
Definition: kernel.h:83
@ INTC_VU0WD
Definition: kernel.h:97
@ INTC_TIM1
Definition: kernel.h:93
@ INTC_IPU
Definition: kernel.h:91
@ INTC_VBLANK_E
Definition: kernel.h:86
@ INTC_TIM0
Definition: kernel.h:92

◆ anonymous enum

anonymous enum

EE Direct Memory Access Controller (DMAC) interrupt numbers

Enumerator
DMAC_VIF0 
DMAC_VIF1 
DMAC_GIF 
DMAC_FROM_IPU 
DMAC_TO_IPU 
DMAC_SIF0 
DMAC_SIF1 
DMAC_SIF2 
DMAC_FROM_SPR 
DMAC_TO_SPR 
DMAC_CIS 
DMAC_MEIS 
DMAC_BEIS 

Definition at line 114 of file kernel.h.

115 {
116  DMAC_VIF0,
117  DMAC_VIF1,
118  DMAC_GIF,
120  DMAC_TO_IPU,
121  DMAC_SIF0,
122  DMAC_SIF1,
123  DMAC_SIF2,
125  DMAC_TO_SPR,
126 
127  DMAC_CIS = 13, //Channel interrupt
128  DMAC_MEIS, //MemFIFO empty interrupt
129  DMAC_BEIS, //Bus error interrupt
130 };
@ DMAC_CIS
Definition: kernel.h:127
@ DMAC_FROM_IPU
Definition: kernel.h:119
@ DMAC_SIF1
Definition: kernel.h:122
@ DMAC_FROM_SPR
Definition: kernel.h:124
@ DMAC_SIF2
Definition: kernel.h:123
@ DMAC_SIF0
Definition: kernel.h:121
@ DMAC_TO_SPR
Definition: kernel.h:125
@ DMAC_VIF1
Definition: kernel.h:117
@ DMAC_GIF
Definition: kernel.h:118
@ DMAC_TO_IPU
Definition: kernel.h:120
@ DMAC_MEIS
Definition: kernel.h:128
@ DMAC_BEIS
Definition: kernel.h:129
@ DMAC_VIF0
Definition: kernel.h:116

◆ CPU_CONFIG

enum CPU_CONFIG

CpuConfig options

Enumerator
CPU_CONFIG_ENABLE_DIE 
CPU_CONFIG_ENABLE_ICE 
CPU_CONFIG_ENABLE_DCE 
CPU_CONFIG_DISBLE_DIE 
CPU_CONFIG_DISBLE_ICE 
CPU_CONFIG_DISBLE_DCE 

Definition at line 269 of file kernel.h.

269  {
270  CPU_CONFIG_ENABLE_DIE = 0, //Enable Dual Issue
271  CPU_CONFIG_ENABLE_ICE, //Enable Instruction Cache
272  CPU_CONFIG_ENABLE_DCE, //Enable Data Cache
273  CPU_CONFIG_DISBLE_DIE, //Disable Dual Issue
274  CPU_CONFIG_DISBLE_ICE, //Disable Instruction Cache
275  CPU_CONFIG_DISBLE_DCE //Disable Data Cache
276 };
@ CPU_CONFIG_ENABLE_ICE
Definition: kernel.h:271
@ CPU_CONFIG_DISBLE_ICE
Definition: kernel.h:274
@ CPU_CONFIG_ENABLE_DIE
Definition: kernel.h:270
@ CPU_CONFIG_ENABLE_DCE
Definition: kernel.h:272
@ CPU_CONFIG_DISBLE_DCE
Definition: kernel.h:275
@ CPU_CONFIG_DISBLE_DIE
Definition: kernel.h:273

Function Documentation

◆ __errno()

int* __errno ( void  )

◆ _DisableDmac()

s32 _DisableDmac ( s32  channel)

◆ _DisableIntc()

s32 _DisableIntc ( s32  cause)

Referenced by main().

◆ _EnableDmac()

s32 _EnableDmac ( s32  channel)

◆ _EnableIntc()

s32 _EnableIntc ( s32  cause)

Referenced by main().

◆ _ExecOSD()

void _ExecOSD ( int  num_args,
char *  args[] 
)

◆ _ExecPS2()

s32 _ExecPS2 ( void *  entry,
void *  gp,
int  num_args,
char *  args[] 
)

◆ _exit()

void _exit ( int  retval)

Referenced by abort(), and exit().

◆ _Exit()

void _Exit ( s32  exit_code)

◆ _GetGsDxDyOffset()

void _GetGsDxDyOffset ( int  mode,
int *  dx,
int *  dy,
int *  dw,
int *  dh 
)

Referenced by GsSetDefaultDisplayEnv().

◆ _iDisableDmac()

s32 _iDisableDmac ( s32  channel)

◆ _iDisableIntc()

s32 _iDisableIntc ( s32  cause)

◆ _iEnableDmac()

s32 _iEnableDmac ( s32  channel)

◆ _iEnableIntc()

s32 _iEnableIntc ( s32  cause)

◆ _iGetThreadId()

s32 _iGetThreadId ( void  )

◆ _InitSys()

void _InitSys ( void  )

◆ _InitTLB()

int _InitTLB ( void  )

◆ _InvalidDCache()

void _InvalidDCache ( void *  start,
void *  end 
)

◆ _iReleaseAlarm()

s32 _iReleaseAlarm ( s32  alarm_id)

◆ _iRotateThreadReadyQueue()

s32 _iRotateThreadReadyQueue ( s32  priority)

◆ _iSetAlarm()

s32 _iSetAlarm ( u16  time,
void(*)(s32 alarm_id, u16 time, void *common)  callback,
void *  common 
)

◆ _iSuspendThread()

s32 _iSuspendThread ( s32  thread_id)

◆ _iWakeupThread()

s32 _iWakeupThread ( s32  thread_id)

◆ _LoadExecPS2()

void _LoadExecPS2 ( const char *  filename,
s32  num_args,
char *  args[] 
)

◆ _ReleaseAlarm()

s32 _ReleaseAlarm ( s32  alarm_id)

◆ _SetAlarm()

s32 _SetAlarm ( u16  time,
void(*)(s32 alarm_id, u16 time, void *common)  callback,
void *  common 
)

◆ _SetTLBEntry()

int _SetTLBEntry ( unsigned int  index,
unsigned int  PageMask,
unsigned int  EntryHi,
unsigned int  EntryLo0,
unsigned int  EntryLo1 
)

Referenced by InitTLB32MB().

◆ _SyncDCache()

void _SyncDCache ( void *  start,
void *  end 
)

◆ abort()

void abort ( void  )

Definition at line 16 of file terminate.c.

17 {
18  printf("Program aborted.\n");
19 
20  while (1)
21  _exit(1);
22 }
void _exit(int retval)

References _exit().

◆ AddDmacHandler()

s32 AddDmacHandler ( s32  channel,
s32(*)(s32 channel)  handler,
s32  next 
)

Referenced by dma_channel_initialize().

◆ AddDmacHandler2()

s32 AddDmacHandler2 ( s32  channel,
s32(*)(s32 channel, void *arg, void *addr)  handler,
s32  next,
void *  arg 
)

◆ AddIntcHandler()

s32 AddIntcHandler ( s32  cause,
s32(*)(s32 cause)  handler_func,
s32  next 
)

Referenced by graph_add_vsync_handler(), and main().

◆ AddIntcHandler2()

s32 AddIntcHandler2 ( s32  cause,
s32(*)(s32 cause, void *arg, void *addr)  handler_func,
s32  next,
void *  arg 
)

◆ AddSbusIntcHandler()

s32 AddSbusIntcHandler ( s32  cause,
void(*)(int call)  handler 
)

◆ CancelWakeupThread()

s32 CancelWakeupThread ( s32  thread_id)

◆ ChangeGP()

void* ChangeGP ( void *  gp)

Referenced by Intc12Handler().

◆ ChangeThreadPriority()

s32 ChangeThreadPriority ( s32  thread_id,
s32  priority 
)

◆ Copy()

int Copy ( void *  dest,
const void *  src,
int  size 
)

◆ CpuConfig()

u32 CpuConfig ( u32  config)

◆ CreateSema()

◆ CreateThread()

◆ Deci2Call()

s32 Deci2Call ( s32  ,
u32  
)

◆ DeleteSema()

◆ DeleteThread()

s32 DeleteThread ( s32  thread_id)

◆ DIntr()

◆ DisableCache()

s32 DisableCache ( s32  cache)

◆ DisableDmac()

int DisableDmac ( int  dmac)

Referenced by dma_channel_shutdown().

◆ DisableDmacHandler()

void DisableDmacHandler ( u32  channel)

◆ DisableIntc()

int DisableIntc ( int  intc)

◆ DisableIntcHandler()

void DisableIntcHandler ( u32  cause)

◆ ee_get_opmode()

static int ee_get_opmode ( void  )
inlinestatic

Definition at line 150 of file kernel.h.

151 {
152  u32 status;
153 
154  __asm__ volatile (
155  ".set\tpush\n\t" \
156  ".set\tnoreorder\n\t" \
157  "mfc0\t%0, $12\n\t" \
158  ".set\tpop\n\t" : "=r" (status));
159 
160  return((status >> 3) & 3);
161 }
unsigned int u32
Definition: tamtypes.h:30

◆ ee_kmode_enter()

static int ee_kmode_enter ( )
inlinestatic

Definition at line 181 of file kernel.h.

182 {
183  u32 status, mask;
184 
185  __asm__ volatile (
186  ".set\tpush\n\t" \
187  ".set\tnoreorder\n\t" \
188  "mfc0\t%0, $12\n\t" \
189  "li\t%1, 0xffffffe7\n\t" \
190  "and\t%0, %1\n\t" \
191  "mtc0\t%0, $12\n\t" \
192  "sync.p\n\t"
193  ".set\tpop\n\t" : "=r" (status), "=r" (mask));
194 
195  return status;
196 }

Referenced by iop_readwrite(), PS2CamReadPacket(), sbv_patch_user_mem_clear(), sior_rpc_server(), smem_read(), and smem_write().

◆ ee_kmode_exit()

static int ee_kmode_exit ( )
inlinestatic

Definition at line 198 of file kernel.h.

199 {
200  int status;
201 
202  __asm__ volatile (
203  ".set\tpush\n\t" \
204  ".set\tnoreorder\n\t" \
205  "mfc0\t%0, $12\n\t" \
206  "ori\t%0, 0x10\n\t" \
207  "mtc0\t%0, $12\n\t" \
208  "sync.p\n\t" \
209  ".set\tpop\n\t" : "=r" (status));
210 
211  return status;
212 }

Referenced by iop_readwrite(), PS2CamReadPacket(), sbv_patch_user_mem_clear(), sior_rpc_server(), smem_read(), and smem_write().

◆ ee_set_opmode()

static int ee_set_opmode ( u32  opmode)
inlinestatic

Definition at line 163 of file kernel.h.

164 {
165  u32 status, mask;
166 
167  __asm__ volatile (
168  ".set\tpush\n\t" \
169  ".set\tnoreorder\n\t" \
170  "mfc0\t%0, $12\n\t" \
171  "li\t%1, 0xffffffe7\n\t" \
172  "and\t%0, %1\n\t" \
173  "or\t%0, %2\n\t" \
174  "mtc0\t%0, $12\n\t" \
175  "sync.p\n\t"
176  ".set\tpop\n\t" : "=r" (status), "=r" (mask) : "r" (opmode));
177 
178  return((status >> 3) & 3);
179 }

Referenced by ee_dbg_install(), and ee_dbg_remove().

◆ EIntr()

◆ EnableCache()

s32 EnableCache ( s32  cache)

◆ EnableDmac()

int EnableDmac ( int  dmac)

Referenced by dma_channel_initialize().

◆ EnableDmacHandler()

void EnableDmacHandler ( u32  channel)

◆ EnableIntc()

int EnableIntc ( int  intc)

Referenced by graph_add_vsync_handler().

◆ EnableIntcHandler()

void EnableIntcHandler ( u32  cause)

◆ EndOfHeap()

void* EndOfHeap ( void  )

Referenced by ps2_sbrk().

◆ ExecOSD()

void ExecOSD ( int  num_args,
char *  args[] 
)

◆ ExecPS2()

s32 ExecPS2 ( void *  entry,
void *  gp,
int  num_args,
char *  args[] 
)

Referenced by LoadELFFromFile(), and main().

◆ exit()

void exit ( int  retval)

Definition at line 25 of file terminate.c.

26 {
27  while (1)
28  _exit(retval);
29 }

References _exit().

◆ Exit()

void Exit ( s32  exit_code)

Referenced by InitTLB32MB().

◆ ExitDeleteThread()

void ExitDeleteThread ( void  )

Referenced by _kill().

◆ ExitThread()

void ExitThread ( void  )

◆ ExpandScratchPad()

int ExpandScratchPad ( unsigned int  page)

Definition at line 163 of file tlbsrc.c.

163  {
164  int result, index;
165  unsigned int PageMask, EntryHi, EntryLo0, EntryLo1;
166 
167  if(!(page&0xFFF)){
168  if(0xFFFFE<page-1){
169  if((index=ProbeTLBEntry(0x70004000, &PageMask, &EntryLo0, &EntryLo1))>=0){
170  if(page==0){
171  EntryHi=0xE0010000+((index-1)<<13);
172 
173  __asm volatile( "mfc0 $v0, $6\n"
174  "addiu $v0, $v0, 0xFFFF\n"
175  "mtc0 $v0, $6\n"
176  "mtc0 %0, $0\n"
177  "mtc0 $zero, $5\n"
178  "mtc0 %1, $10\n"
179  "mtc0 $zero, $2\n"
180  "mtc0 $zero, $3\n"
181  "sync.p\n"
182  "tlbwi\n"
183  "sync.p\n" ::"r"(index),"r"(EntryHi));
184  }
185  else{
186  __asm volatile( "mfc0 %0, $6\n"
187  "addiu $v0, %0, 1\n"
188  "mtc0 $v0, $6\n" ::"r"(index));
189  }
190  }
191 
192  if(page!=0){
193  /* Not sure why this code saves the EntryLo0 and EntryLo1 values on the stack, and sets a word on the stack to zero, but does not use them:
194 
195  0($sp)=0
196  4($sp)=$v0=(page+0x1000&0xFFFFF000)>>6|0x1F
197  8($sp)=$a0=(page&0xFFFFF000)>>6|0x1F */
198 
199  EntryHi=0x70004000;
200  EntryLo0=((page+0x1000)&0xFFFFF000)>>6|0x1F;
201  EntryLo1=(page&0xFFFFF000)>>6|0x1F;
202 
203  __asm volatile( "mtc0 %0, $0\n"
204  "daddu $v1, $zero, $zero\n"
205  "mtc0 $v1, $5\n"
206  "mtc0 %1, $10\n"
207  "mtc0 %2, $2\n"
208  "mtc0 %3, $3\n"
209  "sync.p\n"
210  "tlbwi\n"
211  "sync.p\n" ::"r"(index),"r"(EntryHi),"r"(EntryLo0),"r"(EntryLo1));
212 
213  result=index;
214  }
215  else result=0;
216  }
217  else result=-1;
218  }
219  else result=-1;
220 
221  return result;
222 }
s32 index
Definition: libpad.c:194
s32 result
Definition: rpc_client.c:23
int ProbeTLBEntry(unsigned int EntryHi, unsigned int *PageMask, unsigned int *EntryLo0, unsigned int *EntryLo1)
Definition: tlbsrc.c:136

References index, ProbeTLBEntry(), and result.

◆ FlushCache()

◆ GetCop0()

u32 GetCop0 ( s32  reg_id)

◆ GetEntryAddress()

void* GetEntryAddress ( int  syscall)

Referenced by InitAlarm(), InitExecPS2(), and InitOsd().

◆ GetExceptionHandler()

void* GetExceptionHandler ( int  except_no)

Referenced by ee_dbg_install().

◆ GetGP()

void* GetGP ( void  )

Referenced by SetAlarmInternal().

◆ GetGsHParam()

void GetGsHParam ( void *  addr1,
void *  addr2,
void *  addr3 
)

◆ GetGsVParam()

s32 GetGsVParam ( void  )

◆ GetInterruptHandler()

void* GetInterruptHandler ( int  intr_no)

◆ GetMemorySize()

s32 GetMemorySize ( void  )

Referenced by wipeUserMem().

◆ GetOsdConfigParam()

void GetOsdConfigParam ( void *  addr)

Referenced by PatchIsNeeded().

◆ GetOsdConfigParam2()

void GetOsdConfigParam2 ( void *  config,
s32  size,
s32  offset 
)

◆ GetSyscallHandler()

void* GetSyscallHandler ( int  syscall_no)

◆ GetThreadId()

◆ GetTLBEntry()

int GetTLBEntry ( unsigned int  index,
unsigned int *  PageMask,
unsigned int *  EntryHi,
unsigned int *  EntryLo0,
unsigned int *  EntryLo1 
)

Definition at line 111 of file tlbsrc.c.

111  {
112  int result;
113 
114  if(index<0x30){
115  __asm volatile( "mtc0 %0, $0\n"
116  "sync.p\n"
117  "tlbr\n"
118  "sync.p\n"
119  "mfc0 $v0, $5\n"
120  "sw $v0, (%1)\n"
121  "mfc0 $v0, $10\n"
122  "sw $v0, (%2)\n"
123  "mfc0 $v0, $2\n"
124  "sw $v0, (%3)\n"
125  "mfc0 $v0, $3\n"
126  "sw $v0, (%4)\n" ::"r"(index),"r"(PageMask),"r"(EntryHi),"r"(EntryLo0),"r"(EntryLo1));
127 
128  result=index;
129  }
130  else result=-1;
131 
132  return result;
133 }

References index, and result.

◆ GsGetIMR()

u64 GsGetIMR ( void  )

Referenced by ps2_screenshot().

◆ GsPutIMR()

u64 GsPutIMR ( u64  imr)

◆ iCancelWakeupThread()

s32 iCancelWakeupThread ( s32  thread_id)

◆ iChangeThreadPriority()

s32 iChangeThreadPriority ( s32  thread_id,
s32  priority 
)

◆ iCpuConfig()

u32 iCpuConfig ( u32  config)

◆ iDeleteSema()

s32 iDeleteSema ( s32  sema_id)

◆ iDisableDmac()

int iDisableDmac ( int  dmac)

Referenced by dma_channel_shutdown().

◆ iDisableDmacHandler()

void iDisableDmacHandler ( u32  channel)

◆ iDisableIntc()

int iDisableIntc ( int  intc)

◆ iDisableIntcHandler()

void iDisableIntcHandler ( u32  cause)

◆ iEnableDmac()

int iEnableDmac ( int  dmac)

Referenced by dma_channel_initialize().

◆ iEnableDmacHandler()

void iEnableDmacHandler ( u32  channel)

◆ iEnableIntc()

int iEnableIntc ( int  intc)

◆ iEnableIntcHandler()

void iEnableIntcHandler ( u32  cause)

◆ iFlushCache()

void iFlushCache ( s32  operation)

◆ iGetCop0()

u32 iGetCop0 ( s32  reg_id)

◆ iGetTLBEntry()

int iGetTLBEntry ( unsigned int  index,
unsigned int *  PageMask,
unsigned int *  EntryHi,
unsigned int *  EntryLo0,
unsigned int *  EntryLo1 
)

◆ iGsGetIMR()

u64 iGsGetIMR ( void  )

◆ iGsPutIMR()

u64 iGsPutIMR ( u64  imr)

◆ iInvalidDCache()

void iInvalidDCache ( void *  start,
void *  end 
)

◆ InitAlarm()

void InitAlarm ( void  )

Definition at line 43 of file alarm.c.

44 {
45  int i;
46 
47  setup(SysEntry[0].syscall, SysEntry[0].function);
48  Copy((void*)0x80076000, srcfile, size_srcfile);
49  Copy((void*)0x00082000, eenull, size_eenull);
50  FlushCache(0);
51  FlushCache(2);
52  setup(SysEntry[1].syscall, SysEntry[1].function);
53 
54  for(i=2; i<8; i++)
55  setup(SysEntry[i].syscall, GetEntryAddress(SysEntry[i].syscall));
56 }
unsigned char srcfile[]
unsigned int size_srcfile
unsigned int size_eenull
static const struct SyscallData SysEntry[]
Definition: alarm.c:26
unsigned char eenull[]
void * GetEntryAddress(int syscall)
int Copy(void *dest, const void *src, int size)
void FlushCache(s32 operation)
void setup(int syscall_num, void *handler)

References Copy(), eenull, FlushCache(), GetEntryAddress(), setup(), size_eenull, size_srcfile, srcfile, SyscallData::syscall, and SysEntry.

◆ InitExecPS2()

void InitExecPS2 ( void  )

Definition at line 47 of file libosd.c.

47  {
48  unsigned int i;
49 
50  if(PatchIsNeeded()){
51  setup(SyscallPatchEntries[0].syscall_num, SyscallPatchEntries[0].function);
52  Copy((unsigned int*)0x80074000, (unsigned int*)osdsrc, size_osdsrc);
53 
54  FlushCache(0);
55  FlushCache(2);
56  setup(SyscallPatchEntries[1].syscall_num, SyscallPatchEntries[1].function);
57 
58  for(i=2; i<3; i++){
59  setup(SyscallPatchEntries[i].syscall_num, GetEntryAddress(SyscallPatchEntries[i].syscall_num));
60  }
61  }
62 }
int PatchIsNeeded(void)
Definition: libosd_common.c:20
unsigned char osdsrc[]
unsigned int size_osdsrc
static struct SyscallData SyscallPatchEntries[]
Definition: libosd.c:31

References Copy(), FlushCache(), GetEntryAddress(), osdsrc, PatchIsNeeded(), setup(), size_osdsrc, SyscallData::syscall_num, and SyscallPatchEntries.

◆ InitOsd()

void InitOsd ( void  )

Definition at line 69 of file libosd_full.c.

69  {
70  unsigned int i;
71 
72  if(PatchIsNeeded()){
73  setup(SyscallPatchEntries[0].syscall_num, SyscallPatchEntries[0].function);
74  Copy((unsigned int*)0x80074000, (unsigned int*)osdsrc, size_osdsrc);
75 
76  FlushCache(0);
77  FlushCache(2);
78  setup(SyscallPatchEntries[1].syscall_num, SyscallPatchEntries[1].function);
79 
80  for(i=2; i<7; i++){
81  setup(SyscallPatchEntries[i].syscall_num, GetEntryAddress(SyscallPatchEntries[i].syscall_num));
82  }
83  }
84 }
unsigned char osdsrc[]
unsigned int size_osdsrc
static struct SyscallData SyscallPatchEntries[]
Definition: libosd_full.c:37

References Copy(), FlushCache(), GetEntryAddress(), osdsrc, PatchIsNeeded(), setup(), size_osdsrc, SyscallData::syscall_num, and SyscallPatchEntries.

◆ InitThread()

int InitThread ( void  )

◆ InitTLB()

void InitTLB ( void  )

Definition at line 57 of file tlbfunc.c.

57  {
58  if(GetMemorySize()==0x2000000){
59  InitTLB32MB();
60  }
61  else{
62  _InitTLB();
63  }
64 }
int _InitTLB(void)
s32 GetMemorySize(void)
static int InitTLB32MB(void)
Definition: tlbfunc.c:142

◆ InitTLBFunctions()

void InitTLBFunctions ( void  )

Definition at line 41 of file tlbfunc.c.

41  {
42  int i;
43 
44  setup(SysEntry[0].syscall, SysEntry[0].function);
45  Copy((void*)0x80075000, tlbsrc, size_tlbsrc);
46  FlushCache(0);
47  FlushCache(2);
48  setup(SysEntry[1].syscall, SysEntry[1].function);
49 
50  for(i=3; i<8; i++){
51  setup(SysEntry[i].syscall, GetEntryAddress(SysEntry[i].syscall));
52  }
53 
55 }
void * GetEntryAddress(int syscall)
static const struct SyscallData SysEntry[]
Definition: tlbfunc.c:22
unsigned char tlbsrc[]
void setup(int syscall, void *function)
char ** _kExecArg
Definition: tlbsrc.c:26
unsigned int size_tlbsrc

References _kExecArg, Copy(), FlushCache(), GetEntryAddress(), setup(), size_tlbsrc, SyscallData::syscall, SysEntry, and tlbsrc.

◆ Interrupt2Iop()

s32 Interrupt2Iop ( s32  cause)

◆ InvalidDCache()

void InvalidDCache ( void *  start,
void *  end 
)

◆ iPollSema()

s32 iPollSema ( s32  sema_id)

◆ iProbeTLBEntry()

int iProbeTLBEntry ( unsigned int  EntryHi,
unsigned int *  PageMask,
unsigned int *  EntryLo0,
unsigned int *  EntryLo1 
)

◆ iPutTLBEntry()

int iPutTLBEntry ( unsigned int  PageMask,
unsigned int  EntryHi,
unsigned int  EntryLo0,
unsigned int  EntryLo1 
)

◆ iReferSemaStatus()

s32 iReferSemaStatus ( s32  sema_id,
ee_sema_t sema 
)

◆ iReferThreadStatus()

s32 iReferThreadStatus ( s32  thread_id,
ee_thread_status_t info 
)

◆ iReleaseAlarm()

s32 iReleaseAlarm ( s32  alarm_id)

◆ iReleaseWaitThread()

s32 iReleaseWaitThread ( s32  thread_id)

Referenced by TimeoutHandler().

◆ iResumeThread()

s32 iResumeThread ( s32  thread_id)

◆ iRotateThreadReadyQueue()

s32 iRotateThreadReadyQueue ( s32  priority)

◆ iSetAlarm()

s32 iSetAlarm ( u16  time,
void(*)(s32 alarm_id, u16 time, void *common)  callback,
void *  common 
)

◆ iSetTLBEntry()

int iSetTLBEntry ( unsigned int  index,
unsigned int  PageMask,
unsigned int  EntryHi,
unsigned int  EntryLo0,
unsigned int  EntryLo1 
)

◆ iSifDmaStat()

s32 iSifDmaStat ( u32  id)

◆ iSifSetDChain()

void iSifSetDChain ( void  )

Referenced by HandleRxEvent().

◆ iSifSetDma()

u32 iSifSetDma ( SifDmaTransfer_t sdd,
s32  len 
)

◆ iSignalSema()

◆ iSuspendThread()

s32 iSuspendThread ( s32  thread_id)

◆ iSyncDCache()

void iSyncDCache ( void *  start,
void *  end 
)

◆ iTerminateThread()

s32 iTerminateThread ( s32  thread_id)

◆ iWakeupThread()

s32 iWakeupThread ( s32  thread_id)

Referenced by EthStatusCheckCb(), and HandleRxEvent().

◆ kCopy()

int kCopy ( void *  dest,
const void *  src,
int  size 
)

◆ kCopyBytes()

int kCopyBytes ( void *  dest,
const void *  src,
int  size 
)

◆ KSeg0()

void KSeg0 ( s32  arg1)

◆ LoadExecPS2()

void LoadExecPS2 ( const char *  filename,
s32  num_args,
char *  args[] 
)

◆ MachineType()

s32 MachineType ( void  )

◆ nopdelay()

static void nopdelay ( void  )
inlinestatic

Definition at line 141 of file kernel.h.

142 {
143  int i = 0xfffff;
144 
145  do {
146  __asm__ ("nop\nnop\nnop\nnop\nnop\n");
147  } while (i-- != -1);
148 }

Referenced by audsrv_init(), fileXioInit(), main(), mcInit(), mtapInit(), NetManInitRPCClient(), padInit(), poweroffInit(), PS2CamGetDeviceCount(), PS2CamGetDeviceInfo(), PS2CamGetDeviceStatus(), PS2CamGetIRXVersion(), PS2CamInit(), PS2CamSetDeviceBandwidth(), ps2ip_init(), PS2MouseInit(), RMMan_Init(), and sceSdInit().

◆ PatchIsNeeded()

int PatchIsNeeded ( void  )

Definition at line 20 of file libosd_common.c.

20  {
21  ConfigParam original_config, config;
22 
23  GetOsdConfigParam(&original_config);
24  config=original_config;
25  config.version=1; //Protokernels cannot retain values set in this field.
26  SetOsdConfigParam(&config);
27  GetOsdConfigParam(&config);
28  SetOsdConfigParam(&original_config);
29 
30  return(config.version<1);
31 }
void SetOsdConfigParam(void *addr)
void GetOsdConfigParam(void *addr)

References GetOsdConfigParam(), SetOsdConfigParam(), and ConfigParam::version.

Referenced by InitExecPS2(), and InitOsd().

◆ PollSema()

s32 PollSema ( s32  sema_id)

◆ ProbeTLBEntry()

int ProbeTLBEntry ( unsigned int  EntryHi,
unsigned int *  PageMask,
unsigned int *  EntryLo0,
unsigned int *  EntryLo1 
)

Definition at line 136 of file tlbsrc.c.

136  {
137  int result, index;
138 
139  __asm volatile( "mtc0 %1, $10\n"
140  "sync.p\n"
141  "tlbp\n"
142  "sync.p\n"
143  "mfc0 %0, $0\n" :"=r"(index):"r"(EntryHi));
144 
145  if(index>=0){
146  __asm volatile( "tlbr\n"
147  "sync.p\n"
148  "mfc0 $v0, $5\n"
149  "sw $v0, (%0)\n"
150  "mfc0 $v1, $2\n"
151  "sw $v1, (%1)\n"
152  "mfc0 $v0, $3\n"
153  "sw $v0, (%2)\n" ::"r"(PageMask),"r"(EntryLo0),"r"(EntryLo1));
154 
155  result=index;
156  }
157  else result=-1;
158 
159  return result;
160 }

References index, and result.

Referenced by ExpandScratchPad().

◆ PSMode()

void PSMode ( void  )

◆ PutTLBEntry()

int PutTLBEntry ( unsigned int  PageMask,
unsigned int  EntryHi,
unsigned int  EntryLo0,
unsigned int  EntryLo1 
)

Definition at line 61 of file tlbsrc.c.

61  {
62  int result;
63 
64  switch(EntryHi>>24){
65  case 0x40:
66  case 0x30:
67  case 0x20:
68  case 0x00:
69  __asm volatile( "mtc0 %1, $5\n"
70  "mtc0 %2, $10\n"
71  "mtc0 %3, $2\n"
72  "mtc0 %4, $3\n"
73  "sync.p\n"
74  "tlbwr\n"
75  "sync.p\n"
76  "tlbp\n"
77  "sync.p\n"
78  "mfc0 %0, $0\n" :"=r"(result):"r"(PageMask),"r"(EntryHi),"r"(EntryLo0),"r"(EntryLo1));
79  break;
80  case 0x50:
81  case 0x10:
82  default: //SP193: I don't remember seeing a default case. Anyway... Keeping Compilers Happy (TM).
83  result=-1;
84  }
85 
86  return result;
87 }

References result.

◆ ReferSemaStatus()

s32 ReferSemaStatus ( s32  sema_id,
ee_sema_t sema 
)

◆ ReferThreadStatus()

s32 ReferThreadStatus ( s32  thread_id,
ee_thread_status_t info 
)

◆ ReleaseAlarm()

s32 ReleaseAlarm ( s32  alarm_id)

Definition at line 110 of file alarm.c.

111 {
112  u16 time;
113  s32 result;
114  int i, j;
115 
116  result = -1;
117  for(i = 0; i < AlarmCount; i++)
118  {
119  if(alarms[i].id == id)
120  {
121  if(alarms[i].target == *T3_COMP_W)
122  {
123  if(*R_EE_I_STAT & (1 << INTC_TIM3)) //Cannot release alarm that has already triggered.
124  return -1;
125  }
126 
127  time = alarms[i].time;
128  //Move forward list.
129  for(j = i; j < AlarmCount - 1; j++)
130  alarms[j] = alarms[j+1];
131 
132  --AlarmCount;
133  AlarmStatus &= ~(1 << id);
134 
135  if(i == 0) //If the first alarm was released, update timer comparator.
136  SetupTIM3(alarms[0].target);
137 
138  if(AlarmCount == 0) //Stop timer if there are no alarms left.
139  *T3_MODE_W = Tn_MODE(3,0,0,0,0,1,0,0,0,0);
140 
142  }
143  }
144 
145  EE_SYNC();
146  return result;
147 }
#define R_EE_I_STAT
Definition: ee_regs.h:461
#define EE_SYNC()
Definition: kernel.h:31
u32 time
Definition: libmouse.c:37
#define INTC_TIM3
Definition: alarm.c:19
#define T3_MODE_W
Definition: alarm.c:21
static int AlarmCount
Definition: alarm.c:24
static u32 CalculateTimeDiff(u32 t1, u32 t2)
Definition: alarm.c:44
static struct alarm alarms[MAX_ALARMS]
Definition: alarm.c:36
static void SetupTIM3(u16 ticks)
Definition: alarm.c:159
#define T3_COMP_W
Definition: alarm.c:22
static u64 AlarmStatus
Definition: alarm.c:25
#define T3_COUNT_W
Definition: alarm.c:20
u16 time
Definition: alarm.c:29
signed int s32
Definition: tamtypes.h:58
unsigned short u16
Definition: tamtypes.h:24
#define Tn_MODE(CLKS, GATE, GATS, GATM, ZRET, CUE, CMPE, OVFE, EQUF, OVFF)
Definition: timer.h:42

References AlarmCount, alarms, AlarmStatus, CalculateTimeDiff(), EE_SYNC, alarm::id, INTC_TIM3, R_EE_I_STAT, result, SetupTIM3(), T3_COMP_W, T3_COUNT_W, T3_MODE_W, alarm::target, alarm::time, time, and Tn_MODE.

Referenced by WaitSemaTimeout().

◆ ReleaseWaitThread()

s32 ReleaseWaitThread ( s32  thread_id)

◆ RemoveDmacHandler()

s32 RemoveDmacHandler ( s32  channel,
s32  handler_id 
)

◆ RemoveIntcHandler()

s32 RemoveIntcHandler ( s32  cause,
s32  handler_id 
)

◆ RemoveSbusIntcHandler()

s32 RemoveSbusIntcHandler ( s32  cause)

◆ ResetEE()

void ResetEE ( u32  init_bitfield)

Referenced by dma_reset().

◆ ResumeThread()

s32 ResumeThread ( s32  thread_id)

◆ RFU009()

void RFU009 ( u32  arg0,
u32  arg1 
)

◆ RFU059()

u8 RFU059 ( void  )

◆ RotateThreadReadyQueue()

s32 RotateThreadReadyQueue ( s32  priority)

◆ SetAlarm()

s32 SetAlarm ( u16  time,
void(*)(s32 alarm_id, u16 time, void *common)  callback,
void *  common 
)

◆ SetCPUTimer()

void SetCPUTimer ( s32  compval)

◆ SetCPUTimerHandler()

void SetCPUTimerHandler ( void(*)(void)  handler)

◆ SetGP()

void SetGP ( void *  gp)

Referenced by Intc12Handler().

◆ SetGsCrt()

void SetGsCrt ( s16  interlace,
s16  pal_ntsc,
s16  field 
)

◆ SetGsHParam()

void SetGsHParam ( void *  addr1,
void *  addr2,
void *  addr3,
void *  addr4 
)

◆ SetGsVParam()

void SetGsVParam ( s32  arg1)

◆ SetMemoryMode()

int SetMemoryMode ( int  mode)

◆ SetOsdConfigParam()

void SetOsdConfigParam ( void *  addr)

Referenced by PatchIsNeeded().

◆ SetOsdConfigParam2()

void SetOsdConfigParam2 ( void *  config,
s32  size,
s32  offset 
)

◆ SetPgifHandler()

void SetPgifHandler ( void *  handler)

◆ SetSyscall()

void SetSyscall ( s32  syscall_num,
void *  handler 
)

◆ setup()

void setup ( int  syscall_num,
void *  handler 
)

Referenced by InitAlarm(), InitExecPS2(), and InitOsd().

◆ SetupHeap()

void SetupHeap ( void *  heap_start,
s32  heap_size 
)

◆ SetupThread()

void* SetupThread ( void *  gp,
void *  stack,
s32  stack_size,
void *  args,
void *  root_func 
)

◆ SetVCommonHandler()

void SetVCommonHandler ( s32  handler_num,
void *  handler_func 
)

Referenced by ee_dbg_install(), and ee_dbg_remove().

◆ SetVInterruptHandler()

void SetVInterruptHandler ( s32  handler_num,
void *  handler_func 
)

◆ SetVSyncFlag()

void SetVSyncFlag ( u32 ,
u64  
)

◆ SetVTLBRefillHandler()

void SetVTLBRefillHandler ( s32  handler_num,
void *  handler_func 
)

Referenced by ee_dbg_install(), and ee_dbg_remove().

◆ SifDmaStat()

s32 SifDmaStat ( u32  id)

◆ SifGetReg()

int SifGetReg ( u32  register_num)

◆ SifSetDChain()

void SifSetDChain ( void  )

◆ SifSetDma()

◆ SifSetReg()

int SifSetReg ( u32  register_num,
int  register_value 
)

◆ SifStopDma()

void SifStopDma ( void  )

◆ SignalSema()

◆ SleepThread()

◆ StartThread()

s32 StartThread ( s32  thread_id,
void *  args 
)

◆ SuspendThread()

s32 SuspendThread ( s32  thread_id)

◆ SyncDCache()

◆ TerminateLibrary()

void TerminateLibrary ( void  )

◆ TerminateThread()

s32 TerminateThread ( s32  thread_id)

◆ WaitSema()

◆ WakeupThread()

s32 WakeupThread ( s32  thread_id)

Referenced by NetManRpcNetIFXmit().

Variable Documentation

◆ _gp

void* _gp
extern

◆ errno

int errno
extern

Referenced by sleep().