Esempio n. 1
0
        /// <summary>
        /// Maps a given range of pages to the specified CPU virtual address.
        /// </summary>
        /// <remarks>
        /// All addresses and sizes must be page aligned.
        /// </remarks>
        /// <param name="pa">CPU virtual address to map into</param>
        /// <param name="va">GPU virtual address to be mapped</param>
        /// <param name="size">Size in bytes of the mapping</param>
        /// <param name="kind">Kind of the resource located at the mapping</param>
        public void Map(ulong pa, ulong va, ulong size, PteKind kind)
        {
            lock (_pageTable)
            {
                MemoryUnmapped?.Invoke(this, new UnmapEventArgs(va, size));

                for (ulong offset = 0; offset < size; offset += PageSize)
                {
                    SetPte(va + offset, PackPte(pa + offset, kind));
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Checks if the kind is pitch.
 /// </summary>
 /// <param name="kind">Kind to check</param>
 /// <returns>True if pitch, false otherwise</returns>
 public static bool IsPitch(this PteKind kind)
 {
     return(kind == PteKind.Pitch || kind == PteKind.PitchNoSwizzle);
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a page table entry from a physical address and kind.
 /// </summary>
 /// <param name="pa">Physical address</param>
 /// <param name="kind">Kind</param>
 /// <returns>Page table entry</returns>
 private static ulong PackPte(ulong pa, PteKind kind)
 {
     return(pa | ((ulong)kind << 56));
 }