Coffeehouse Post

Single Post Permalink

View Thread: MRT100, another version of Redhawk surfaces in Windows 8.1 ?
  • 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.