Coffeehouse Thread

8 posts

MRT100, another version of Redhawk surfaces in Windows 8.1 ?

Back to Forum: Coffeehouse
  • felix9

    OK, here is a summary report of recent 'detective work' I've done around project Redhawk. Devil

    Apparently, besides the SLR100.dll as we've seen in Windows 8, there is another version/edition of Redhawk, with a file name MRT100.dll, and maybe we'll see some traces of it in Windows 8.1

    Lets start from May, as mentioned in this post, the ClrMD nuget package has support for Redhawk, and inside its code, we can see the 'Redhawk' it supports, has a name called 'MRT', and the file name of core runtime is 'MRT100.dll'.

    So, what's in a name ? what is 'MRT' ? I found some hints:

    MaryJo Foley: What would Windows be without Win32 ?

    The word is that the Midori folks are looking to RedHawk as the best way for Midori to get a commercial back-end compiler and minimal runtime.

    Mike Magrude's LinkedIn profile

    I worked on......a new "minimal runtime" to be used at low levels within Windows,.....

    So I guess MRT means Minimal Runtime, Smiley

    OK, so far all I got is a name, and there is more of couse, in next post.

  • magicalclick

    Does it mean consolidated API with faster and slimmer runtime? Great job with all the detective work. I would hire you to gather business secrets legally Tongue Out

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • felix9

    So in the end of June, Microsoft released Windows 8.1 Preview and .NET 4.5.1 Preview at BUILD, the good part of public preview is, the symbol packages are also released, and suprise, there are symbol packages for WOA, so I downloaded it out of curiousity, and suprise surprise, there is a mrt100.pdb file in WOA symbols ! and the x86/x64 symbols pack dont have it !

    So I used dia2dump and extracted the info from mrt100.pdb, and slr100.pdb from the same package, compared them, and got these results:

    slr100:

    c:\redhawk-win8\rh_min\ndp\rh\src\slr\minwin\objr\arm\dllmain.obj
    c:\redhawk-win8\rh_min\ndp\rh\src\slr\minwin\objr\arm\native.res
    c:\redhawk-win8\rh_min\ndp\rh\src\slr\minwin\objr\arm\slr100.exp
    objr\arm\palredhawkminwin.obj
    Import:msvcrt.dll
    Import:api-ms-win-core-sysinfo-l1-2-0.dll
    Import:api-ms-win-core-synch-l1-2-0.dll
    Import:api-ms-win-core-rtlsupport-l1-2-0.dll
    Import:api-ms-win-core-profile-l1-1-0.dll
    Import:api-ms-win-core-processthreads-l1-1-1.dll
    Import:api-ms-win-core-memory-l1-1-1.dll
    Import:api-ms-win-core-heap-l1-2-0.dll
    Import:api-ms-win-core-handle-l1-1-0.dll
    Import:api-ms-win-core-errorhandling-l1-1-1.dll
    Import:api-ms-win-core-debug-l1-1-1.dll
    Import:ntdll.dll

    mrt100:

    f:\dd\rh\src\slr\win32\objr\arm\dllmain.obj
    f:\dd\rh\src\slr\win32\objr\arm\native.res
    f:\dd\rh\src\slr\win32\objr\arm\mrt100.exp
    objr\arm\palredhawkwin32.obj
    Import:msvcrt.dll
    Import:KERNEL32.dll
    Import:ADVAPI32.dll

    As we can see here, the source code folder is called 'rh\src\slr', but slr100 is inside a 'minwin' subfolder, while mrt100 is inside a 'win32' subfolder, and slr100's PAL is 'palredhawkminwin', while mrt100's PAL is 'palredhawkwin32', and slr100 imports system dlls from 'api-ms-win-core-*', while mrt100 just uses KERNEL32 and ADVAPI32.

    So, apparently MRT100 is the 'Win32' version of Redhawk, and SLR100 is the 'MinWin' version. Why ? I guess that's because Redhawk is an experimental project, and the team is evaluating several options, like positioning the runtime at different layers of the system.

    (TBC in next post)

  • felix9

    In Windows 8.1 Preview, the slr/wcl dlls are essentially the same thing as in Windows 8 RTM, so what about mrt100 ? apparently, mrt100 has some more stuff than slr100, for example:

    RhGetLohCompactionMode
    RhSetLohCompactionMode
    protected: static enum SVR::gc_loh_compaction_mode SVR::gc_heap::loh_compaction_mode
    protected: static enum WKS::gc_loh_compaction_mode WKS::gc_heap::loh_compaction_mode

    LOH Compaction Mode is one of the new features of .NET 4.5.1, and I've also compared the clr.dll from .NET 4.5.1 Preview and .NET 4.5 RTM, many of the differences between MRT100/SLR100 are also the differences between CLR 4.5.1/CLR 4.5, things like 'GCStart_V2' and much more.

    So, we know the code base of mrt100 is actually in sync with the main CLR branch, and has the latest features merged in.

    And, there are evidences shows that mrt100 may support background/concurrent GC, which is not supported in slr100, and I suspect there are some differences in exception handling models between slr100/mrt100 too, along with MANY other things, so apparently mrt100 is a quite diffrent edition of Redhawk, with incompatible API and different behaviours, thats very interesting.

    and the last question is: why the hell is there a mrt100.pdb in the WOA version of Windows 8.1 Preview symbols, and not in x86/x64 versions ?? and NO other thing is using it ? is it just an accident ? or is it going to appear in some form ?? lets wait and see. Tongue Out

  • MasterPi

    @felix9: Thanks for the sleuthing! What do you do for a living? Are you a code detective? Cool

  • felix9

    @magicalclick: Haha, thanks, Tongue Out but unfortunately, I think MS' EULA prevents reverse engineering, so the legality is in question, however, as long as Rafeal Rivera can do that, I think its not a big problem. Devil

    @MasterPie: if thats a real job thn maybe I will be Cool

  • felix9

    well, while I'm at this, maybe I could report another detective work, about WP8/MDIL/Triton/Redhawk and CLR.

    as we know, Windows Phone 8 uses a version of CoreCLR with code name Triton, and it supports MDIL, and it has a 'binder' on the phone to compile MDIL into actual machine code.

    The 'binder' is called MDILBinder.exe, but its just a wrapper, and the actual work is done in a library called 'MDILNIGenLibrary.dll'.

    And guess what ? this library has something to do with Redhawk.

    lets check the module list using dia2dump and MDILNIGenLibrary.pdb:

    f:\binaries\Intermediate\SysBuild\clr\mdilnigenlibrary.nativeproj__1049768399\objr\arm\rhbind.obj
    f:\binaries\Intermediate\SysBuild\clr\mdilnigenlibrary.nativeproj__1049768399\objr\arm\RHCodeInfo.obj

    and the dll contains such error messages:

    RHBIND : error RHB0006: Could not load:  %s
    RHBIND : error RHB0011: Internal error.
    RHBIND : error RHB0001: Could not save image %s
    RHBIND : error RHB0005: Failed to merge specified images.
    RHBIND : error RHB0006: Could not load assembly.
    RHBIND : error RHB0008: Both include and coreclr style binding specified.
    RHBIND : error RHB0009: Primary image is minimal mdil image (and therefore cannot be bound directly)
    RHBIND : error RHB0010: Out of memory.
    error RHB0010: Could not load mdil even though assembly was found:  %s
    error RHB0008: Could not canonicalize:  %s

    See ? RHBIND !

    and, in slr100/wcl*.dll there are symbols like this:

    RHBinder__JumpStubSection
    RHBinder__LoopHijackStubsSection
    RHBinder__ModuleInit
    RHBinder__DllMain
    RHBinder__DllProcessAttach

    so apparently, this "MDILNIGenLibrary.dll" is actually ported from Redhawk's MDIL binder, possibly called 'RHBinder.exe'.

    what's more, mdilnigenlibrary.dll also contains a disassembler for MDIL, and when it parses the header struct of MDIL section, it displays the Platform_ID field like this:

    0: "PlatformID_Unknown"
    1: "PlatformID_Triton"
    2: "PlatformID_Redhawk"

    so apparently, Triton and Redhawk share the MDIL data format.

    Actually in the Bartok compiler in Singularity, we've already seen such things like ClrMdil and RedhawkMdil, so I guess Triton=ClrMdil.

    And lastly, what about the normal desktop CLR ?? will it support MDIL too ??

    actually, I found such an error message around CLR of .NET 4.5.1 Preview:

    in CorError.h: COR_E_UNSUPPORTEDMDIL EMAKEHR(0x153c)
    in mscorrc.dll, StringTable 1876:30012, "Valid IL which cannot be compiled into MDIL."

    also, in mscordacwks.dll, there is such a string "SECTION_MDILData"

    So, MAYBE.

  • felix9

    a little observations on the Windows RT 8.1 RTM bits of MRT100.dll

    1, the version is "1.0.30319.33440", for comparision, the clr.dll shipped with Windows 8.1 RTM has version "4.0.30319.33440", as you can see, the version/build numbers are in sync, and this never happened to slr100.dll, or preview version of mrt100.dll, so this is new in RTM, does it mean mrt100 is now a serious thing ?

    2, the internals and exports changed quite a bit since preview, for comparision, slr100.dll has almost no change since early builds of Windows 8, still the same thing in Windows 8.1, so does it mean mrt100 is still in active development ? and has a plan ?

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.