Beispiel #1
0
        // compare a chuck of the context record contained between the two offsets
        private bool CheckContextChunk(IA64Context a1, IA64Context a2, int startOffset, int endOffset)
        {
            using (IContextDirectAccessor c1 = a1.OpenForDirectAccess())
            {
                using (IContextDirectAccessor c2 = a2.OpenForDirectAccess())
                {
                    for (int i = startOffset; i < endOffset; i++)
                    {
                        if (Marshal.ReadByte(c1.RawBuffer, i) != Marshal.ReadByte(c2.RawBuffer, i))
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Beispiel #2
0
        private bool CheckIA64Contexts(IA64Context a1, IA64Context a2)
        {
            // CONTEXT_CONTROL contains: ApUNAT through rest of CONTEXT
            if ((a1.Flags & ContextFlags.IA64ContextControl) == ContextFlags.IA64ContextControl)
            {
                if (!CheckContextChunk(a1, a2, (int)IA64Offsets.ApUNAT, (int)IA64Offsets.UNUSEDPACK))
                {
                    return(false);
                }
            }

            // CONTEXT_CONTROL contains: IntGp through ApUNAT
            if ((a1.Flags & ContextFlags.IA64ContextInteger) == ContextFlags.IA64ContextInteger)
            {
                if (!CheckContextChunk(a1, a2, (int)IA64Offsets.IntGp, (int)IA64Offsets.ApUNAT))
                {
                    return(false);
                }
            }

            // CONTEXT_DEBUG contains: DbI0 through FltS0
            if ((a1.Flags & ContextFlags.IA64ContextDebug) == ContextFlags.IA64ContextDebug)
            {
                if (!CheckContextChunk(a1, a2, (int)IA64Offsets.DbI0, (int)IA64Offsets.FltS0))
                {
                    return(false);
                }
            }

            // CONTEXT_FLOATING_POINT contains: FltS0 through StFPSR
            if ((a1.Flags & ContextFlags.IA64ContextFloatingPoint) == ContextFlags.IA64ContextFloatingPoint)
            {
                if (!CheckContextChunk(a1, a2, (int)IA64Offsets.FltS0, (int)IA64Offsets.StFPSR))
                {
                    return(false);
                }
            }

            return(true);
        }