Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Porting non-mmu code to MMU -- MMU memcpy SEGV

Thanks in Advance.

With the non-mmu nios2 our design defined sdram regions that we utilized for buffers in our custom device driver.

**** device driver

sharedMem = kmalloc( SHARED_MEMSIZE, GFP_USER );

if ( sharedMem == NULL)

{

res = -ENOMEM;

exit;

}

else

{

sharedMemVertAddr = ioremap( sharedMem, SHARED_MEMSIZE );

}

**** end device driver

So, in my user space code I have an ioctl that I call to get the address - "sharedMemAddr" from the driver then I do my:

memcpy( sharedMemAddr, (const void *)&sharedMem, sizeof(sharedMem) );

FOR THE MMU system I get -- "SEGV"

FOR THE non-MMU system the scheme works GREAT!

What do I need to do to get the MMU system to allow this type of "memcpy?"

11 Replies