/// <summary> /// Returns the paging granularity of the pointer <paramref name="page" />. /// </summary> /// <returns> /// The granularity level or -1 if the pointer is not page-aligned. /// </returns> public static uint GetPointerGranularity(void *page) { ulong pagei = (ulong)page; uint levels = GetBigGranularity() + 1; for (uint x = 0; x < levels; ++x) { PageAllocator.Errors err = PageAllocator.Errors.Success; uint size = GetGranularitySize(x, &err); if (err != PageAllocator.Errors.Success) { TextMode.Write("Error: "); TextMode.Write((int)err); Diagnostics.Assert(false, "Failed to get pager granularity!"); } if ((pagei & (ulong)(size - 1)) == 0) { return(x); } } return(0xFFFFFFFF); }
internal void Dump() { TextMode.Write("Thread stack: "); TextMode.Write((int)stackAddress, true); TextMode.Write(" function: "); TextMode.Write((int)functionAddress, true); TextMode.Write(" position: "); TextMode.Write((int)stackPointer, true); TextMode.WriteLine(); }
public unsafe void Dump() { // TODO: make this thread safe! TextMode.WriteLine("--------------"); TextMode.Write("Count: "); TextMode.Write(Count); TextMode.WriteLine(); for (int i = 0; i < Count; i++) { Thread thread = schedule[i] as Thread; thread.Dump(); } TextMode.WriteLine("--------------"); }