/// <summary> /// Transfer any contents that needs to be adjusted from the transferee to the target /// endpoint. /// </summary> // TODO: change "ref EndpointCore" to "EndpointCore" public static void TransferContentOwnership( ref EndpointCore transferee, ref EndpointCore target) { // TODO MAKE THIS APROPRIATE TO BOTH SINGLE AND PAGED IMPLS DeliveryImpl transfereeDi = transferee.EndpointDeliveryImpl; // XXX BUG? BUG? BUG? // targetDi = transferee.EndpointDeliveryImpl // should be: // targetDi = target.EndpointDeliveryImpl DeliveryImpl targetDi = transferee.EndpointDeliveryImpl; VTable.Assert((transfereeDi != null) && (targetDi != null)); //Monitoring.Log(Monitoring.Provider.ChannelService, // (ushort)ChannelServiceEvent.TransferContentOwnership, 0, // (uint)transfereeDi.ProcessId, // (uint)targetDi.ProcessId, // (uint)transfereeDi.ChannelId, // (uint)targetDi.ChannelId, // (uint)targetDi.Peer.ChannelId); int toProcessId = targetDi.ProcessId; transfereeDi.ProcessId = toProcessId; DelegationState newstate = transfereeDi.OwnerDelegationState; transfereeDi.OwnerPrincipalHandle = TransferPrincipal(transfereeDi.OwnerPrincipalHandle, toProcessId, ref newstate); transfereeDi.OwnerDelegationState = newstate; Allocation *transfereePeerAllocation = transfereeDi.Peer(); // also transfer the peer allocation Allocation.SetOwnerProcessId(transfereePeerAllocation, toProcessId); }
/// <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); } }
/// <summary> /// Transfer the given Allocation block to the target endpoint /// </summary> public static void TransferBlockOwnership(Allocation *ptr, ref EndpointCore target) { Allocation.SetOwnerProcessId(ptr, target.cachedOwnerProcessId); // TODO MAKE THIS APROPRIATE TO BOTH SINGLE AND PAGED IMPLS DeliveryImpl di = target.EndpointDeliveryImpl; VTable.Assert(di != null); //Monitoring.Log(Monitoring.Provider.ChannelService, // (ushort)ChannelServiceEvent.TransferBlockOwnership, 0, // (uint)di.ChannelId, // (uint)di.ProcessId, // 0, 0, 0); #if CHANNEL_COUNT IncreaseBytesSentCount((long)Allocation.GetSize(ptr)); #endif Allocation.SetOwnerProcessId(ptr, di.ProcessId); }
internal virtual void Connect(DeliveryImpl expDi, Allocation * /*EndpointCore* opt(ExHeap)!*/ securityEp) { // security principals are held in the delivery impl, not the endpoint core // since this allows them to be kept out of user memory in paging builds if (securityEp != null) { DeliveryImpl secImpl = EndpointCore.AllocationEndpointDeliveryImpl(securityEp); if (secImpl != null && secImpl.OwnerDelegationState == DelegationState.Mediated) { this.OwnerPrincipalHandle = secImpl.OwnerPrincipalHandle; } } int newChannelId = EndpointCore.GetNextChannelId(); this.ChannelId = -newChannelId; expDi.ChannelId = newChannelId; this.Closed = false; expDi.Closed = false; }
private DeliveryImpl PeerImpl() { return(EndpointCore.AllocationEndpointDeliveryImpl(Peer())); }