Part Number: AM625
Tool/software:
Say I have a memory mapping created as follows:
inf mem_file = open("/dev/mem", O_RDWR | O_SYNC );
// choose some physical address that is reserved and safe to use
void * vaddr = mmap(0, 64*1024, PROT_READ | PROT_WRITE, MAP_SHARED, mem_file, 0x91000000);
On my AM62 system, if I memset() vaddr, my application gets thrown a SIGBUS. However, use vaddr with regular for loops and pointer based access, there is no such error.
While I am able to interact with the mapped memory using aligned pointer based accesses, attempting to memset that region triggers a SIGBUS.
At first I thought it might be a `memset()` issue but that didn't make much sense since by now that would've come up in other use cases. Also, if I try this:
char some_mem[64*1024]; memset(some_mem,0,64*1024);
it runs just fine, as expected.
So, my gut feeling is that something at the kernel level, below "/dev/mem" is causing an alignment error or something that triggers the SIGBUS.
If the sparse bits of information above aren't enough to bring light to the issue, please let me know and I can create a minimum example to reproduce the problem. The only caveat is that it'll likely require a devicetree tweak to reserve some memory so that the test can be safely executed.
Best regards,
António