// SDK location: /user/pspthreadman.h:1401
        // SDK declaration: int sceKernelTryAllocateFpl(SceUID uid, void **data);
        public int sceKernelTryAllocateFpl(int uid, int data)
        {
            KFixedPool pool = _kernel.GetHandle <KFixedPool>(uid);

            if (pool == null)
            {
                return(-1);
            }

            KMemoryBlock block = pool.Allocate();

            if (block == null)
            {
                return(-1);
            }

            Debug.Assert(data != 0);
            unsafe
            {
                uint *pdata = ( uint * )_memorySystem.Translate(( uint )data);
                *     pdata = block.Address;
            }

            return(0);
        }
        // SDK location: /user/pspthreadman.h:1360
        // SDK declaration: int sceKernelCreateFpl(const char *name, int part, int attr, unsigned int size, unsigned int blocks, struct SceKernelFplOptParam *opt);
        public int sceKernelCreateFpl(int name, int part, int attr, int size, int blocks, int opt)
        {
            KPartition partition = _kernel.Partitions[part];

            Debug.Assert(partition != null);
            if (partition == null)
            {
                return(-1);
            }

            KFixedPool pool = new KFixedPool(_kernel, partition,
                                             _kernel.ReadString(( uint )name),
                                             ( uint )attr, ( uint )size, blocks);

            if (pool.AllocateFplBlocks() == false)
            {
                pool.Dispose();
                //return unchecked( ( int )0x800200E0 );
                //return unchecked( ( int )0x800200D9 );
                return(unchecked (( int )0x80020190));
            }
            _kernel.AddHandle(pool);

            // option unused?
            //Debug.Assert( opt == 0 );

            return(( int )pool.UID);
        }
        // SDK location: /user/pspthreadman.h:1369
        // SDK declaration: int sceKernelDeleteFpl(SceUID uid);
        public int sceKernelDeleteFpl(int uid)
        {
            KFixedPool pool = _kernel.GetHandle <KFixedPool>(uid);

            if (pool == null)
            {
                return(-1);
            }

            pool.Dispose();

            _kernel.RemoveHandle(pool.UID);

            return(0);
        }
        // SDK location: /user/pspthreadman.h:1411
        // SDK declaration: int sceKernelFreeFpl(SceUID uid, void *data);
        public int sceKernelFreeFpl(int uid, int data)
        {
            KFixedPool pool = _kernel.GetHandle <KFixedPool>(uid);

            if (pool == null)
            {
                return(-1);
            }

            bool wokeWaiter = pool.Free(data);

            if (wokeWaiter == true)
            {
                _kernel.Schedule();
            }

            return(0);
        }
        // SDK location: /user/pspthreadman.h:1391
        // SDK declaration: int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout);
        public int sceKernelAllocateFplCB(int uid, int data, int timeout)
        {
            KFixedPool pool = _kernel.GetHandle <KFixedPool>(uid);

            if (pool == null)
            {
                return(-1);
            }

            KMemoryBlock block = pool.Allocate();

            if (block != null)
            {
                Debug.Assert(data != 0);
                unsafe
                {
                    uint *pdata = ( uint * )_memorySystem.Translate(( uint )data);
                    *     pdata = block.Address;
                }

                return(0);
            }
            else
            {
                uint timeoutUs = 0;
                if (timeout != 0)
                {
                    unsafe
                    {
                        uint *ptimeout = ( uint * )_memorySystem.Translate(( uint )timeout);
                        timeoutUs = *ptimeout;
                    }
                }
                KThread thread = _kernel.ActiveThread;
                Debug.Assert(thread != null);
                thread.Wait(pool, ( uint )data, timeoutUs, true);
                return(0);
            }
        }
        public int sceKernelCreateFpl( int name, int part, int attr, int size, int blocks, int opt )
        {
            KPartition partition = _kernel.Partitions[ part ];
            Debug.Assert( partition != null );
            if( partition == null )
                return -1;

            KFixedPool pool = new KFixedPool( _kernel, partition,
                _kernel.ReadString( ( uint )name ),
                ( uint )attr, ( uint )size, blocks );
            if( pool.AllocateFplBlocks() == false )
            {
                pool.Dispose();
                //return unchecked( ( int )0x800200E0 );
                //return unchecked( ( int )0x800200D9 );
                return unchecked( ( int )0x80020190 );
            }
            _kernel.AddHandle( pool );

            // option unused?
            //Debug.Assert( opt == 0 );

            return ( int )pool.UID;
        }