02-21-2019 01:10 PM - edited 02-21-2019 01:11 PM
Using the UIO driver to allocate a section of memory and using mmap to get a pointer to virtual memory.
I can access the first couple bytes using memset(), but when I try to access the buffer size that I have allocated, I get a segmentation fault.
I checked that UIO driver is mapping the sections correctly, as disccused on the forumn https://forums.xilinx.com/t5/Embedded-Linux/XAPP1251-UIO-mmap-fails/m-p/857759#M26184
memset seg faults because it is trying to access a buffer bigger than the pointer can reach. But in fact the memory allocated is big enough
02-25-2019 03:30 AM
02-25-2019 04:47 PM
so mmap was working fine.
memset is causing the issue.
As a work around, I have the pointer from mmap (virtual memory) and wrote a for loop iterating over the size of my buffer. And I am incrementing the pointer up to the size of my buffer in Bytes. This works without any segmentation faults.
Why wouldn't memset work the same way? it could not aligning with one of the pages or some thing.
I would like to use memset() , any idea?