D.3   Interface Variations

This section describes particular features and routines that are specific to x86 targets in any of the following ways:

For complete documentation, see the reference entries.

Supported Routines in mathALib

For x86 targets, the following floating-point routines are supported. These routines are also available without a hardware floating-point processor by selecting INCLUDE_SW_FP for inclusion in the project facility VxWorks view. For more information about configuring the software floating-point emulation library, see Software Floating-Point Emulation. See mathALib and the individual manual entries for descriptions of each routine.

acos( )

asin( )

atan( )

atan2( )

ceil( )

cos( )

exp( )

fabs( )

floor( )

fmod( )

infinity( )

irint( )

iround( )

log( )

log10( )

log2( )

pow( )

round( )

sin( )

sincos( )

sqrt( )

tan( )

trunc( )

Architecture-Specific Global Variables

The file sysLib.c contains the global variables shown in Table D-1.

Table D-1:  Architecture-Specific Global Variables  


Global Variable
Value
Description

sysVectorIRQ0  
0x20 (default) 
A mapping of the base vector for IRQ0.  
sysIntIdtType  
0x0000fe00
     (default)
     = trap gate 
0x0000ee00
     = interrupt gate 
Used when VxWorks initializes the interrupt vector table. The choice of trap gate vs. interrupt gate affects all interrupts (vectors 0x20 through 0xff). 
sysGDT[]  
0x3ff limit (default) 
The Global Descriptor Table has five entries. The first is a null descriptor. The second and third are for task-level routines. The fourth is for interrupt-level routines. The fifth is reserved. 
sysProcessor  
0 = i386
1 = i486
2 = Pentium
4 = PentiumPro 
The processor type (set by VxWorks). 
sysCoprocessor  
0 = no coprocessor 
1 = 387 coprocessor 
2 = 487 coprocessor 
The type of floating-point coprocessor (set by VxWorks). 

Architecture-Specific Routines

Register Routines

The following routines read x86 register values, and require one parameter, the task ID:

eax( )

ebx( )

ecx( )

edx( )

edi( )

esi( )

ebp( )

esp( )

eflags( )

Table D-2 shows additional architecture-specific routines. Other architecture-specific routines are described throughout this section.

Table D-2:  Architecture-Specific Routines  


Routine
Function Header
Description

pentiumBts( )  
STATUS pentiumBts 
(char * pFlag)
Execute an atomic compare-and-exchange instruction to set a bit. (Pentium and PentiumPro.)  
pentiumBtc( )  
STATUS pentiumBtc (pFlag)
(char * pFlag)
 
Execute an atomic compare-and-exchange instruction to clear a bit. (Pentium and PentiumPro.)  
pentiumMcaShow  
void pentiumMcaShow (void)  
Show machine check global control registers and error reporting register banks. 
pentiumMsrGet( )  
void pentiumMsrGet
    (
    int address,
    long long int * pData
    )
 
Get the contents of the specified MSR. (PentiumPro)  
pentiumMsrSet( )  
void pentiumMsrSet
    (
    int address,
    long long int * pData
    )
 
Set the value of the specified MSR. (PentiumPro)  
pentiumMtrrEnable( )  
void pentiumMtrrEnable (void)  
Enable MTRR. (PentiumPro)  
pentiumMtrrDisable( )  
void pentiumMtrrDisable (void)  
Disable MTRR. (PentiumPro)  
pentiumMtrrGet( )  
void pentiumMtrrGet
    (MTRR * pMtrr)
 
Get MTRRs to the MTRR table specified by the pointer. (PentiumPro)  
pentiumMtrrSet( )  
void pentiumMtrrSet (void)
(MTRR * pMtrr)
 
Set MTRRs from the MTRR table specified by the pointer. (PentiumPro)  
pentiumPmcStart( )  
STATUS pentiumPmcStart
    (int pmcEvtSel0;
    int pmcEvtSel1;
    )
 
Start PMC0 and PMC1. (PentiumPro)  
pentiumPmcStop( )  
void pentiumPmcStop (void)  
Stop PMC0 and PMC1. (PentiumPro)  
pentiumPmcStop1( )  
void pentiumPmcStop1 (void)  
Stop PMC1 only. (PentiumPro)  
pentiumPmcGet( )  
void pentiumPmcGet
    (long long int * pPmc0;
    long long int * pPmc1;
    )
 
Get the contents of PMC0 and PMC1. (PentiumPro)  
pentiumPmcGet0( )  
void pentiumPmcGet0
    (long long int * pPmc0)
 
Get the contents of PMC0. (PentiumPro)  
pentiumPmcGet1( )  
void pentiumPmcGet1
    (long long int * pPmc1)
 
Get the contents of PMC1. (PentiumPro)  
pentiumPmcReset( )  
void pentiumPmcReset (void)  
Reset PMC0 and PMC1. (PentiumPro)  
pentiumPmcReset0( )  
void pentiumPmcReset0 (void)  
Reset PMC0. (PentiumPro)  
pentiumPmcReset1( )  
void pentiumPmcReset1 (void)  
Reset PMC1. (PentiumPro)  
pentiumSerialize( )  
void pentiumSerialize (void)  
Serialize by executing the CPUID instruction. (Pentium and PentiumPro.)  
pentiumPmcShow( )  
void pentiumPmcShow
(BOOL zap)
 
