miniJB on pspdev.org:
---------------------
I have a suggestion regarding vfpu access..
I note that pthread.h defines
Code:
/*
* pthread_{get,set}scope
*/
PTHREAD_SCOPE_PROCESS = 0,
PTHREAD_SCOPE_SYSTEM = 1, /* Default */
PTHREAD_SCOPE_PROCESS_VFPU = 2, /* PSP specific */
however in pthread_attr_setscope.c
Code:
int
pthread_attr_setscope (pthread_attr_t * attr, int contentionscope)
{
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
switch (contentionscope)
{
case PTHREAD_SCOPE_SYSTEM:
(*attr)->contentionscope = contentionscope;
return 0;
case PTHREAD_SCOPE_PROCESS:
return ENOTSUP;
default:
return EINVAL;
}
#else
return ENOSYS;
#endif
}
only PTHREAD_SCOPE_SYSTEM seems honoured, and then only if _POSIX_THREAD_PRIORITY_SCHEDULING is defined.
Further, in create.c
Code:
pthread_create (pthread_t * tid,
const pthread_attr_t * attr,
void *(*start) (void *), void *arg)
{
//...
stackSize = a->stacksize;
tp->detachState = a->detachstate;
priority = a->param.sched_priority;
//...
}
does not examine the contentionscope (for any osal!).
and in pte_osal_generic.h
Code:
pte_osResult pte_osThreadCreate(pte_osThreadEntryPoint entryPoint,
int stackSize,
int initialPriority,
void *argv,
pte_osThreadHandle* ppte_osThreadHandle);
no contentionscope is passed.
and in psp_osal.c,
Code:
pte_osResult pte_osThreadCreate(pte_osThreadEntryPoint entryPoint,
int stackSize,
int initialPriority,
void *argv,
pte_osThreadHandle* ppte_osThreadHandle)
{
//...
pspAttr = 0;
// printf("%s %p %d %d %d\n",threadName, pspStubThreadEntry, initialPriority, stackSize, pspAttr);
threadId = sceKernelCreateThread(threadName,
pspStubThreadEntry,
initialPriority,
stackSize,
pspAttr,
NULL);
//...
}
pspAttr is set to 0 without any check against the contentionscope.
Would it not be advantageous to add the contentionscope parameter to pte_osThreadCreate (since stacksize and priority are already here) and noop that for the osals that do not support it? We can then use this to set pspAttr.
This would allow the PSP to use PTHREAD_SCOPE_PROCESS for user threads and PTHREAD_SCOPE_SYSTEM for kernel threads, and we could also alter PTHREAD_SCOPE_PROCESS_VFPU to simply PTHREAD_SCOPE_VFPU, allowing us to use the familiar OR ops to specify VFPU access.
I understand this may not work as the scope normally does on pthread-compliant systems, and that error detection when setting contentionscope values may not be as robust, but it would be handy to specify vfpu threads...
edit:
Just realised that using PTHREAD_SCOPE_SYSTEM to make a kernel pthread when in a user thread obviously wouldnt work. I guess this should give an error at thread creation, but this has little bearing on exposing the vfpu...
Logged In: YES
user_id=1971475
Originator: YES
File Added: psp_vfpu.diff
do not work for WLAN network returns 8041005