📄 fpparchlib.c
字号:
/* fppArchLib.c - architecture-dependent floating-point coprocessor support *//* Copyright 1984-1997 Wind River Systems, Inc. *//*modification history--------------------01e,27feb97,jpd added ARM-specific documentation.01d,25nov95,jdi removed 29k stuff.01c,31jan95,rhp update for MIPS R4000, AM29K, i386/i486. jdi changed 80960 to i960.01b,20jan93,jdi documentation cleanup.01a,23sep92,jdi written, based on fppALib.s and fppArchLib.c for mc68k, sparc, i960, mips.*//*DESCRIPTIONThis library contains architecture-dependent routines to support the floating-point coprocessor. The routines fppSave() and fppRestore() saveand restore all the task floating-point context information. The routinefppProbe() checks for the presence of the floating-point coprocessor. Theroutines fppTaskRegsSet() and fppTaskRegsGet() inspect and set coprocessorregisters on a per-task basis.With the exception of fppProbe(), the higher-level facilities in dbgLiband usrLib should be used instead of these routines. For information aboutarchitecture-independent access mechanisms, see the manual entry for fppLib.INITIALIZATIONTo activate floating-point support, fppInit() must be called before anytasks using the coprocessor are spawned. This is done by the root task,usrRoot(), in usrConfig.c. See the manual entry for fppLib.NOTE I386/I486On this architecture, VxWorks disables the six FPU exceptions that cansend an IRQ to the CPU.NOTE ARMThis architecture does not currently support floating-point coprocessors.INCLUDE FILES: fppLib.hSEE ALSO: fppLib, intConnect(),.nf.IR "Motorola MC68881/882 Floating-Point Coprocessor User's Manual" ,.IR "SPARC Architecture Manual" ,.IR "Intel 80960SA/SB Reference Manual" ,.IR "Intel 80960KB Programmer's Reference Manual" ,.IR "Intel 387 DX User's Manual" ,.fiGerry Kane and Joe Heinrich:.I "MIPS RISC Architecture Manual"*//********************************************************************************* fppSave - save the floating-point coprocessor context** This routine saves the floating-point coprocessor context.* The context saved is:** \&MC680x0:* - registers `fpcr', `fpsr', and `fpiar'* - registers `f0' - `f7'* - internal state frame (if NULL, the other registers are not saved.)** \&SPARC:* - registers `fsr' and `fpq'* - registers `f0' - `f31'** \&i960:* - registers `fp0' - `fp3'** \&MIPS:* - register `fpcsr'* - registers `fp0' - `fp31'** \&i386/i486:* - control word, status word, tag word, IP offset, CS selector,* data operand offset, and operand selector (4 bytes each)* - registers `st0' - `st7' (8 bytes each)** \&ARM:* - currently, on this architecture, this routine does nothing.** RETURNS: N/A** SEE ALSO: fppRestore()*/void fppSave ( FP_CONTEXT * pFpContext /* where to save context */ ) { ... }/********************************************************************************* fppRestore - restore the floating-point coprocessor context** This routine restores the floating-point coprocessor context.* The context restored is:** \&MC680x0:* - registers `fpcr', `fpsr', and `fpiar'* - registers `f0' - `f7'* - internal state frame (if NULL, the other registers are not saved.)** \&SPARC:* - registers `fsr' and `fpq'* - registers `f0' - `f31'** \&i960:* - registers `fp0' - `fp3'** \&MIPS:* - register `fpcsr'* - registers `fp0' - `fp31'** \&i386/i486:* - control word, status word, tag word, IP offset, CS selector,* data operand offset, and operand selector* - registers `st0' - `st7'** \&ARM:* - currently, on this architecture, this routine does nothing.** RETURNS: N/A** SEE ALSO: fppSave()*/void fppRestore ( FP_CONTEXT * pFpContext /* where to restore context from */ ) { ... }/********************************************************************************* fppProbe - probe for the presence of a floating-point coprocessor** This routine determines whether there is a* floating-point coprocessor in the system.** The implementation of this routine is architecture-dependent:** .IP "MC680x0, SPARC, i386/i486:"* This routine sets the illegal coprocessor opcode trap vector and executes* a coprocessor instruction. If the instruction causes an exception,* fppProbe() returns ERROR. Note that this routine saves and restores* the illegal coprocessor opcode trap vector that was there prior to this* call.** The probe is only performed the first time this routine is called.* The result is stored in a static and returned on subsequent* calls without actually probing.** .IP i960:* This routine merely indicates whether VxWorks was compiled with* the flag `-DCPU=I960KB'.** .IP MIPS:* This routine simply reads the R-Series status register and reports* the bit that indicates whether coprocessor 1 is usable. This bit* must be correctly initialized in the BSP.** .IP ARM:* This routine currently returns ERROR to indicate no floating-point coprocessor* support.* * INTERNAL* The STAR board will always have an on-board floating-point unit.* What about others?** RETURNS:* OK, or ERROR if there is no floating-point coprocessor.*/STATUS fppProbe (void) { ... }/********************************************************************************* fppTaskRegsGet - get the floating-point registers from a task TCB** This routine copies a task's floating-point registers and/or status* registers to the locations whose pointers are passed as* parameters. The floating-point registers are copied into* an array containing all the registers.** NOTE* This routine only works well if <task> is not the calling task.* If a task tries to discover its own registers, the values will be stale* (that is, left over from the last task switch).** RETURNS: OK, or ERROR if there is no floating-point* support or there is an invalid state.** SEE ALSO: fppTaskRegsSet()*/STATUS fppTaskRegsGet ( int task, /* task to get info about */ FPREG_SET * pFpRegSet /* ptr to floating-point register set */ ) { ... }/********************************************************************************* fppTaskRegsSet - set the floating-point registers of a task** This routine loads the specified values into the TCB of a specified task.* The register values are copied from the array at <pFpRegSet>.** RETURNS: OK, or ERROR if there is no floating-point* support or there is an invalid state.** SEE ALSO: fppTaskRegsGet()*/STATUS fppTaskRegsSet ( int task, /* task to set registers for */ FPREG_SET * pFpRegSet /* ptr to floating-point register set */ ) { ... }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -