00001 /* 00002 * PSP Software Development Kit - http://www.pspdev.org 00003 * ----------------------------------------------------------------------- 00004 * Licensed under the BSD license, see LICENSE in PSPSDK root for details. 00005 * 00006 * pspthreadman_kernel.h - Interface to the kernel side of threadman 00007 * 00008 * Copyright (c) 2005 James F. 00009 * 00010 * $Id: pspthreadman_kernel.h 2131 2007-01-15 21:42:22Z tyranid $ 00011 */ 00012 00013 #ifndef PSPTHREADMANKERNEL_H 00014 #define PSPTHREADMANKERNEL_H 00015 00016 #include <pspkerneltypes.h> 00017 #include <pspthreadman.h> 00018 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00035 int sceKernelSuspendAllUserThreads(void); 00036 00042 int sceKernelIsUserModeThread(void); 00043 00049 int sceKernelGetUserLevel(void); 00050 00056 unsigned int sceKernelGetSyscallRA(void); 00057 00065 int sceKernelGetThreadKernelStackFreeSize(SceUID thid); 00066 00072 int sceKernelCheckThreadKernelStack(void); 00073 00083 int sceKernelExtendKernelStack(int type, void (*cb)(void*), void *arg); 00084 00090 unsigned int sceKernelGetSystemStatusFlag(void); 00091 00101 int sceKernelAllocateKTLS(int id, int (*cb)(unsigned int *size, void *arg), void *arg); 00102 00110 int sceKernelFreeKTLS(int id); 00111 00119 void *sceKernelGetKTLS(int id); 00120 00130 void *sceKernelGetThreadKTLS(int id, SceUID thid, int mode); 00131 00134 struct SceThreadContext { 00135 unsigned int type; 00136 unsigned int gpr[31]; 00137 unsigned int fpr[32]; 00138 unsigned int fc31; 00139 unsigned int hi; 00140 unsigned int lo; 00141 unsigned int SR; 00142 unsigned int EPC; 00143 unsigned int field_114; 00144 unsigned int field_118; 00145 }; 00146 00147 struct SceSCContext 00148 { 00149 unsigned int status; 00150 unsigned int epc; 00151 unsigned int sp; 00152 unsigned int ra; 00153 unsigned int k1; 00154 unsigned int unk[3]; 00155 }; 00156 00160 typedef struct SceKernelThreadKInfo { 00162 SceSize size; 00164 char name[32]; 00166 SceUInt attr; 00168 int status; 00170 SceKernelThreadEntry entry; 00172 void * stack; 00174 int stackSize; 00176 void * kstack; 00178 void * kstackSize; 00180 void * gpReg; 00182 SceSize args; 00184 void * argp; 00186 int initPriority; 00188 int currentPriority; 00190 int waitType; 00192 SceUID waitId; 00194 int wakeupCount; 00196 SceKernelSysClock runClocks; 00197 #if _PSP_FW_VERSION >= 200 00198 SceUInt unk3; /* Unknown extra field on later firmwares */ 00199 #endif 00200 00201 SceUInt intrPreemptCount; 00203 SceUInt threadPreemptCount; 00205 SceUInt releaseCount; 00207 struct SceThreadContext *thContext; 00209 float * vfpuContext; 00211 void * retAddr; 00213 SceUInt unknown1; 00215 struct SceSCContext *scContext; 00216 } SceKernelThreadKInfo; 00217 00226 int ThreadManForKernel_2D69D086(SceUID uid, SceKernelThreadKInfo *info); 00227 00228 #ifdef __cplusplus 00229 } 00230 #endif 00231 00234 #endif /* PSPTHREADMANKERNEL_H */