[Cortex-A53] STP instruction stores out of the specified memory

Hi Experts,

     I have a question about "STP" instruction in Cortex-A53.

     STP W6, W6, [SP, #20]  --> after it executes, the memory of [sp, #16] and [sp, #28] are corrupted.

     I don't know why cause it. 

    Can you help to explain the reason? 

    The environment is:

       Before STP executes:

             W6=0x10, SP=0xFFFD36D0, MMU disable, dcache disable, icache enable.

             memory content is:

             [0xFFFD36E0]:  0xFFFD3740 0x00000000 0x00000001 0xFFFD3750

      After STP executes:

             memory content is:

             [0xFFFD36E0]:  0x00000000 0x00000010 0x00000010 0x00100000

      Thanks for your attention!

Best Regards,

Emmy

Parents
  • Hmm, at first sight it looks okey but a couple of things to consider:

    - Stack Pointer must be 16 byte aligned but it seem it is in your case
    - have you tried with w6 and any other register, eg. w7
    - you have no MMU and hence the memory is not attributed to Memory but to Device. You seem executing code from Devices then which is

    " Trying to execute code from a region marked as Device, is generally UNPREDICTABLE. The
    implementation might either handle the instruction fetch as if it were to a memory location with
    the Normal non-cacheable attribute, or it might take a permission fault. "

    so can you try map the region to Memory and re-test?

    - then if you operate on data from Device then you should not cross the 4K Byte boundary but you seem not in this case.
    - are you sure nothing else is writing to the adjacent addresses? Another cpu? Are you doing the test from when kernel is up or from within the boot loader?

Reply
  • Hmm, at first sight it looks okey but a couple of things to consider:

    - Stack Pointer must be 16 byte aligned but it seem it is in your case
    - have you tried with w6 and any other register, eg. w7
    - you have no MMU and hence the memory is not attributed to Memory but to Device. You seem executing code from Devices then which is

    " Trying to execute code from a region marked as Device, is generally UNPREDICTABLE. The
    implementation might either handle the instruction fetch as if it were to a memory location with
    the Normal non-cacheable attribute, or it might take a permission fault. "

    so can you try map the region to Memory and re-test?

    - then if you operate on data from Device then you should not cross the 4K Byte boundary but you seem not in this case.
    - are you sure nothing else is writing to the adjacent addresses? Another cpu? Are you doing the test from when kernel is up or from within the boot loader?

Children
More questions in this forum