cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
496 Views
Registered: ‎06-27-2018

UIO mmap memory allocated size incorrectly

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

 

 

 

0 Kudos
2 Replies
Highlighted
Explorer
Explorer
442 Views
Registered: ‎06-03-2015

Hi 

please checkc the user spce memory driver example usage with Zynq bords of DMA peripheral

https://github.com/ikwzm/udmabuf

Thanks & Regards

Satish G

 

 

G Satish Kumar
0 Kudos
Highlighted
Visitor
Visitor
423 Views
Registered: ‎06-27-2018

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?

 

 

0 Kudos