[Mono-dev] RVA Irregularities
Nathan McCauley
nathan.mccauley at gmail.com
Tue Jan 6 17:50:15 EST 2009
The following code excerpt from the attached C# program behaves differently
on Mono 2.0.1runtime for Windows and Mono 2.0.1 runtime on the OpenSUSE
VMWare image. It contains a lookup of the base address (contained in
getBaseAddress()). The loop should print the program's Main() function IL
code at runtime. This RVA was found by looking it up in ILDASM.
The program was compiled the MS compiler.
IntPtr baseAddr = getBaseAddress();
for (int offset = 0x211c; offset < 0x2169; offset++)
{
Console.WriteLine("Addr = {0:X}\tByte = {1:X}",
baseAddr.ToInt32() + offset,
Marshal.ReadByte(new IntPtr(baseAddr.ToInt32() + offset)));
}
It seems like the loader is behaving differently on each platform. Is there
something I should be doing to mitigate this behavior?
Windows Mono Runtime output:
Addr = 40211C Byte = 13
Addr = 40211D Byte = 30
Addr = 40211E Byte = 4
Addr = 40211F Byte = 0
Addr = 402120 Byte = 4B
Addr = 402121 Byte = 0
Addr = 402122 Byte = 0
Addr = 402123 Byte = 0
Addr = 402124 Byte = 2
Addr = 402125 Byte = 0
Addr = 402126 Byte = 0
Addr = 402127 Byte = 11
Addr = 402128 Byte = 28
Addr = 402129 Byte = 1
Addr = 40212A Byte = 0
Addr = 40212B Byte = 0
Addr = 40212C Byte = 6
Addr = 40212D Byte = A
Addr = 40212E Byte = 20
Addr = 40212F Byte = 1C
Addr = 402130 Byte = 21
Addr = 402131 Byte = 0
Addr = 402132 Byte = 0
Addr = 402133 Byte = B
Addr = 402134 Byte = 2B
Addr = 402135 Byte = 34
Addr = 402136 Byte = 72
Addr = 402137 Byte = 69
Addr = 402138 Byte = 0
Addr = 402139 Byte = 0
Linux Mono Runtime output:
Addr = B7DDB11C Byte = C
Addr = B7DDB11D Byte = 2
Addr = B7DDB11E Byte = 0
Addr = B7DDB11F Byte = 0
Addr = B7DDB120 Byte = 1
Addr = B7DDB121 Byte = 0
Addr = B7DDB122 Byte = 30
Addr = B7DDB123 Byte = 0
Addr = B7DDB124 Byte = 30
Addr = B7DDB125 Byte = 0
Addr = B7DDB126 Byte = 30
Addr = B7DDB127 Byte = 0
Addr = B7DDB128 Byte = 30
Addr = B7DDB129 Byte = 0
Addr = B7DDB12A Byte = 30
Addr = B7DDB12B Byte = 0
Addr = B7DDB12C Byte = 34
Addr = B7DDB12D Byte = 0
Addr = B7DDB12E Byte = 62
Addr = B7DDB12F Byte = 0
Addr = B7DDB130 Byte = 30
Addr = B7DDB131 Byte = 0
Addr = B7DDB132 Byte = 0
Addr = B7DDB133 Byte = 0
Addr = B7DDB134 Byte = 44
Addr = B7DDB135 Byte = 0
Addr = B7DDB136 Byte = E
Addr = B7DDB137 Byte = 0
Addr = B7DDB138 Byte = 1
Addr = B7DDB139 Byte = 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090106/f5101266/attachment.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RVALookup.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090106/f5101266/attachment.pl
More information about the Mono-devel-list
mailing list