30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

224 CHAPTER 5. T-KERNEL/SM<br />

5.2.4 Get Physical Address<br />

• INT CnvPhysicalAddr( VP vaddr, INT len, VP *paddr )<br />

vaddr<br />

len<br />

paddr<br />

return code<br />

Local address<br />

Memory space size (in bytes)<br />

Returns physical address<br />

Returns size (in bytes) of physical address contiguous space, or error<br />

Gets the physical address corresponding to logical address vaddr, returning the result in paddr.<br />

This function also passes in the return code the size of contiguous space included in len bytes<br />

from vaddr. Accordingly, only the space of the size passed in the return code starting from paddr<br />

is valid.<br />

The space for which the physical address is obtained must be locked (made resident).<br />

On the assumption of DMA transfer, memory caching is turned off for the space whose physical<br />

address is obtained (the memory space starting from paddr of the size passed in the return code).<br />

When the space is made nonresident (unlocked), caching goes back on.<br />

Note that if a hardware limitation makes it disable to make memory cached off partly, the system<br />

call flush the cache memory (that is, write back it and make it disable).<br />

E MACV<br />

5.2.5 Map Memory<br />

The memory does not exist<br />

• ER MapMemory( VP paddr, INT len, UINT attr, VP *laddr )<br />

Maps len bytes area which starts from paddr in the physical address to logical area returning the<br />

logical address in *laddr.<br />

The logical address is not to be specified, automatically allocated.<br />

If paddr = NULL is specified, some continuous memory in physical memory is automatically<br />

allocated and mapped to logical area.<br />

The mapped logical area has attributes specified with attr<br />

attr := (MM_USER || MM_SYTEM ) | [MM_READ] | [MM_WRITE] | [MM_EXECUTE] | [MM_CDIS]<br />

MM USER<br />

MM SYSTEM<br />

MM READ<br />

MM WRITE<br />

MM EXECUTE<br />

MM CDIS<br />

User level access<br />

System level access<br />

Read access<br />

Write access<br />

Execution<br />

Disable cache<br />

These symbols differ from every machines. It requires these symbols to use. Some machines need<br />

other attributes except for these show above.<br />

E LIMIT<br />

E NOMEM<br />

Insufficient logical area for mapping<br />

Insufficient memory<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!