Ignore:
Timestamp:
Nov 21, 2006, 5:33:25 PM (19 years ago)
Author:
bird
Message:

LX bugfixing. the unit test succeeds, but there are still things todo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/tstkLdrMod.c

    r2878 r2890  
    7979
    8080
     81/**
     82 * Verbose memcmp().
     83 */
     84static int TestMemComp(const void *pv1, const void *pv2, size_t cb)
     85{
     86    size_t          off;
     87    const uint8_t  *pb1 = (const uint8_t *)pv1;
     88    const uint8_t  *pb2 = (const uint8_t *)pv2;
     89    if (!memcmp(pb1, pb2, cb))
     90        return 0;
     91    printf("Mismatching blocks pv1=%p pv2=%p cb=%#x:\n", pv1, pv2, cb);
     92    for (off = 0; off < cb; off++)
     93    {
     94        if (pb1[off] == pb2[off])
     95            continue;
     96        printf("%08x %02x != %02x\n", off, pb1[off], pb2[off]);
     97    }
     98    return memcmp(pb1, pb2, cb); /* lazy */
     99}
     100
    81101
    82102/**
     
    97117    if (rc)
    98118        return Failure("failed to get image bits, rc=%d (a)", rc);
    99     if (memcmp(pvBits2, pvBits, cbImage))
     119    if (TestMemComp(pvBits2, pvBits, cbImage))
    100120        return Failure("relocation test failed, mismatching bits (a)");
    101121
     
    109129    if (rc)
    110130        return Failure("failed to relocate, rc=%d (b2)");
    111     if (memcmp(pvBits2, pvBits, cbImage))
     131    if (TestMemComp(pvBits2, pvBits, cbImage))
    112132        return Failure("relocation test failed, mismatching bits (b)");
    113133
     
    123143    if (rc)
    124144        return Failure("failed to get image bits, rc=%d (c1)", rc);
    125     if (memcmp(pvBits2, pvBits, cbImage))
     145    if (TestMemComp(pvBits2, pvBits, cbImage))
    126146        return Failure("relocation test failed, mismatching bits (c1)");
    127147
     
    134154    if (rc)
    135155        return Failure("failed to get image bits, rc=%d (c2)", rc);
    136     if (memcmp(pvBits2, pvBits, cbImage))
     156    if (TestMemComp(pvBits2, pvBits, cbImage))
    137157        return Failure("relocation test failed, mismatching bits (c2)");
    138158
     
    145165    if (rc)
    146166        return Failure("failed to get image bits, rc=%d (c3)", rc);
    147     if (memcmp(pvBits2, pvBits, cbImage))
     167    if (TestMemComp(pvBits2, pvBits, cbImage))
    148168        return Failure("relocation test failed, mismatching bits (c3)");
    149169
     
    156176    if (rc)
    157177        return Failure("failed to get image bits, rc=%d (c4)", rc);
    158     if (memcmp(pvBits2, pvBits, cbImage))
     178    if (TestMemComp(pvBits2, pvBits, cbImage))
    159179        return Failure("relocation test failed, mismatching bits (c4)");
    160180
     
    167187    if (rc)
    168188        return Failure("failed to get image bits, rc=%d (c5)", rc);
    169     if (memcmp(pvBits2, pvBits, cbImage))
     189    if (TestMemComp(pvBits2, pvBits, cbImage))
    170190        return Failure("relocation test failed, mismatching bits (c5)");
    171191
Note: See TracChangeset for help on using the changeset viewer.