⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fpparchlib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/fppArchLib.html - generated by refgen from fppArchLib.c --> <title> fppArchLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference :  OS Libraries</i></a></p></blockquote><h1>fppArchLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>fppArchLib</strong> - architecture-dependent floating-point coprocessor support </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./fppArchLib.html#fppSave">fppSave</a>(&nbsp;)</b>  -  save the floating-point coprocessor context<br><b><a href="./fppArchLib.html#fppRestore">fppRestore</a>(&nbsp;)</b>  -  restore the floating-point coprocessor context<br><b><a href="./fppArchLib.html#fppProbe">fppProbe</a>(&nbsp;)</b>  -  probe for the presence of a floating-point coprocessor<br><b><a href="./fppArchLib.html#fppTaskRegsGet">fppTaskRegsGet</a>(&nbsp;)</b>  -  get the floating-point registers from a task TCB<br><b><a href="./fppArchLib.html#fppTaskRegsSet">fppTaskRegsSet</a>(&nbsp;)</b>  -  set the floating-point registers of a task<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library contains architecture-dependent routines to support the floating-point coprocessor.  The routines <b><a href="./fppArchLib.html#fppSave">fppSave</a>(&nbsp;)</b> and <b><a href="./fppArchLib.html#fppRestore">fppRestore</a>(&nbsp;)</b> saveand restore all the task floating-point context information.  The routine<b><a href="./fppArchLib.html#fppProbe">fppProbe</a>(&nbsp;)</b> checks for the presence of the floating-point coprocessor.  Theroutines <b><a href="./fppArchLib.html#fppTaskRegsSet">fppTaskRegsSet</a>(&nbsp;)</b> and <b><a href="./fppArchLib.html#fppTaskRegsGet">fppTaskRegsGet</a>(&nbsp;)</b> inspect and set coprocessorregisters on a per-task basis.<p>With the exception of <b><a href="./fppArchLib.html#fppProbe">fppProbe</a>(&nbsp;)</b>, the higher-level facilities in <b><a href="./dbgLib.html#top">dbgLib</a></b>and <b><a href="./usrLib.html#top">usrLib</a></b> should be used instead of these routines.  For information aboutarchitecture-independent access mechanisms, see the manual entry for <b><a href="./fppLib.html#top">fppLib</a></b>.<p></blockquote><h4>INITIALIZATION</h4><blockquote><p>To activate floating-point support, <b><a href="./fppLib.html#fppInit">fppInit</a>(&nbsp;)</b> must be called before anytasks using the coprocessor are spawned.  This is done by the root task,<b><a href="./usrConfig.html#usrRoot">usrRoot</a>(&nbsp;)</b>, in <b>usrConfig.c</b>.  See the manual entry for <b><a href="./fppLib.html#top">fppLib</a></b>.<p></blockquote><h4>NOTE X86</h4><blockquote><p><p>There are two kind of floating-point contexts and set of routines for each kind.  One is 108 bytes for older FPU (i80387, i80487, Pentium) and older MMX technology and <b><a href="./fppArchLib.html#fppSave">fppSave</a>(&nbsp;)</b>, <b><a href="./fppArchLib.html#fppRestore">fppRestore</a>(&nbsp;)</b>, <b>fppRegsToCtx(&nbsp;)</b>, and <b>fppCtxToRegs(&nbsp;)</b> are used to save and restore the context, convert to or from the <b>FPPREG_SET</b>.The other is 512 bytes for newer FPU, newer MMX technology and streaming SIMD technology (PentiumII, III, 4) and <b>fppXsave(&nbsp;)</b>, <b>fppXrestore(&nbsp;)</b>, <b>fppXregsToCtx(&nbsp;)</b>, and <b>fppXctxToRegs(&nbsp;)</b> are used to save and restore the context, convert to or from the <b>FPPREG_SET</b>.  Which to use is automatically detected by checking CPUID information in <b>fppArchInit(&nbsp;)</b>.  And <b><a href="./fppArchLib.html#fppTaskRegsSet">fppTaskRegsSet</a>(&nbsp;)</b> and <b><a href="./fppArchLib.html#fppTaskRegsGet">fppTaskRegsGet</a>(&nbsp;)</b> access the appropriate floating-point context.  The bit interrogated for the automatic detection is the "Fast Save and Restore" feature flag.<p></blockquote><h4>NOTE X86 INITIALIZATION</h4><blockquote><p><p>To activate floating-point support, <b><a href="./fppLib.html#fppInit">fppInit</a>(&nbsp;)</b> must be called before anytasks using the coprocessor are spawned.  If <b>INCLUDE_FLOATING_POINT</b> isdefined in <b>configAll.h</b>, this is done by the root task, <b><a href="./usrConfig.html#usrRoot">usrRoot</a>(&nbsp;)</b>, in<b>usrConfig.c</b>.<p></blockquote><h4>NOTE X86 VX FP TASK OPTION</h4><blockquote><p><p>Saving and restoring floating-point registers adds to the context switchtime of a task.Therefore, floating-point registers are <i>not</i> saved and restored for <i>every</i> task.  Only those tasks spawned with the task option <b>VX_FP_TASK</b>will have floating-point state, MMX technology state, and streaming SIMD state saved and restored.  <p><b>NOTE:</b>  If a task does any floating-point operations, MMX operations,and streaming SIMD operation, it must be spawned with <b>VX_FP_TASK</b>.It is deadly to execute any floating-point operations in a task spawned without <b>VX_FP_TASK</b> option, and very difficult to find.  To detect thatillegal/unintentional/accidental floating-point operations, a new API andmechanism is added.  The mechanism is to enable or disable the FPU by toggling the TS flag in the CR0 in the new task switch hook routine -<b>fppArchSwitchHook(&nbsp;)</b> - respecting the <b>VX_FP_TASK</b> option.  If <b>VX_FP_TASK</b>option is not set in the switching-in task, the FPU is disabled.  Thusthe device-not-available exception will be raised if that task does any floating-point operations.  This mechanism is disabled in the default.To enable, call the enabler - <b>fppArchSwitchHookEnable(&nbsp;)</b> - with a parameter TRUE(1).  A parameter FALSE(0) disables the mechanism.<p></blockquote><h4>NOTE X86 MIXING MMX AND FPU INSTRUCTIONS</h4><blockquote><p><p>A task with <b>VX_FP_TASK</b> option saves and restores the FPU and MMX statewhen performing a context switch.  Therefore, the application does nothave to save or restore the FPU and MMX state if the FPU and MMX instructions are not mixed within a task.  Because the MMX registersare aliased to the FPU registers, care must be taken when makingtransitions between FPU instructions and MMX instructions to preventthe loss of data in the FPU and MMX registers and to prevent incoherentor unexpected result.  When mixing MMX and FPU instructions within a task, follow these guidelines from Intel:<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Keep&nbsp;the&nbsp;code&nbsp;in&nbsp;separate&nbsp;modules,&nbsp;procedures,&nbsp;or&nbsp;routines.<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Do&nbsp;not&nbsp;rely&nbsp;on&nbsp;register&nbsp;contents&nbsp;across&nbsp;transitions&nbsp;between&nbsp;FPU<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;MMX&nbsp;code&nbsp;modules.<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;When&nbsp;transitioning&nbsp;between&nbsp;MMX&nbsp;code&nbsp;and&nbsp;FPU&nbsp;code,&nbsp;save&nbsp;the&nbsp;MMX<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register&nbsp;state&nbsp;(if&nbsp;it&nbsp;will&nbsp;be&nbsp;needed&nbsp;in&nbsp;the&nbsp;future)&nbsp;and&nbsp;execute<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;EMMS&nbsp;instruction&nbsp;to&nbsp;empty&nbsp;the&nbsp;MMX&nbsp;state.<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;When&nbsp;transitioning&nbsp;between&nbsp;FPU&nbsp;and&nbsp;MMX&nbsp;code,&nbsp;save&nbsp;the&nbsp;FPU&nbsp;state,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;it&nbsp;will&nbsp;be&nbsp;needed&nbsp;in&nbsp;the&nbsp;future.<p></blockquote><h4>NOTE X86 MIXING SSE SSE2 FPU AND MMX INSTRUCTIONS</h4><blockquote><p><p>The XMM registers and the FPU/MMX registers represent separate execution environments, which has certain ramifications when executingSSE, SSE2, MMX and FPU instructions in the same task context:<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Those&nbsp;SSE&nbsp;and&nbsp;SSE2&nbsp;instruction&nbsp;that&nbsp;operate&nbsp;only&nbsp;on&nbsp;the&nbsp;XMM&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;registers&nbsp;(such&nbsp;as&nbsp;the&nbsp;packed&nbsp;and&nbsp;scalar&nbsp;floating-point<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;instructions&nbsp;and&nbsp;the&nbsp;128-bit&nbsp;SIMD&nbsp;integer&nbsp;instructions)&nbsp;can&nbsp;be<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executed&nbsp;in&nbsp;the&nbsp;same&nbsp;instruction&nbsp;stream&nbsp;with&nbsp;64-bit&nbsp;SIMD&nbsp;integer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;FPU&nbsp;instructions&nbsp;without&nbsp;any&nbsp;restrictions.&nbsp;&nbsp;For&nbsp;example,&nbsp;an<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;application&nbsp;can&nbsp;perform&nbsp;the&nbsp;majority&nbsp;of&nbsp;its&nbsp;floating-point&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;computations&nbsp;in&nbsp;the&nbsp;XMM&nbsp;registers,&nbsp;using&nbsp;the&nbsp;packed&nbsp;and&nbsp;scalar<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;floating-point&nbsp;instructions,&nbsp;and&nbsp;at&nbsp;the&nbsp;same&nbsp;time&nbsp;use&nbsp;the&nbsp;FPU<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;perform&nbsp;trigonometric&nbsp;and&nbsp;other&nbsp;transcendental&nbsp;computations.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Likewise,&nbsp;an&nbsp;application&nbsp;can&nbsp;perform&nbsp;packed&nbsp;64-bit&nbsp;and&nbsp;128-bit<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SIMD&nbsp;integer&nbsp;operations&nbsp;can&nbsp;be&nbsp;executed&nbsp;together&nbsp;without<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restrictions.<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Those&nbsp;SSE&nbsp;and&nbsp;SSE2&nbsp;instructions&nbsp;that&nbsp;operate&nbsp;on&nbsp;MMX&nbsp;registers<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(such&nbsp;as&nbsp;the&nbsp;CVTPS2PI,&nbsp;CVTTPS2PI,&nbsp;CVTPI2PS,&nbsp;CVTPD2PI,&nbsp;CVTTPD2PI,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CVTPI2PD,&nbsp;MOVDQ2Q,&nbsp;MOVQ2DQ,&nbsp;PADDQ,&nbsp;and&nbsp;PSUBQ&nbsp;instructions)&nbsp;can<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;also&nbsp;be&nbsp;executed&nbsp;in&nbsp;the&nbsp;same&nbsp;instruction&nbsp;stream&nbsp;as&nbsp;64-bit&nbsp;SIMD<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;integer&nbsp;or&nbsp;FPU&nbsp;instructions,&nbsp;however,&nbsp;here&nbsp;they&nbsp;subject&nbsp;to&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restrictions&nbsp;on&nbsp;the&nbsp;simultaneous&nbsp;use&nbsp;of&nbsp;MMX&nbsp;and&nbsp;FPU&nbsp;instructions,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;which&nbsp;mentioned&nbsp;in&nbsp;the&nbsp;previous&nbsp;paragraph.<p></blockquote><h4>NOTE X86 INTERRUPT LEVEL</h4><blockquote><p><p>Floating-point registers are <i>not</i> saved and restored for interruptservice routines connected with <b><a href="./intArchLib.html#intConnect">intConnect</a>(&nbsp;)</b>.  However, if necessary,an interrupt service routine can save and restore floating-point registersby calling routines in <b>fppALib</b>.  See the manual entry for <b><a href="./intArchLib.html#intConnect">intConnect</a>(&nbsp;)</b> formore information.<p></blockquote><h4>NOTE X86 EXCEPTIONS</h4><blockquote><p><p>There are six FPU exceptions that can send an exception to the CPU.  They are controlled by Exception Mask bits of the Control Word register.  VxWorks disables them in the default configuration.  They are:<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Precision<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Overflow<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Underflow<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Division&nbsp;by&nbsp;zero<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Denormalized&nbsp;operand<br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Invalid&nbsp;Operation<p></blockquote><h4>NOTE ARM</h4><blockquote><p>This architecture does not currently support floating-point coprocessors.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>fppLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./fppLib.html#top">fppLib</a></b>, <b><a href="./intArchLib.html#intConnect">intConnect</a>(&nbsp;)</b>,<table><tr valign=top><td align=left><i>Motorola MC68881/882 Floating-Point Coprocessor User's Manual</i>,</tr><tr valign=top><td align=left><i>Intel 387 DX User's Manual</i>,</tr><tr valign=top><td align=left><i>Intel Architecture Software Developer's Manual</i>,</tr><tr valign=top><td align=left><i>Hitachi SH7750 Hardware Manual</i>,</tr><tr valign=top><td align=left></tr></tr></table>Gerry Kane and Joe Heinrich:<i>MIPS RISC Architecture Manual </i><hr><a name="fppSave"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>fppSave(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>fppSave(&nbsp;)</strong> - save the floating-point coprocessor context</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void fppSave    (    FP_CONTEXT * pFpContext   /* where to save context */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine saves the floating-point coprocessor context.The context saved is:<p><b>MC680x0</b>:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;registers&nbsp;<b>fpcr</b>,&nbsp;<b>fpsr</b>,&nbsp;and&nbsp;<b>fpiar</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;registers&nbsp;<b>f0</b>&nbsp;-&nbsp;<b>f7</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;internal&nbsp;state&nbsp;frame&nbsp;(if&nbsp;NULL,&nbsp;the&nbsp;other&nbsp;registers&nbsp;are&nbsp;not&nbsp;saved.)<p><b>MIPS</b>:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;register&nbsp;<b>fpcsr</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;registers&nbsp;<b>fp0</b>&nbsp;-&nbsp;<b>fp31</b><p><b>SH-4</b>:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;registers&nbsp;<b>fpcsr</b>&nbsp;and&nbsp;<b>fpul</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;registers&nbsp;<b>fr0</b>&nbsp;-&nbsp;<b>fr15</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;registers&nbsp;<b>xf0</b>&nbsp;-&nbsp;<b>xf15</b><p><b>x86</b>:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;108&nbsp;byte&nbsp;old&nbsp;context&nbsp;with&nbsp;fsave&nbsp;and&nbsp;frstor&nbsp;instruction<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;control&nbsp;word,&nbsp;status&nbsp;word,&nbsp;tag&nbsp;word,&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;instruction&nbsp;pointer,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;instruction&nbsp;pointer&nbsp;selector,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;last&nbsp;FP&nbsp;instruction&nbsp;op&nbsp;code,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;data&nbsp;pointer,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;data&nbsp;pointer&nbsp;selector,<br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -