📄 vmbaselib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/vmBaseLib.html - generated by refgen from vmBaseLib.c --> <title> vmBaseLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual : Libraries</i></a></p></blockquote><h1>vmBaseLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>vmBaseLib</strong> - base virtual memory support library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./vmBaseLib.html#vmBaseLibInit">vmBaseLibInit</a></i>( )</b> - initialize base virtual memory support<br><b><i><a href="./vmBaseLib.html#vmBaseGlobalMapInit">vmBaseGlobalMapInit</a></i>( )</b> - initialize global mapping<br><b><i><a href="./vmBaseLib.html#vmBaseStateSet">vmBaseStateSet</a></i>( )</b> - change the state of a block of virtual memory<br><b><i><a href="./vmBaseLib.html#vmBasePageSizeGet">vmBasePageSizeGet</a></i>( )</b> - return the page size<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides the minimal MMU (Memory Management Unit) support needed in a system. Its primary purpose is to create cache-safe buffers forcacheLib. Buffers are provided to optimize I/O throughput.<p>A call to <b><i><a href="./vmBaseLib.html#vmBaseLibInit">vmBaseLibInit</a></i>( )</b> initializes this library, thus permitting<b><i><a href="./vmBaseLib.html#vmBaseGlobalMapInit">vmBaseGlobalMapInit</a></i>( )</b> to initialize the MMU and set up MMU translation tables.Additionally, <b><i><a href="./vmBaseLib.html#vmBaseStateSet">vmBaseStateSet</a></i>( )</b> can be called to change the translation tables dynamically. <p>This library is a release-bundled complement to <b><a href="./vmLib.html#top">vmLib</a></b> and <b><a href="./vmShow.html#top">vmShow</a></b>, modules that offer full-featured MMU support and virtual memory informationdisplay routines. The <b><a href="./vmLib.html#top">vmLib</a></b> and <b><a href="./vmShow.html#top">vmShow</a></b> libraries are distributed as theunbundled virtual memory support option, VxVMI.<p></blockquote><h4>CONFIGURATION</h4><blockquote><p>Bundled MMU support is included in VxWorks when the configuration macro<b>INCLUDE_MMU_BASIC</b> is defined. If the configuration macro <b>INCLUDE_MMU_FULL</b>is also defined, the default is full MMU support (unbundled).<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>sysLib.h</b>, <b>vmLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./vmBaseLib.html#top">vmBaseLib</a></b>, <b><a href="./vmLib.html#top">vmLib</a></b>, <b><a href="./vmShow.html#top">vmShow</a></b>, <i>VxWorks Programmer's Guide: Virtual Memory</i><hr><a name="vmBaseLibInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>vmBaseLibInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>vmBaseLibInit</i>( )</strong> - initialize base virtual memory support</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS vmBaseLibInit ( int pageSize /* size of page */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes the virtual memory context class and module-specific data structures. It is called only once during system initialization, and should be followed with a call to <b><i><a href="./vmBaseLib.html#vmBaseGlobalMapInit">vmBaseGlobalMapInit</a></i>( )</b>, which initializes and enables the MMU.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./vmBaseLib.html#top">vmBaseLib</a></b>, <b><i><a href="./vmBaseLib.html#vmBaseGlobalMapInit">vmBaseGlobalMapInit</a></i>( )</b><hr><a name="vmBaseGlobalMapInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>vmBaseGlobalMapInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>vmBaseGlobalMapInit</i>( )</strong> - initialize global mapping</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>VM_CONTEXT_ID vmBaseGlobalMapInit ( PHYS_MEM_DESC * pMemDescArray, /* pointer to array of mem descs */ int numDescArrayElements, /* no. of elements in pMemDescArray */ BOOL enable /* enable virtual memory */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates and installs a virtual memory context with mappingsdefined for each contiguous memory segment defined in <i>pMemDescArray</i>.In the standard VxWorks configuration, an instance of <b>PHYS_MEM_DESC</b> (called<b>sysPhysMemDesc</b>) is defined in <b>sysLib.c</b>; the variable is passed to<b><i><a href="./vmBaseLib.html#vmBaseGlobalMapInit">vmBaseGlobalMapInit</a></i>( )</b> by the system configuration mechanism.<p>The physical memory descriptor also contains state informationused to initialize the state information in the MMU's translation tablefor that memory segment. The following state bits may be or'ed together:<p><table><tr valign=top><td align=left> <b>VM_STATE_VALID</b> </td><td align=left> <b>VM_STATE_VALID_NOT</b> </td><td align=left> valid/invalid</tr><tr valign=top><td align=left> <b>VM_STATE_WRITABLE</b> </td><td align=left> <b>VM_STATE_WRITABLE_NOT</b> </td><td align=left> writable/write-protected</tr><tr valign=top><td align=left> <b>VM_STATE_CACHEABLE</b> </td><td align=left> <b>VM_STATE_CACHEABLE_NOT</b> </td><td align=left> cacheable/not-cacheable</tr><tr valign=top><td align=left></tr></tr></table>Additionally, mask bits are or'ed together in the <b>initialStateMask</b> structureelement to describe which state bits are being specified in the <b>initialState</b>structure element:<p> <b>VM_STATE_MASK_VALID</b><br> <b>VM_STATE_MASK_WRITABLE</b><br> <b>VM_STATE_MASK_CACHEABLE</b><p>If <i>enable</i> is TRUE, the MMU is enabled upon return.<p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to a newly created virtual memory context, or NULL ifmemory cannot be mapped.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><i><a href="./vmBaseLib.html#vmBaseLibInit">vmBaseLibInit</a></i>( )</b><hr><a name="vmBaseStateSet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>vmBaseStateSet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>vmBaseStateSet</i>( )</strong> - change the state of a block of virtual memory</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS vmBaseStateSet ( VM_CONTEXT_ID context, /* context - NULL == currentContext */ void * pVirtual, /* virtual address to modify state of */ int len, /* len of virtual space to modify state of */ UINT stateMask, /* state mask */ UINT state /* state */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine changes the state of a block of virtual memory. Each pageof virtual memory has at least three elements of state information:validity, writability, and cacheability. Specific architectures maydefine additional state information; see <b>vmLib.h</b> for additionalarchitecture-specific states. Memory accesses to a page marked asinvalid will result in an exception. Pages may be invalidated to preventthem from being corrupted by invalid references. Pages may be defined asread-only or writable, depending on the state of the writable bits.Memory accesses to pages marked as not-cacheable will always result in amemory cycle, bypassing the cache. This is useful for multiprocessing,multiple bus masters, and hardware control registers.<p>The following states are provided and may be or'ed together in the state parameter: <p><table><tr valign=top><td align=left> <b>VM_STATE_VALID</b> </td><td align=left> <b>VM_STATE_VALID_NOT</b> </td><td align=left> valid/invalid</tr><tr valign=top><td align=left> <b>VM_STATE_WRITABLE</b> </td><td align=left> <b>VM_STATE_WRITABLE_NOT</b> </td><td align=left> writable/write-protected</tr><tr valign=top><td align=left> <b>VM_STATE_CACHEABLE</b> </td><td align=left> <b>VM_STATE_CACHEABLE_NOT</b> </td><td align=left> cacheable/not-cacheable</tr><tr valign=top><td align=left></tr></tr></table>Additionally, the following masks are provided so that only specificstates may be set. These may be or'ed together in the <b>stateMask</b> parameter. <p> <b>VM_STATE_MASK_VALID</b><br> <b>VM_STATE_MASK_WRITABLE</b><br> <b>VM_STATE_MASK_CACHEABLE</b><p>If <i>context</i> is specified as NULL, the current context is used.<p>This routine is callable from interrupt level.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the validation fails, <i>pVirtual</i> is not on a pageboundary, <i>len</i> is not a multiple of the page size, or thearchitecture-dependent state set fails for the specified virtual address.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>S_vmLib_NOT_PAGE_ALIGNED,S_vmLib_BAD_STATE_PARAM,S_vmLib_BAD_MASK_PARAM</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./vmBaseLib.html#top">vmBaseLib</a></b><hr><a name="vmBasePageSizeGet"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>vmBasePageSizeGet</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>vmBasePageSizeGet</i>( )</strong> - return the page size</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int vmBasePageSizeGet (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the architecture-dependent page size.<p>This routine is callable from interrupt level.<p></blockquote><h4>RETURNS</h4><blockquote><p>The page size of the current architecture.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./vmBaseLib.html#top">vmBaseLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -