Author: martin
Date: 2008-02-15 06:57:10 -0500 (Fri, 15 Feb 2008)
New Revision: 95736

Modified:
   branches/martin/debugger-terrania/debugger/backend/arch/X86_Instruction.cs
   branches/martin/debugger-terrania/debugger/classes/TargetBinaryReader.cs
Log:
2008-02-15  Martin Baulig  <[EMAIL PROTECTED]>

        * classes/TargetBinaryReader.cs
        (TargetBinaryReader): Added ReadSByte() and PeekSByte().

        * backend/arch/X86_Instruction.cs: Use ReadSByte(), not ReadByte().



Modified: 
branches/martin/debugger-terrania/debugger/backend/arch/X86_Instruction.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/backend/arch/X86_Instruction.cs  
2008-02-15 11:55:15 UTC (rev 95735)
+++ branches/martin/debugger-terrania/debugger/backend/arch/X86_Instruction.cs  
2008-02-15 11:57:10 UTC (rev 95736)
@@ -302,10 +302,10 @@
                                DecodeModRM (reader);
 
                        if ((opcode >= 0x70) && (opcode <= 0x7f)) {
-                               CallTarget = Address + reader.ReadByte () + 2;
+                               CallTarget = Address + 
reader.BinaryReader.ReadSByte () + 2;
                                type = Type.ConditionalJump;
                        } else if ((opcode >= 0xe0) && (opcode <= 0xe3)) {
-                               CallTarget = Address + reader.ReadByte () + 2;
+                               CallTarget = Address + 
reader.BinaryReader.ReadSByte () + 2;
                                type = Type.ConditionalJump;
                        } else if ((opcode == 0xe8) || (opcode == 0xe9)) {
                                if ((RexPrefix & X86_REX_Prefix.REX_W) != 0) {
@@ -324,7 +324,7 @@
                                }
                                type = (opcode == 0xe8) ? Type.Call : Type.Jump;
                        } else if (opcode == 0xeb) {
-                               CallTarget = Address + reader.ReadByte () + 2;
+                               CallTarget = Address + 
reader.BinaryReader.ReadSByte () + 2;
                                type = Type.Jump;
                        } else if (opcode == 0xc3) {
                                type = Type.Ret;
@@ -421,7 +421,7 @@
                        if (ModRM.Mod == 0) {
                                dereference_addr = true;
                        } else if (ModRM.Mod == 1) {
-                               displacement = reader.ReadByte ();
+                               displacement = reader.BinaryReader.ReadSByte ();
                                dereference_addr = true;
                        } else if (ModRM.Mod == 2) {
                                displacement = reader.BinaryReader.ReadInt32 ();

Modified: 
branches/martin/debugger-terrania/debugger/classes/TargetBinaryReader.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/classes/TargetBinaryReader.cs    
2008-02-15 11:55:15 UTC (rev 95735)
+++ branches/martin/debugger-terrania/debugger/classes/TargetBinaryReader.cs    
2008-02-15 11:57:10 UTC (rev 95736)
@@ -32,6 +32,16 @@
                        return blob.Contents[pos++];
                }
 
+               public sbyte PeekSByte ()
+               {
+                       return (sbyte) blob.Contents[pos];
+               }
+
+               public sbyte ReadSByte ()
+               {
+                       return (sbyte) blob.Contents[pos++];
+               }
+
                public short PeekInt16 (long pos)
                {
                        if (swap)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to