5.2.5 Map Memory

  • ER MapMemory( VP paddr, INT len, UINT attr, VP *laddr )

Maps len bytes area which starts from paddr in the physical address to logical area returning thelogical address in *laddr.

The logical address is not to be specified, automatically allocated.

If paddr = NULL is specified, some continuous memory in physical memory is automatically allocated and mapped to logical area.

The mapped logical area has attributes specified with attr

attr := (MM_USER || MM_SYTEM ) | [MM_READ] | [MM_WRITE] | [MM_EXECUTE] | [MM_CDIS]

MM USER User level access

MM SYSTEM System level access

MM READ Read access

MM WRITE Write access

MM EXECUTE Execution

MM CDIS Disable cache

These symbols di.er from every machines. It requires these symbols to use. Some machines need other attributes except for these show above.

E_LIMIT Insufficient logical area for mapping

E_NOMEM Insufficient memory

  • ER UnmapMemory( VP laddr )

Unmaps logical area which allocated by MapMemory().

The logical address allocated by MapMemory() must be set to laddr. If some memory is allocated by MapMemory(), the memory is also unmapped.

Comments