Exemple #1
0
        /// <summary>
        /// Generic copy (either from kernel or to kernel)
        /// Determines if the thing we are moving is an endpoint and copies it accordingly.
        /// </summary>
        public static Allocation *MoveData(SharedHeap fromHeap,
                                           SharedHeap toHeap,
                                           Process newOwner,
                                           Allocation *data)
        {
            if (data == null)
            {
                return(data);
            }

            if (!fromHeap.Validate(data))
            {
                throw new ArgumentException("Bad argument. Not visible");
            }

            // We can only transfer either into our out of the kernel's heap
            DebugStub.Assert(fromHeap == SharedHeap.KernelSharedHeap ||
                             toHeap == SharedHeap.KernelSharedHeap);

            if (SystemType.IsSubtype(data, EndpointCoreSystemType))
            {
                // we have an endpoint
                DeliveryImpl di = EndpointCore.AllocationEndpointDeliveryImpl(data);
                return(di.MoveEndpoint(fromHeap, toHeap, newOwner));
            }
            else
            {
                // we have a NON-endpoint
                // TODO FIX this!
                return(null); // MoveNonEndpoint(fromHeap, toHeap, newOwner, data);
            }
        }