none
[Wince7] UNALIGNED issue on ARMv5 RRS feed

  • Question

  • following cases are successful at CE5.0 and 6.0 but it will occur "data abort" at CE7 ARMv5

    why?

    1.

    PENTRY UNALIGNED pEntry = NULL;

    pEntry = (PENTRY) pPos;  // pPos is odd

    Var = pEntry->ulVar; // address of pEntry->ulVar is unaligned, data abort!

     

    2.

    PENTRY pEntry = NULL;

    pEntry = (PENTRY) pPos;  // pPos is odd

    Var = (UNALIGNED) pEntry->ulVar; // address of pEntry->ulVar is unaligned, data abort!

     

    3.

    PENTRY pEntry = NULL;

    pEntry = (PENTRY) pPos;  // pPos is odd

    memcpy(&Var, &pEntry->ulVar, sizeof(ULONG)); // address of pEntry->ulVar is unaligned, data abort!

     

    *it will not occur data abort when I write it like this

    PENTRY pEntry = NULL;

    pEntry = (PENTRY) pPos;  // pPos is odd

    Var = (UNALIGNED UCHAR) pEntry->ulVar;

     

    but it just not correct, the data size will be cut off.

    Thursday, June 16, 2011 3:49 AM

All replies