- Uint addr, size;
- int max_handles = *Threads_GetMaxFD();
- size = max_handles * sizeof(tVFS_Handle);
- for(addr = 0; addr < size; addr += 0x1000)
+ tVFS_Handle *h = &gaUserHandles[i];
+
+ if( !MM_GetPhysAddr(h) )
+ {
+ void *pg = (void*)( (tVAddr)h & ~(PAGE_SIZE-1) );
+ if( !MM_Allocate( pg ) )
+ {
+ // OOM?
+ return ;
+ }
+ memset(pg, 0, PAGE_SIZE);
+ }
+ // Safe to dereference, as Threads_CloneTCB references handles
+ #if 1
+ else