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

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    --- Quote Start ---

    I've "THINK" I have properly requested four minor numbers for my driver.

    When I open "/dev/mine1" and try and do the mmap from user space the mmap function IS NOT entered!!

    So, I'm figuring I have done something incorrectly when doing the cdev_add and the driver funtions are not properly being pointed to --- but it looks like what Rubini has...

    --- Quote End ---

    What error code does the 'mmap' return ? It seems that you can open "/dev/mine1", so please check it in your function 'mine_open'.

    Kazu