Show PMC0 and PMC1, and reset them if the parameter zap is TRUE. (Pentium and PentiumPro.)  
pentiumTlbFlush( )  
void pentiumTlbFlush (void)  
Flush the TLBs (Translation Lookaside Buffers). (Pentium and PentiumPro.)  
pentiumTscReset( )  
void pentiumTscReset (void)  
Reset the TSC. (PentiumPro)  
pentiumTscGet32( )  
void pentiumTscGet32 (void)  
Get the lower half of the 64-bit TSC. (PentiumPro)  
pentiumTscGet64( )  
void pentiumTscGet64
    (long long int * pTsc)
 
Get the 64-bit TSC. (PentiumPro)  
sysCpuProbe( )  
 
Use CPUID to get information about the CPU.  
sysInByte( )  
UCHAR sysInByte
    (int port)
 
Read one byte from I/O. 
sysInWord( )  
USHORT sysInWord
    (int port)
 
Read one word (two bytes) from I/O. 
sysInLong( )  
ULONG sysInLong
    (int port)
 
Read one long word (four bytes) from I/O. 
sysOutByte( )  
void sysOutByte
    (int port, char data)
 
Write one byte to I/O. 
sysOutWord( )  
void sysOutWord
    (int port, short data)
 
Write one word (two bytes) to I/O. 
sysOutLong( )  
void sysOutLong
    (int port, long data)
 
Write one long word (four bytes) to I/O. 
sysInWordString( )  
void sysInWordString
    (int port, short *address,
    int count)
 
Read word string from I/O. 
sysInLongString( )  
void sysInLongString
    (int port, short *address,
    int count
 
Read long string from I/O. 
sysOutWordString( )  
void sysOutWordString
    (int port, short *address,
     int count)
 
Write word string to I/O. 
sysOutLongString( )  
void sysOutLongString
    (int port, short *address,
    int count)
 
Write long string to I/O. 
sysDelay( )  
void sysDelay
    (void)
 
Allow enough recovery time for port accesses. 
sysIntDisablePIC( )  
STATUS sysIntDisablePIC
    (int intLevel)
 
Disable a Programmable Interrupt Controller (PIC) interrupt level. 
sysIntEnablePIC( )  
STATUS sysIntEnablePIC
    (int intLevel)
 
Enable a PIC interrupt level. 
sysCpuProbe( )  
UINT sysCpuProbe
    (void)
 
Check for type of CPU (i386, i486, or Pentium). 

Breakpoints and the bh( ) Routine

VxWorks for the x86 supports both software and hardware breakpoints. When you set a software breakpoint, VxWorks replaces an instruction with an int 3 software interrupt instruction. VxWorks restores the original code when the breakpoint is removed. The instruction queue is purged each time VxWorks changes an instruction to a software break instruction.

A hardware breakpoint uses the processor's debug registers to set the breakpoint. The x86 architectures have four breakpoint registers. If you are using the target shell, you can use the bh( ) routine to set hardware breakpoints. The routine is declared as follows:

STATUS bh 
    ( 
    INSTR        *addr,        /* where to set breakpoint, or       */ 
                               /* 0 = display all breakpoints      */ 
    int          task,         /* task to set breakpoint;           */ 
                               /* 0 = set all tasks                */ 
    int          count,        /* number of passes before hit       */ 
    int          type,         /* breakpoint type; see below       */ 
    INSTR        *addr0        /* ignored for x86 targets          */ 
    )

The bh( ) routine takes the following types in parameter type:


BRK_INST

Instruction hardware breakpoint (0x1000)

BRK_DATAW1

Data write 1-byte breakpoint (0x1400)

BRK_DATAW2

Data write 2-byte breakpoint (0x1500)

BRK_DATAW4

Data write 4-byte breakpoint (0x1700)

BRK_DATARW1

Data read-write 1-byte breakpoint (0x1c00)

BRK_DATARW2

Data read-write 2-byte breakpoint (1d00)

BRK_DATARW4

Data read-write 4-byte breakpoint (1f00)


Disassembler: l( )

If you are using the target shell, note that the VxWorks disassembler l( ) does not support 16-bit code compiled for earlier generations of 80x86 processors. However, the disassembler does support 32-bit code for both the i386 and i486 processors.

vxMemProbe( )

The vxMemProbe( ) routine, which probes an address for a bus error, is supported on the x86 architectures by trapping both general protection faults and page faults.

a.out-Specific Tools for x86

The following tools are specific to the a.out format for x86 processors and the PC simulator. For more information, see the reference entries for each tool.

hexDec
converts an a.out-format object file into Motorola hex records. The syntax is:

hexDec [-a adrs] [-l] [-v] [-p PC] [-s SP] file 
aoutToBinDec
extracts text and data segments from an a.out file and writes it to standard output as a simple binary image. The syntax is:

aoutToBinDec < inFile > outfile 
xsymDec
extracts the symbol table from an a.out file. The syntax is:

xsymDec < objMod > symTbl