This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

armclang and memcpy: Weird behavior

Just for info:

armclang optimizes memcpy() in a weird way (seen for ARMv7e-M), not respecting the order of access.

So a memcpy(RBAR, mputable,...) failes :(

Parents
  • Following your hint, a similar search found the Linux kernel documentation about its IO access APIs. It mentions "Do not use memset or memcpy on IO addresses; they are not guaranteed to copy data in order."

    The doc suggests using memcpy_toio and memcpy_fromio to copy data between IO memory and the RAM. Although these versions copy data in order, their knowledge about specific IO access patterns is limited - they only attempt aligned (alignment of the IO address) transfers, by copying in small chunks around the largest possible (4 bytes max on x86, it seems) alignment.

    The Linux source for memset_io comments: "memset can mangle the IO patterns quite a bit."

Reply
  • Following your hint, a similar search found the Linux kernel documentation about its IO access APIs. It mentions "Do not use memset or memcpy on IO addresses; they are not guaranteed to copy data in order."

    The doc suggests using memcpy_toio and memcpy_fromio to copy data between IO memory and the RAM. Although these versions copy data in order, their knowledge about specific IO access patterns is limited - they only attempt aligned (alignment of the IO address) transfers, by copying in small chunks around the largest possible (4 bytes max on x86, it seems) alignment.

    The Linux source for memset_io comments: "memset can mangle the IO patterns quite a bit."

Children
No data