Forum Discussion

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

How to port the mmap function?

One Unix implementation use the mmap function and /dev/zero to fulfill the virtual memory.

How could I port such functionality onto Nios II? Must I include the OS? Can HAL solve the problem?

2 Replies

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

    Hi neo,

    > ... use the mmap function and /dev/zero to fulfill the virtual memory.

    > How could I port such functionality onto Nios II?

    I'm not sure what you're asking ... Nios-II does not have

    an MMU ... there's no virtual memory. Do you just want to

    clear memory?

    Regards,

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

    What are you planning to use your virtual memory for, and what will you use as the backing store for it?

    Neither the HAL nor any other OS I'm aware of supports virtual memory (or the mmap function) - as has been pointed out it will be hard for them to do so until we have an MMU.

    As I said in another post, it might be possible, without an MMU, to implement a subset of mmap for file access, but it will be less efficient than using read/write.