Vxworks Architecture Supplement 6.2
Vxworks Architecture Supplement 6.2
VxWorks
ARCHITECTURE SUPPLEMENT
6.2
Corporate Headquarters
Wind River Systems, Inc.
500 Wind River Way
Alameda, CA 94501-1153
U.S.A.
toll free (U.S.): (800) 545-WIND
telephone: (510) 748-4100
facsimile: (510) 749-2010
For additional contact information, please visit the Wind River URL:
http://www.windriver.com
For information on how to contact Customer Support, please visit the following URL:
http://www.windriver.com/support
Contents
Introduction ..........................................................................................
1.1
1.2
ARM .......................................................................................................
2.1
Introduction .............................................................................................................
2.2
2.3
2.3.1
2.3.2
cacheLib .....................................................................................................
2.3.3
dbgLib ........................................................................................................
2.3.4
dbgArchLib ...............................................................................................
2.3.5
intALib .......................................................................................................
2.3.6
intArchLib .................................................................................................
2.3.7
vmLib .........................................................................................................
2.3.8
vxALib .......................................................................................................
2.3.9
vxLib ...........................................................................................................
iii
VxWorks
Architecture Supplement, 6.2
2.4
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
10
10
11
2.4.6
11
2.4.7
11
2.4.8
Caches ........................................................................................................
12
2.4.9
13
14
15
16
2.5
17
2.6
20
2.4.10
Introduction .............................................................................................................
21
3.2
22
3.3
22
3.3.1
22
3.3.2
cacheLib .....................................................................................................
23
3.3.3
dbgLib ........................................................................................................
23
3.3.4
dbgArchLib ...............................................................................................
23
3.3.5
intALib .......................................................................................................
24
3.3.6
intArchLib .................................................................................................
24
iv
Contents
3.3.7
vmLib .........................................................................................................
25
3.3.8
vxALib .......................................................................................................
25
3.3.9
vxLib ...........................................................................................................
26
26
3.4.1
26
3.4.2
27
3.4.3
27
3.4.4
27
3.4.5
27
28
28
3.4.6
28
3.4.7
28
3.4.8
Caches ........................................................................................................
29
3.4.9
30
31
38
40
41
3.5
42
3.6
44
47
4.1
Introduction .............................................................................................................
47
4.2
47
4.3
49
4.3.1
49
4.3.2
49
3.4
3.4.10
VxWorks
Architecture Supplement, 6.2
4.4
4.3.3
51
4.3.4
59
60
4.4.1
61
4.4.2
61
4.4.3
61
4.4.4
62
4.4.5
Caches ........................................................................................................
63
4.4.6
63
4.4.7
65
4.4.8
Segmentation ............................................................................................
66
4.4.9
66
4.4.10
68
4.4.11
Interrupts ...................................................................................................
68
4.4.12
Exceptions .................................................................................................
71
4.4.13
71
4.4.14
72
4.4.15
72
4.4.16
Registers .....................................................................................................
72
4.4.17
Counters .....................................................................................................
73
4.4.18
74
4.4.19
78
4.4.20
78
4.4.21
78
4.4.22
79
4.4.23
79
4.4.24
79
4.4.25
79
vi
Contents
4.4.26
79
4.4.27
80
84
MIPS ......................................................................................................
85
5.1
Introduction .............................................................................................................
85
5.2
85
5.3
88
5.3.1
dbgArchLib ...............................................................................................
89
89
89
5.3.2
intArchLib .................................................................................................
90
5.3.3
taskArchLib ...............................................................................................
90
5.3.4
90
5.3.5
Caches ........................................................................................................
91
5.3.6
92
5.3.7
92
5.3.8
92
95
5.4.1
96
5.4.2
96
5.4.3
96
5.4.4
97
5.4.5
97
5.4.6
98
5.4.7
Interrupts ...................................................................................................
99
5.4.8
5.4.9
4.5
5.4
vii
VxWorks
Architecture Supplement, 6.2
5.5
5.4.10
5.4.11
5.4.12
6.2
6.3
6.3.2
6.3.3
6.3.4
6.4
118
119
120
123
124
124
126
127
128
6.3.5
6.3.6
6.3.7
6.3.8
6.4.2
6.4.3
viii
Contents
6.5
6.4.4
6.4.5
6.4.6
6.4.7
6.4.8
6.4.9
6.4.10
6.4.11
6.4.12
6.4.13
6.4.14
6.4.15
6.4.16
7.2
7.3
7.3.2
172
173
173
173
7.3.3
ix
VxWorks
Architecture Supplement, 6.2
7.3.5
7.3.6
7.4
179
180
180
180
180
181
7.4.2
7.4.3
7.4.4
7.4.5
7.4.6
7.4.7
7.4.8
7.4.9
7.4.10
7.4.11
7.4.12
7.4.13
7.4.14
Contents
7.4.15
7.5
7.6
A.2
A.3
A.3.2
A.4
A.4.2
A.4.3
xi
VxWorks
Architecture Supplement, 6.2
xii
1
Introduction
Interface Variations
Architecture Considerations
VxWorks
Architecture Supplement, 6.2
Reference Material
ARM
Intel XScale
Intel Architecture (Pentium)
MIPS
PowerPC
Renesas SuperH
NOTE: The product you have purchased may not include support for all
architectures. For more information, refer to your release note.
2
ARM
2.1 Introduction 3
2.2 Supported Processors 4
2.3 Interface Variations 4
2.4 Architecture Considerations 8
2.5 Migrating Your BSP 17
2.6 Reference Material 20
2.1 Introduction
VxWorks for ARM provides the Wind River Workbench development tools and
the VxWorks operating system for the Advanced RISC Machines (ARM) family of
architectures. ARM is a compact core that operates at a low power level.
NOTE: This release of VxWorks for ARM supports the standard 32-bit instruction
VxWorks
Architecture Supplement, 6.2
For more complete documentation on these routines, see the individual reference
entries.
2 ARM
2.3 Interface Variations
generates a different prolog, the cret( ) and tt( ) routines may generate unexpected
results.
The VxWorks kernel is built without a dedicated frame pointer. This is also the
default build option for user application code. As such, cret( ) and tt( ) cannot
provide backtrace information. To enable backtracing for user code using the GNU
compiler, add -fno-omit-frame-pointer to the applications compiler
command-line options. (Backtracing for user code cannot be enabled using the
Wind River Compiler.)
tt( ) does not report the parameters to C functions as it cannot determine these from
the code generated by the compiler.
The tt( ) routine cannot be used for backtracing kernel code.
!
CAUTION: The kernel is compiled without backtrace structures. For this reason,
tt( ) does not work within the kernel routines, and cret( ) can sometimes work
incorrectly. Breakpoints and single-stepping work, even if the code is compiled
without backtrace structures.
2.3.2 cacheLib
The cacheLock( ) and cacheUnlock( ) routines always return ERROR (see
2.4.8 Caches, p.12). Use of the cache and use of the MMU are closely linked on ARM
processors. Consequently, if cacheLib is used, vmLib is also required. In addition,
cacheLib and vmLib calls must be coordinated. For more information, see
2.4.9 Memory Management Unit (MMU), p.13.
The definition of the symbolic constant _CACHE_ALIGN_SIZE is not related to the
defined CPU type (the latter now defines an architecture). Rather, it is related to the
cache type of the specific CPU being used. Therefore, code (such as device drivers)
for which it is necessary to know the cache line size should use the variable
cacheArchAlignSize instead.
2.3.3 dbgLib
In order to maintain compatibility with hardware-assisted debuggers, VxWorks
for ARM uses only software breakpoints. When you set a software breakpoint,
VxWorks replaces an instruction with a known undefined instruction. VxWorks
restores the original code when the breakpoint is removed; if memory is examined
or disassembled, the original code is shown.
VxWorks
Architecture Supplement, 6.2
2.3.4 dbgArchLib
If you are using the target shell, the following additional architecture-specific
routines are available:
psrShow( )
Returns the contents of the current processor status register (CPSR) of the
specified task.
2.3.5 intALib
intLock( ) and intUnlock( )
The routine intLock( ) returns the I bit from the CPSR as the lock-out key for
the interrupt level prior to the call to intLock( ). The routine intUnlock( ) takes
this value as a parameter. For ARM, these routines control the CPU interrupt
mask directly. They do not manipulate the interrupt levels in the interrupt
controller chip.
intIFLock( ) and intIFUnLock( )
The routine intIFLock( ) returns the I and F bits from the CPSR as the lock-out
key in an analogous fashion, and the routine intIFUnlock( ) takes that value as
a parameter. Like intLock( ) and intUnlock( ), these routines control the CPU
interrupt mask directly. The intIFLock( ) routine is not a replacement for
intLock( ); it should only be used by code (such as FIQ setup code) that
requires that both the IRQ and the FIQ be disabled.
2.3.6 intArchLib
ARM processors generally have no on-chip interrupt controllers to handle the
interrupts multiplexed on the IRQ pin. Control of interrupts is a BSP-specific
matter. All of these routines are connected by function pointers to routines that
must be provided in ARM BSPs by a standard interrupt controller driver. For
general information on interrupt controller drivers, see Wind River AppNote46,
Standard Interrupt Controller Devices. (VxWorks application notes are available on
the Wind River Online Support Web site at https://secure.windriver.com
/windsurf/knowledgebase.html.) For special requirements or limitations, see the
appropriate interrupt controller device driver documents.
2 ARM
2.3 Interface Variations
intLibInit( )
The intVecSet( ) and intVecGet( ) routines are not supported for ARM and are
not present in this release.
intVecShow( )
The intVecShow( ) routine is not supported for ARM and is not present in this
release.
intLockLevelSet( ) and intLockLevelGet( )
2.3.7 vmLib
As mentioned for cacheLib, caching and virtual memory are linked on ARM
processors. Use of vmLib requires that cacheLib be included as well, and that calls
to the two libraries be coordinated. For more information, see 2.4.9 Memory
Management Unit (MMU), p.13.
VxWorks
Architecture Supplement, 6.2
2.3.8 vxALib
mmuReadId( )
2.3.9 vxLib
The vxMemProbe( ) routine, which probes an address for a bus error, is supported
by trapping data aborts. If your BSP hardware does not generate data aborts when
illegal addresses are accessed, vxMemProbe( ) does not return the expected
results. The BSP can provide an alternative routine by inserting the address of the
alternate routine in the global variable _func_vxMemProbeHook.
processor mode
byte order
ARM and Thumb state
unaligned accesses
interrupts and exceptions
divide-by-zero handling
floating-point support
caches
memory management unit (MMU)
memory layout
2 ARM
2.4 Architecture Considerations
VxWorks
Architecture Supplement, 6.2
Interrupt Stacks
VxWorks for ARM uses a separate interrupt stack in order to avoid having to make
task interrupt stacks big enough to accommodate the needs of interrupt handlers.
The ARM architecture has a dedicated stack pointer for its IRQ interrupt mode.
However, because the low-level interrupt handling code must be reentrant, IRQ
mode is only used on entry to, and exit from, the handler; an interrupt destroys the
IRQ mode link register. The majority of interrupt handling code runs in SVC mode
on a dedicated SVC-mode interrupt stack.
10
2 ARM
2.4 Architecture Considerations
Fast interrupt (FIQ) is not handled by VxWorks. BSPs can use FIQ as they wish, but
VxWorks code should not be called from FIQ handlers. If this functionality is
required, the preferred mechanism is to downgrade the FIQ to an IRQ by software
access to appropriately-designed hardware which generates an IRQ. The IRQ
handler can then make such VxWorks calls as are normally allowed from interrupt
context.
The floating-point math functions supplied with this release do not set errno.
However, return status can be obtained by calling __ieee_status( ).
The __ieee_status( ) prototype is as follows:
unsigned int __ieee_status (unsigned int mask, unsigned int flags);
For example:
d = pow( 0,0 );
status = __ieee_status(FE_IEEE_ALL_EXCEPT, 0);
printf( "pow( 0, 0 )=%g, __ieee_status=%#x\n", d, status );
11
VxWorks
Architecture Supplement, 6.2
2.4.8 Caches
ARM processor cores have a variety of cache configurations. This section discusses
these configurations and their relation to the ARM memory management facilities.
The following subsections augment the information in the VxWorks Kernel
Programmers Guide: Memory Management.
ARM-based CPUs have one of three cache types: no cache, unified instruction and
data caches, or separate instruction and data caches. Caches are also available in a
variety of sizes. An in-depth discussion regarding ARM caches is beyond the scope
of this document. For more detailed information, see the ARM Ltd. Web site.
In addition to the collection of caches, ARM cores can also have one of three types
of memory management schemes: no memory management, a memory protection
unit (MPU), or a full page-table-based memory management unit (MMU).
Detailed information regarding these memory management schemes can also be
found on the ARM Web site.
NOTE: This release does not support the use of a memory protection unit (MPU).
Core
Cache Type
Memory Management
ARM926e
32 KB instruction cache
32 KB data cache/write buffer
Page-table-based MMU
ARM1136jf-s
Page-table-based MMU
For all ARM caches, the cache capabilities must be used with the MMU to resolve
cache coherency problems. When the MMU is enabled, the page descriptor for
each page selects the cache mode, which can be cacheable or non-cacheable. This
page descriptor is configured by filling in the sysPhysMemDesc[ ] structure
defined in the BSP installDir/vxworks-6.2/target/config/bspname/sysLib.c file.
For more information on cache coherency, see the cacheLib reference entry. For
information on MMU support in VxWorks, see the VxWorks Kernel Programmers
Guide: Memory Management. For MMU information specific to the ARM family, see
2.4.9 Memory Management Unit (MMU), p.13.
12
2 ARM
2.4 Architecture Considerations
Not all ARM caches support cache locking and unlocking. Therefore, VxWorks for
ARM does not support locking and unlocking of ARM caches. The cacheLock( )
and cacheUnlock( ) routines have no effect on ARM targets and always return
ERROR.
The effects of the cacheClear( ) and cacheInvalidate( ) routines depend on the
CPU type and on which cache is specified.
ARM 926ej-s Cache
The ARM 926e has separate instruction and data caches. Both are enabled by
default. The data cache, if enabled, must be set to copyback mode, as all writes
from the cache are buffered. USER_D_CACHE_MODE must be set to
CACHE_COPYBACK and not changed. The instruction cache is not coherent with
stores to memory. USER_I_CACHE_MODE should be set to
CACHE_WRITETHROUGH and not changed.
On the ARM 926e, it is not possible to invalidate one part of the cache without
invalidating others so, with the data cache specified, the cacheClear( ) routine
pushes dirty data to memory and then invalidates the cache lines. For the
cacheInvalidate( ) routine, unless the ENTIRE_CACHE option is specified, the
entire data cache is invalidated.
ARM 1136jf-s Cache
The ARM 1136jf-s has separate instruction and data caches. Both are enabled by
default. The data cache can be set to copyback or write-through mode on a
per-page basis. The instruction cache is not coherent with stores to memory.
USER_I_CACHE_MODE should be set to CACHE_WRITETHROUGH and not
changed.
13
VxWorks
Architecture Supplement, 6.2
The caching and memory management functions for ARM processors are both
provided on-chip and are very closely interlinked. In general, caching functions on
ARM require the MMU to be enabled. Consequently, if cache support is configured
into VxWorks, MMU support is also included by default. On some CPUs, the
instruction cache can be enabled (in the hardware) without enabling the MMU.
This is not a recommended configuration.
Only certain combinations of MMU and cache-enabling are valid, and there are no
hardware interlocks to enforce this. In particular, enabling the data cache without
enabling the MMU can lead to undefined results. Consequently, if an attempt is
made to enable the data cache by means of the cacheEnable( ) routine before the
MMU has been enabled, the data cache is not enabled immediately. Instead, flags
are set internally so that if the MMU is enabled later, the data cache is enabled with
it. Similarly, if the MMU is disabled, the data cache is also disabled until the MMU
is reenabled.
Support is also included for CPUs that provide a special area in the address space
to be read in order to flush the data cache. ARM BSPs must provide a virtual
address (sysCacheFlushReadArea) for a readable, cached block of address space
that is used for nothing else. If the BSP has an area of the address space that does
not actually contain memory but is readable, it can set the pointer to point to that
area. If it does not, it should allocate some RAM for this area. In either case, the area
must be marked as readable and cacheable in the page tables.
The declaration can be included in the BSP installDir/vxworks-6.2/target
/config/bspname/sysLib.c file. For example:
UINT32 sysCacheFlushReadArea[D_CACHE_SIZE/sizeof(UINT32)];
Alternatively, the declaration can appear in the BSP romInit.s and sysALib.s files.
For example:
.globl
.equ
_sysCacheFlushReadArea
_sysCacheFlushReadArea, 0x50000000
14
2 ARM
2.4 Architecture Considerations
convert between virtual and physical addresses: these mapping functions are
provided as parameters to the routines cachetypeLibInstall( ) and
mmutypeLibInstall( ). For more information, see BSP Considerations for Cache and
MMU, p.15.
When building a BSP, the instruction set is selected by choosing the architecture
(that is, by defining CPU to be ARMARCHx); the cache and MMU types are selected
within the BSP by defining appropriate values for the macros ARMMMU and
ARMCACHE and calling the appropriate routines (as shown in Table 2-2) to
support the cache and MMU.
The values definable for MMU include the following:
ARMMMU_NONE
ARMMMU_926E
ARMMMU_1136JF
To provide the same information in a header or source file, include the following
line in the file:
#define ARMMMU ARMMMU_926E
Table 2-2 shows the MMU routines required for each processor type.
Table 2-2
Processor
Cache Routine
MMU Routine
ARM 926e
cacheArm926eLibInstall( )
mmuArm926eLibInstall( )
ARM 1136jf
cacheArm1136jfLibInstall( )
mmuArm1136jfLibInstall( )
15
VxWorks
Architecture Supplement, 6.2
During certain cache and MMU operations (for example, cache flushing),
interrupts must be disabled. You may want your BSP to have control over this
procedure. The contents of the variable cacheArchIntMask determine which
interrupts are disabled. This variable has the value I_BIT | F_BIT, indicating that
both IRQs and FIQs are disabled during these operations. If a BSP requires that
FIQs be left enabled, the contents of cacheArchIntMask should be changed to
I_BIT. Use extreme caution when changing the contents of this variable from its
default.
Anchor for the shared memory network and VxMP shared memory objects (if
there is shared memory on the board).
Exception Pointers
16
2 ARM
2.5 Migrating Your BSP
Boot Line
Exception Message
VxWorks itself (three sections: text, data, and bss). The entry point for
VxWorks is at the start of this region.
WDB Memory Pool
The size of this pool depends on the macro WDB_POOL_SIZE, which defaults
to one-sixteenth of the system memory pool. The target server uses this space
to support host-based tools. Modify WDB_POOL_SIZE under INCLUDE_WDB.
System Memory Pool
Size depends on size of the system image. The sysMemTop( ) routine returns
the end of the free memory pool.
All addresses shown in Figure 2-1 are relative to the start of memory for a
particular target board. The start of memory (corresponding to 0x0 in the memory
layout diagram) is defined as LOCAL_MEM_LOCAL_ADRS under
INCLUDE_MEMORY_CONFIG for each target.
NOTE: The initial stack and system image addresses are configured within the BSP.
17
VxWorks
Architecture Supplement, 6.2
Figure 2-1
Vectors
Address
+0x0000 LOCAL_MEM_LOCAL_ADRS
+0x0020
+0x0100
+0x0120
+0x0600
Shared Memory Anchor
+0x1000
Boot Line
+0x1100
Exception Message
+0x1200
Initial Stack
RAM_LOW_ADRS
System Image
text
KEY
data
= Available
= Reserved
bss
_end
WDB Memory Pool
sysMemTop( )
18
2 ARM
2.5 Migrating Your BSP
The memory layout shown in Figure 2-1 differs from that used for VxWorks 5.5.
The position of the boot line and exception message have been moved to allow
memory page zero protection (kernel hardening).
By default, all BSPs included with this release have the
T2_BOOTROM_COMPATIBILITY option enabled in config.h. This retains
compatibility with VxWorks 5.5 boot ROMs. In this configuration, the symbols are
defined in config.h as follows:
#define SM_ANCHOR_OFFSET
#define BOOT_LINE_OFFSET
#define EXC_MSG_OFFSET
0x600
0x700
0x800
Update your BSP. Then, create a new project based on the modified BSP, and
enable INCLUDE_KERNEL_HARDENING.
or:
mutually exclusive. If both of these components are defined in your config.h file,
Workbench issues a warning when you attempt to build your project.
19
VxWorks
Architecture Supplement, 6.2
The information given in this section is current at the time of writing; should you
decide to use these documents, you may wish to contact the manufacturer for the
most current version.
20
3
Intel XScale
3.1 Introduction 21
3.2 Supported Processors 22
3.3 Interface Variations 22
3.4 Architecture Considerations 26
3.5 Migrating Your BSP 42
3.6 Reference Material 44
3.1 Introduction
VxWorks for Intel XScale provides the Wind River Workbench development tools
and the VxWorks operating system for the Intel XScale family of processors. The
XScale microarchitecture features an ARM-compatible compact core that operates
at a low power level. The core design supports both big- and little-endian
configurations.
21
VxWorks
Architecture Supplement, 6.2
For more complete documentation on these routines, see the individual reference
entries.
22
3 Intel XScale
3.3 Interface Variations
tt( ) does not report the parameters to C functions, as it cannot determine these
from the code generated by the compiler.
The tt( ) routine cannot be used for backtracing kernel code.
3
CAUTION: The kernel is compiled without backtrace structures. For this reason,
tt( ) does not work within the kernel routines, and cret( ) can sometimes work
incorrectly. Breakpoints and single-stepping should work, even if the code is
compiled without backtrace structures.
3.3.2 cacheLib
The cacheLock( ) and cacheUnlock( ) routines always return ERROR (see
3.4.8 Caches, p.29). Use of the cache and use of the MMU are closely linked on
XScale processors. Consequently, if cacheLib is used, vmLib is also required. In
addition, cacheLib and vmLib calls must be coordinated. For more information,
see 3.4.9 Memory Management Unit (MMU), p.30.
The definition of the symbolic constant _CACHE_ALIGN_SIZE is not related to the
defined CPU type (the latter now defines an architecture). Rather, it is related to the
cache type of the specific CPU being used. Therefore, code (such as device drivers)
in which it is necessary to know the cache line size should use the variable
cacheArchAlignSize instead.
3.3.3 dbgLib
In order to maintain compatibility with hardware-assisted debuggers, VxWorks
for Intel XScale uses only software breakpoints. When you set a software
breakpoint, VxWorks replaces an instruction with a known undefined instruction.
VxWorks restores the original code when the breakpoint is removed; if memory is
examined or disassembled, the original code is shown.
3.3.4 dbgArchLib
If you are using the target shell, the following additional architecture-specific
routines are available:
psrShow( )
23
VxWorks
Architecture Supplement, 6.2
cpsr( )
Returns the contents of the current processor status register (CPSR) of the
specified task.
3.3.5 intALib
intLock( ) and intUnlock( )
The routine intLock( ) returns the I bit from the CPSR as the lock-out key for
the interrupt level prior to the call to intLock( ). The routine intUnlock( ) takes
this value as a parameter. For XScale processors, these routines control the
CPU interrupt mask directly. They do not manipulate the interrupt levels in
the interrupt controller chip.
intIFLock( ) and intIFUnLock( )
The routine intIFLock( ) returns the I and F bits from the CPSR as the lock-out
key in an analogous fashion, and the routine intIFUnlock( ) takes that value as
a parameter. Like intLock( ) and intUnlock( ), these routines control the CPU
interrupt mask directly. The intIFLock( ) is not a replacement for intLock( ); it
should only be used by code (such as FIQ setup code) that requires that both
IRQ and FIQ be disabled.
3.3.6 intArchLib
XScale processors generally have no on-chip interrupt controllers to handle the
interrupts multiplexed on the IRQ pin. Control of interrupts is a BSP-specific
matter. All of these routines are connected by function pointers to routines that
must be provided in the XScale BSPs by a standard interrupt controller driver. For
general information on interrupt controller drivers, see Wind River AppNote46,
Standard Interrupt Controller Devices. (VxWorks application notes are available on
the Wind River Online Support Web site at https://secure.windriver.com
/windsurf/knowledgebase.html.) For special requirements or limitations, see the
appropriate interrupt controller device driver documents.
intLibInit( )
24
3 Intel XScale
3.3 Interface Variations
The intVecSet( ) and intVecGet( ) routines are not supported for XScale and
are not present in this release.
intVecShow( )
The intVecShow( ) routine is not supported for XScale and is not present in
this release.
intLockLevelSet( ) and intLockLevelGet( )
3.3.7 vmLib
As mentioned for cacheLib, caching and virtual memory are linked on XScale
processors. Use of vmLib requires that cacheLib be included as well, and that calls
to the two libraries be coordinated. For more information, see 3.4.9 Memory
Management Unit (MMU), p.30.
3.3.8 vxALib
mmuReadId( )
25
VxWorks
Architecture Supplement, 6.2
3.3.9 vxLib
The vxMemProbe( ) routine, which probes an address for a bus error, is supported
by trapping data aborts. If your BSP hardware does not generate data aborts when
illegal addresses are accessed, vxMemProbe( ) does not return the expected
results. The BSP can provide an alternative routine by inserting the address of the
alternate routine in the global variable _func_vxMemProbeHook.
processor mode
byte order
ARM and Thumb state
unaligned accesses
interrupts and exceptions
divide-by-zero handling
floating-point support
caches
memory management unit (MMU)
memory layout
are obsolete.
26
3 Intel XScale
3.4 Architecture Considerations
27
VxWorks
Architecture Supplement, 6.2
Exceptions other than interrupts are handled in a similar fashion: the exception
stub switches to SVC mode and then calls any installed handler. Handlers are
installed by calls to excVecSet( ), and the addresses of installed handlers can be
read through calls to excVecGet( ).
Interrupt Stacks
VxWorks for Intel XScale uses a separate interrupt stack in order to avoid having
to make task interrupt stacks big enough to accommodate the needs of interrupt
handlers. The XScale architecture has a dedicated stack pointer for its IRQ
interrupt mode. However, because the low-level interrupt handling code must be
reentrant, IRQ mode is only used on entry to, and exit from, the handler; an
interrupt destroys the IRQ mode link register. The majority of interrupt handling
code runs in SVC mode on a dedicated SVC-mode interrupt stack.
Fast interrupt (FIQ) is not handled by VxWorks. BSPs can use FIQ as they wish, but
VxWorks code should not be called from FIQ handlers. If this functionality is
required, the preferred mechanism is to downgrade the FIQ to an IRQ by software
access to appropriately-designed hardware which generates an IRQ. The IRQ
handler can then make such VxWorks calls as are normally allowed from interrupt
context.
28
3 Intel XScale
3.4 Architecture Considerations
The floating-point library used by VxWorks for Intel XScale is licensed from
ARM Ltd. For more information on the floating-point library, see
http://www.arm.com.
3
Return Status
The floating-point math functions supplied with this release do not set errno.
However, return status can be obtained by calling __ieee_status( ).
The __ieee_status( ) prototype is as follows:
unsigned int __ieee_status (unsigned int mask, unsigned int flags);
For example:
d = pow( 0,0 );
status = __ieee_status(FE_IEEE_ALL_EXCEPT, 0);
printf( "pow( 0, 0 )=%g, __ieee_status=%#x\n", d, status );
3.4.8 Caches
XScale processor cores have a variety of cache configurations. This section
discusses these configurations and their relation to the XScale memory
management facilities. The following subsections augment the information in the
VxWorks Kernel Programmers Guide: Memory Management.
XScale-based CPUs have separate instruction and data caches, as well as write
buffers. Caches are also available in a variety of sizes and may include minicaches.
An in-depth discussion regarding XScale caches is beyond the scope of this
document. For more detailed information, see the Intel Web site.
In addition to the collection of caches, XScale cores also implement a full
page-table-based memory management unit (MMU). Detailed information
regarding the memory management scheme can also be found on the Intel Web
site.
Table 3-1 summarizes some of the common XScale cache and MMU
configurations.
Table 3-1
Core
Cache Type
Memory Management
XScale
32 KB instruction cache
32 KB data cache/write buffer
2 KB mini data cache
Page-table-based MMU
29
VxWorks
Architecture Supplement, 6.2
For all XScale caches, the cache capabilities must be used with the MMU to resolve
cache coherency problems. When the MMU is enabled, the page descriptor for
each page selects the cache mode, which can be cacheable or non-cacheable. This
page descriptor is configured by filling in the sysPhysMemDesc[ ] structure
defined in the BSP installDir/vxworks-6.2/target/config/bspname/sysLib.c file.
For more information on cache coherency, see the cacheLib reference entry. For
information on MMU support in VxWorks, see the VxWorks Kernel Programmers
Guide: Memory Management. For MMU information specific to the XScale family,
see 3.4.9 Memory Management Unit (MMU), p.30.
Not all XScale caches support cache locking and unlocking. Therefore, VxWorks
for Intel XScale does not support locking and unlocking of XScale caches. The
cacheLock( ) and cacheUnlock( ) routines have no effect on XScale targets and
always return ERROR.
The effects of the cacheClear( ) and cacheInvalidate( ) routines depend on the
CPU type and on which cache is specified.
All XScale processors contain an instruction cache and a data cache. By default,
VxWorks uses both caches; that is, both are enabled. To disable the instruction
cache, highlight the USER_I_CACHE_ENABLE macro in the Params tab under
INCLUDE_CACHE_ENABLE and remove the value TRUE; to disable the data cache,
highlight the USER_D_CACHE_ENABLE macro and remove TRUE.
It is not appropriate to think of the mode of the instruction cache. The instruction
cache is a read cache that is not coherent with stores to memory. Therefore, code
that writes to cacheable instruction locations must ensure instruction cache
validity. Set the USER_I_CACHE_MODE parameter in the Params tab under
INCLUDE_CACHE_MODE to CACHE_WRITETHROUGH, and do not change it.
With the data cache specified, the cacheClear( ) routine first pushes dirty data to
memory and then invalidates the cache lines, while the cacheInvalidate( ) routine
simply invalidates the lines (in which case, any dirty data contained in the lines is
lost). With the instruction cache specified, both routines have the same result: they
invalidate all of the instruction cache. Because the instruction cache is separate
from the data cache, there can be no dirty entries in the instruction cache, so no
dirty data can be lost.
30
3 Intel XScale
3.4 Architecture Considerations
up of state flags for each page or group of pages. All of the page states defined in
the VxWorks Kernel Programmers Guide: Memory Management are available for
virtual memory pages. In addition, XScale-based processors support the
MMU_STATE_CACHEABLE_MINICACHE (or
VM_STATE_CACHEABLE_MINICACHE) flag, allowing page-level control of the
CPU minicache.
All memory management is performed on small pages that are 4 KB in size. The
ARM concepts of sections or large pages are not used.
vmBaseLib and vmLib reference entries and in the VxWorks Kernel Programmers
Guide: Memory Management.
The Intel XScale processor extends the page attributes defined by the C and B bits
in the page descriptors with an additional X bit. This bit allows four more
attributes to be encoded when X=1. These new encodings include allocating data
for the mini-data cache and the write-allocate cache.
If you are using the MMU, the cache modes are controlled by the cache mode
values set in the sysPhysMemDesc[ ] table defined in installDir/vxworks-6.2
/target/config/bspname/sysLib.c within the BSP directory.
The XScale processor retains the ARM definitions of the C and B encoding when
X= 0, which differs from the behavior on the first generation Intel StrongARM
processors. The memory attribute for the mini-data cache has been relocated and
replaced with the write-through caching attribute.
When write-allocate is enabled, a store operation that misses the data cache
(cacheable data only) generates a line fill. If disabled, a line fill only occurs when a
load operation misses the data cache (cacheable data only).
Write-through caching causes all store operations to be written to memory,
whether they are cacheable or not cacheable. This feature is useful for maintaining
data cache coherency.
31
VxWorks
Architecture Supplement, 6.2
The type extension (TEX) field is present in several of the descriptor types. In the
XScale processor, only the least significant bit (LSB) of this field is used; this is
called the X bit.
A small page descriptor does not have a TEX field. For this type of descriptor, TEX
is implicitly zero; that is, this descriptor operates as if the X bit has a zero value.
The X bit, when set, modifies the meaning of the C and B bits.
When examining these bits in a descriptor, the instruction cache only utilizes the C
bit. If the C bit is clear, the instruction cache considers a code fetch from that
memory to be non-cacheable, and does not fill a cache entry. If the C bit is set,
fetches from the associated memory region are cached.
If the X bit for a descriptor is zero, the C and B bits operate as mandated by the
ARM architecture. If the X bit for a descriptor is one, the C and B bits meaning is
extended.
If the MMU is disabled, all data accesses are non-cacheable and non-bufferable.
This is the same behavior as when the MMU is enabled, and a data access uses a
descriptor with X, C, and B all set to zero.
The X, C, and B bits determine when the processor should place new data into the
data cache. The cache places data into the cache in lines (also called blocks). Thus,
the basis for making a decision about placing new data into the cache is called a
line allocation policy.
If the line allocation policy is read-allocate, all load operations that miss the cache
request a 32-byte cache line from external memory and allocate it into either the
data cache or mini-data cache (this assumes the cache is enabled). Store operations
that miss the cache do not cause a line to be allocated.
If a read/write-allocate is in effect, and if cache is enabled, load or store operations
that miss the cache request a 32-byte cache line from external memory.
The other policy determined by the X, C, and B bits is the write policy. A
write-through policy instructs the data cache to keep external memory coherent by
performing stores to both external memory and the cache. A write-back policy
only updates external memory when a line in the cache is cleaned or needs to be
replaced with a new line. Generally, write-back provides higher performance
because it generates less data traffic to external memory.
The write buffer is always enabled which means stores to external memory are
buffered. The K bit in the auxiliary control register (CP15, register 1) is a global
enable/disable for allowing coalescing in the write buffer. When this bit disables
coalescing, no coalescing occurs regardless of the value of the page attributes. If
32
3 Intel XScale
3.4 Architecture Considerations
this bit enables coalescing, the page attributes X, C, and B are examined to see if
coalescing is enabled for each region of memory.
All reads and writes to external memory occur in program order when coalescing
is disabled in the write buffer. If coalescing is enabled in the write buffer, writes
may occur out of program order to external memory. In this case, program
correctness is maintained by comparing all store requests with all valid entries in
the fill buffer.
The write buffer and fill buffer support a drain operation such that before the next
instruction executes, all XScale processor data requests to external memory
including the write operations in the bus controllerare complete.
Writes to a region marked non-cacheable and non-bufferable (page attributes C, B,
and X set to zero) cause execution to stall until the write completes.
If software is running in a privileged mode, it can explicitly drain all buffered
writes.
Non-cache memory (X=0, C=0, and B=0) should only be used if required (as is
often the case for I/O devices). Accessing non-cacheable memory is likely to cause
the processor to stall frequently due to the long latency of memory reads.
VxWorks includes support for the X bit and there are now three new states
supported in vmLib.h that allow you to set up buffers to use these extended states.
The following state flags have been added to vmLib.h:
MMU_STATE_CACHEABLE_MINICACHE cache policy is determined by the MD
(VM_STATE_CACHEABLE_MINICACHE) field of the auxiliary control register
VM_STATE_EX_CACHEABLE
VM_STATE_EX_CACHEABLE_NOT
VM_STATE_MASK_EX_CACHEABLE
VM_STATE_EX_BUFFERABLE
VM_STATE_EX_BUFFERABLE_NOT
VM_STATE_MASK_EX_BUFFERABLE
If MMU_STATE_CACHEABLE_MINICACHE (or
VM_STATE_CACHEABLE_MINICACHE) is set, pages set to this state using
vmStateSet( ) result in those pages being cached in the minicache, and not in the
main data cache.
33
VxWorks
Architecture Supplement, 6.2
VM_STATE_EX_CACHEABLE_NOT
XC+
VM_STATE_EX_CACHEABLE
XB-
VM_STATE_EX_BUFFERABLE_NOT
XB+
VM_STATE_EX_BUFFERABLE
For more information on the extended page table and X bit support, see the Intel
XScale Core Developer's Manual (available from Intel).
Setting the XScale P Bit in VxWorks
The XScale architecture introduces the P bit in the MMU first level page
descriptors, allowing an application specific standard product (ASSP) to identify a
new memory attribute. The bi-endian version of the IXP42x processor implements
the P bit to control address and data byte swapping and requires support for the P
bit in the first level descriptor and in the auxiliary control register (CP15, Rn 1,
O2 1). The setting of the P bit in a first level descriptor enables address or data byte
swapping on a per-section (1 MB) basis. As page table walks are performed with
the MMU disabled, bit 1 in the auxiliary control register enables byte swapping for
the page table walks.
Because VxWorks MMU support operates on a 4 KB page basis rather than on
1 MB regions, support for the P bit on a per region basis is best accomplished with
a new interface that avoids excessive overhead during MMU initialization. An
additional interface to the auxiliary control register is required as well.
The architecture-specific support code for the XScale MMU has been modified to
support the P bit. A byte array of the size NUM_L1_DESCS (the number of first level
descriptors) has been added. Each byte within the array represents the state of the
P bit for the corresponding region; zero if the P bit is not to be set and one if it is.
The default value is zero. For example:
#if (ARMMMU == ARMMMU_XSCALE)
/*
* The array used to keep XSCALE mmu 'P' bit state for init purposes.
*/
34
3 Intel XScale
3.4 Architecture Considerations
Four subroutines have been implemented that enable the setting, clearing, and
querying of the state of the P bit status on a per-region basis and within the CP15
auxiliary control register. All of the implemented region-specific subroutines have
two behaviors, one if the MMU is not yet initialized by the current instance of
VxWorks, and another if it is already initialized.
In the case where the MMU is not yet initialized, the subroutines operate on the
appropriate bytes within the mmuArmXSCALEPBit array only. When the MMU
is initialized, the P bit is set on a per-region basis as determined by the state of the
mmuArmXSCALEPBit array.
When the MMU is initialized, the subroutines operate on the current first level
descriptor, providing interrupt lockout, cache flushing, and TLB cache invalidates
as necessary. Additionally, the mmuArmXSCALEPBit array mirrors the state of
the P bit on a per-region basis.
mmuArmXSCALEPBitSet( )
STATUS mmuArmXSCALEPBitSet
(
void *
UINT32
)
virtAddr,
size
or equal to 1 MB sets the P bit for the 1 MB region of the virtual address only.
If the MMU is not yet initialized, modify only the appropriate areas in the
mmuArmXSCALEPBit array.
If the MMU is initialized:
a.
b.
35
VxWorks
Architecture Supplement, 6.2
c.
Modify the selected first level descriptors, mirroring each region's state in
the mmuArmXSCALEPBit array, and flush the data cache for each
regions first level descriptor.
d. When all selected regions have been processed, flush and invalidate the
TLB caches.
e.
f.
mmuPArmXSCALEBitClear( )
STATUS mmuPArmXSCALEBitClear
(
void *
virtAddr,
UINT32
size
)
or equal to 1 MB clears the P bit for the 1 MB region of the virtual address only.
If the MMU is not yet initialized, modify only the appropriate bytes in the
mmuArmXSCALEPBit array.
If the MMU is initialized
a.
b.
c.
Modify the selected first level descriptors, mirroring each region's state in
the mmuArmXSCALEPBit array, and flush the data cache for each regions
first level descriptor.
d. When all selected regions have been processed, flush and invalidate the
TLB caches.
36
e.
f.
3 Intel XScale
3.4 Architecture Considerations
mmuArmXSCALEPBitGet( )
STATUS mmuArmXSCALEPBitGet
(
void *
virtAddr
)
3
/* The beginning virtual address */
Return the state of the P bit in the selected first level descriptor.
STATUS mmuArmXSCALEAcrGet
(
void
)
b.
Return the contents of the CP15 Auxiliary Control Register, (CP15, 0, r0, c1,
c0, 1).
void mmuArmXSCALEAcrSet
(
UINT32
acr
/@ value to load into ACR @/
)
c.
Write the CP15 auxiliary control register with the contents of ACR.
There are two available methods to set the P bit in a region, or regions, of virtual
memory. The first, and preferred method, is to modify the sysHwInit0( ) routine
within installDir/vxworks-6.2/target/config/bspname/sysLib.c to call
mmuPBitSet( ) prior to the initialization of the MMU.
The second is to modify the state through calls to mmuPBitSet( ) and
mmuPBitClear( ) during run-time. This method is less desirable due to the impact
that disabling IRQs and FIQs may have on the application.
An example of the preferred method follows (from installDir/vxworks-6.2
/target/config/bspname/sysLib.c).
#ifdef INCLUDE_MMU
/* Install the appropriate MMU library and translation routines */
mmuArmXSCALELibInstall (mmuPhysToVirt, mmuVirtToPhys);
#ifdef IXP425_ENABLE_P_BITS
37
VxWorks
Architecture Supplement, 6.2
{
int acrValue;
/* Set all DRAM regions with P bit */
mmuArmXSCALEPBitSet((void *)IXP425_SDRAM_BASE, LOCAL_MEM_SIZE);
#ifdef
INCLUDE_PCI
The caching and memory management functions on XScale processors are both
provided on-chip and are very closely interlinked. In general, caching functions on
XScale require the MMU to be enabled. Consequently, if cache support is
configured into VxWorks, MMU support is also included by default. On some
CPUs, the instruction cache can be enabled (in the hardware) without enabling the
MMU; however, this is not a recommended configuration.
Only certain combinations of MMU and cache enabling are valid, and there are no
hardware interlocks to enforce this. In particular, enabling the data cache without
enabling the MMU can lead to undefined results. Consequently, if an attempt is
made to enable the data cache by means of the cacheEnable( ) routine before the
MMU has been enabled, the data cache is not enabled immediately. Instead, flags
are set internally so that if the MMU is enabled later, the data cache is enabled with
it. Similarly, if the MMU is disabled, the data cache is also disabled, until the MMU
is reenabled.
Support is provided for BSPs that include separate static RAM for the MMU
translation tables. This support requires the ability to specify an alternate source of
memory other than the system memory partition. The BSP should set a global
function pointer, _func_armPageSource, to point to a routine that returns a
memory partition identifier describing memory to be used as the source for
translation table memory. If this function pointer is NULL, the system memory
partition is used. The BSP must modify the function pointer before calling
38
3 Intel XScale
3.4 Architecture Considerations
mmuLibInit( ). The initial memory partition must be large enough for all
requirements; it does not expand dynamically or overflow into the system memory
partition if it fills.
Support is also included for CPUs that provide a special area in the address space
to be read in order to flush the data cache. XScale BSPs must provide a virtual
address (sysCacheFlushReadArea) of a readable, cached block of address space
that is used for nothing else. If the BSP has an area of the address space that does
not actually contain memory but is readable, it can set the pointer to point to that
area. If it does not, it should allocate some RAM for this area. In either case, the area
must be marked as readable and cacheable in the page tables.
The declaration can be included in the BSP installDir/vxworks-6.2/target
/config/bspname/sysLib.c file. For example:
UINT32 sysCacheFlushReadArea[D_CACHE_SIZE/sizeof(UINT32)];
Alternatively, the declaration can appear in the BSP romInit.s and sysALib.s files.
For example:
.globl
.equ
_sysCacheFlushReadArea
_sysCacheFlushReadArea, 0x50000000
39
VxWorks
Architecture Supplement, 6.2
When building a BSP, the instruction set is selected by choosing the architecture
(that is, by defining CPU to be XSCALE); the cache and MMU types are selected
within the BSP by defining appropriate values for the macros ARMMMU and
ARMCACHE and calling the appropriate routines (as shown in Table 3-2) to
support the cache and MMU. Setting the preprocessor variables ARMMMU and
ARMCACHE ensures that support for the appropriate cache and MMU type is
enabled.
The values definable for MMU include the following:
ARMMMU_NONE
ARMMMU_XSCALE
To provide the same information in a header or source file, include the following
line in the file:
#define ARMMMU ARMMMU_XSCALE
Table 3-2 shows the cache and MMU routines required for XScale processors.
Table 3-2
Processor
Cache Routine
MMU Routine
XScale
cacheArmXScaleLibInstall( )
mmuArmXScaleLibInstall( )
40
3 Intel XScale
3.4 Architecture Considerations
During certain cache and MMU operations (for example, cache flushing),
interrupts must be disabled. You may want your BSP to have control over this
procedure. The contents of the variable cacheArchIntMask determine which
interrupts are disabled. This variable has the value I_BIT | F_BIT, indicating that
both IRQs and FIQs are disabled during these operations. If a BSP requires that
FIQs be left enabled, the contents of cacheArchIntMask should be changed to
I_BIT. Use extreme caution when changing the contents of this variable from its
default.
Anchor for the shared memory network and VxMP shared memory objects (if
there is shared memory on the board).
Exception Pointers
41
VxWorks
Architecture Supplement, 6.2
Initial Stack
VxWorks itself (three sections: text, data, and bss). The entry point for
VxWorks is at the start of this region.
WDB Memory Pool
The size of this pool depends on the macro WDB_POOL_SIZE, which defaults
to one-sixteenth of the system memory pool. The target server uses this space
to support host-based tools. Modify WDB_POOL_SIZE under INCLUDE_WDB.
System Memory Pool
Size depends on size of the system image. The sysMemTop( ) routine returns
the end of the free memory pool.
All addresses shown in Figure 3-1 are relative to the start of memory for a
particular target board. The start of memory (corresponding to 0x0 in the memory
layout diagram) is defined as LOCAL_MEM_LOCAL_ADRS under
INCLUDE_MEMORY_CONFIG for each target.
NOTE: The initial stack and system image addresses are configured within the BSP.
The memory layout shown in Figure 3-1 differs from that used for VxWorks 5.5.
The position of the boot line and exception message have been moved to allow
memory page zero protection (kernel hardening).
42
3 Intel XScale
3.5 Migrating Your BSP
Figure 3-1
Vectors
Address
+0x0000 LOCAL_MEM_LOCAL_ADRS
+0x0020
+0x0100
+0x0120
+0x1000
Boot Line
+0x1100
Exception Message
+0x1200
Initial Stack
RAM_LOW_ADRS
System Image
text
KEY
data
= Available
= Reserved
bss
_end
WDB Memory Pool
sysMemTop( )
43
VxWorks
Architecture Supplement, 6.2
0x600
0x700
0x800
Update your BSP. Then, create a new project based on the modified BSP and
enable INCLUDE_KERNEL_HARDENING.
or:
mutually exclusive. If both of these components are defined in your config.h file,
Workbench issues a warning when you attempt to build your project.
44
3 Intel XScale
3.6 Reference Material
The information given in this section is current at the time of writing; should you
decide to use these documents, you may wish to contact the manufacturer for the
most current version.
45
VxWorks
Architecture Supplement, 6.2
46
4
Intel Architecture
4.1 Introduction 47
4.2 Supported Processors 47
4.3 Interface Variations 49
4.4 Architecture Considerations 60
4.5 Reference Material 84
4.1 Introduction
This chapter provides information specific to VxWorks development on Intel
Architecture P5 (Pentium), P6 (PentiumPro, II, III), P7 (Pentium 4), and Pentium M
family processor targets including their Celeron and Xeon series variants.
47
VxWorks
Architecture Supplement, 6.2
including their major differences. For more information, refer to your target
hardware documentation.
The P5 (Pentium) architecture is a third-generation 32-bit CPU. It has a 64-bit data
bus and a 32-bit address bus, separate 8 KB L1 instruction and data caches,
superscalar dispatch/execution units, branch prediction, two execution pipelines,
and a write-back data cache protocol. Some P5 family processors also include
support for MMX technology. This technology uses the single-instruction,
multiple-data (SIMD) execution model to perform parallel computations on
packed integer data contained in the 64-bit MMX registers.
P6 micro-architecture family processors include PentiumPro, Pentium II, Pentium
III, Pentium M, and their variant Xeon/Celeron processors. P6 is a three-way
superscalar architecture that executes up to three instructions per clock cycle. It has
micro-data flow analysis, out-of-order execution, superior branch prediction, and
speculative execution. Three instruction decode units work in parallel to decode
object code into smaller operations called micro-ops. These micro-ops can be
executed out-of-order by the five parallel execution units. The retirement unit
retires completed micro-ops in their original program order, taking into account
any branches. The P6 architecture has separate 8 KB L1 instruction and data caches
and a 256 KB L2 unified cache. The data cache uses the MESI protocol to support a
more efficient write-back mode. The cache consistency is maintained with the
MESI protocol and the bus snooping mechanism. Pentium II adds MMX
technology, new packaging, 16 KB L1 instruction and data caches, and a 256 KB
(512 KB or 1 MB) L2 unified cache. Pentium III introduces the Streaming SIMD
Extensions (SSE) that extend the SIMD model with a new set of 128-bit registers
and the ability to perform SIMD operations on packed single-precision
floating-point values. Pentium M processors utilize a new micro-architecture in
order to provide high performance and low power consumption. These processors
include cache and processor bus power management and large L1 and L2 caches.
The P7 (Pentium 4) processor is based on the NetBurst micro-architecture that
allows processors to operate at significantly higher clock speeds and performance
levels. It has a rapid execution engine, hyper pipelined technology, advanced
dynamic execution, a new cache subsystem, Streaming SIMD Extensions 2 (SSE2),
and a 400 MHz system bus.
The x86 architecture supports three operating modes: protected mode,
real-address mode, and virtual-8086 mode. Protected mode is the native operating
mode of the 32-bit processor. All instructions and architectural features are
available in this mode for the highest performance and capability. Real-address
mode provides the programming environment of the Intel 8086 processor.
Virtual-8086 mode lets the processor execute 8086 software in a protected mode,
48
4 Intel Architecture
4.3 Interface Variations
For complete documentation, see the reference entries for the libraries, routines,
and tools discussed in the following sections.
asin( )
exp( )
iround( )
sin( )
trunc( )
atan( )
fabs( )
log( )
sincos( )
atan2( )
floor( )
log10( )
sinh( )
ceil( )
fmod( )
log2( )
sqrt( )
cos( )
infinity( )
pow( )
tan( )
49
VxWorks
Architecture Supplement, 6.2
Table 4-1
Global Variable
Value
Description
sysCsSuper
0x08
sysCsExc
0x18
sysCsInt
0x20
sysIntIdtType
0x0000fe00
(default)
= trap gate
0x0000ee00
= interrupt gate
sysGdt[ ]
sysProcessor
sysCoprocessor 0 = no coprocessor
1 = 387 coprocessor
2 = 487 coprocessor
sysCpuId
50
CPUID structure
4 Intel Architecture
4.3 Interface Variations
Architecture-Specific Routines
Routine
Function Header
Description
void fppCtxShow
(FP_CONTEXT * f)
fppRegListShow( )
intStackEnable( )
STATUS intStackEnable
(BOOL enable)
pentiumBts( )
STATUS pentiumBts
(char * pFlag)
Executes an atomic
compare-and-exchange
instruction to set a bit. (P5, P6,
and P7)
pentiumBtc( )
STATUS pentiumBtc
(char * pFlag)
Executes an atomic
compare-and-exchange
instruction to clear a bit. (P5, P6,
and P7)
pentiumMcaEnable( )
void pentiumMcaEnable
(BOOL enable)
pentiumMcaShow( )
51
VxWorks
Architecture Supplement, 6.2
Table 4-2
Routine
Function Header
Description
pentiumMsrGet( )
void pentiumMsrGet
(
int address,
long long int * pData
)
pentiumMsrInit( )
pentiumMsrSet( )
void pentiumMsrSet
(
int address,
long long int * pData
)
pentiumMsrShow( )
pentiumMtrrEnable( )
pentiumMtrrDisable( )
pentiumMtrrGet( )
void pentiumMtrrGet
(MTRR * pMtrr)
pentiumMtrrSet( )
void pentiumMtrrSet
(MTRR * pMtrr)
pentiumPmcStart( )
STATUS pentiumPmcStart
(
int pmcEvtSel0;
int pmcEvtSel1;
)
pentiumPmcStart0( )
STATUS pentiumPmcStart0
(int pmcEvtSel0)
pentiumPmcStart1( )
STATUS pentiumPmcStart1
(int pmcEvtSel1)
pentiumPmcStop( )
52
4 Intel Architecture
4.3 Interface Variations
Table 4-2
Routine
Function Header
Description
pentiumPmcStop0( )
pentiumPmcStop1( )
pentiumPmcGet( )
void pentiumPmcGet
(
long long int * pPmc0;
long long int * pPmc1;
)
pentiumPmcGet0( )
void pentiumPmcGet0
(long long int * pPmc0)
pentiumPmcGet1( )
void pentiumPmcGet1
(long long int * pPmc1)
pentiumPmcReset( )
pentiumPmcReset0( )
pentiumPmcReset1( )
pentiumSerialize( )
pentiumPmcShow( )
void pentiumPmcShow
(BOOL zap)
pentiumTlbFlush( )
pentiumTscReset( )
pentiumTscGet32( )
pentiumTscGet64( )
void pentiumTscGet64
(long long int * pTsc)
53
VxWorks
Architecture Supplement, 6.2
Table 4-2
Routine
Function Header
Description
sysCpuProbe( )
sysInByte( )
UCHAR sysInByte
(int port)
sysInWord( )
USHORT sysInWord
(int port)
sysInLong( )
ULONG sysInLong
(int port)
sysOutByte( )
void sysOutByte
(int port, char data)
sysOutWord( )
void sysOutWord
(int port, short data)
sysOutLong( )
void sysOutLong
(int port, long data)
sysInWordString( )
void sysInWordString
(
int port,
short *address,
int count
)
sysInLongString( )
void sysInLongString
(
int port,
short *address,
int count
)
sysOutWordString( )
void sysOutWordString
(
int port,
short *address,
int count
)
sysOutLongString( )
void sysOutLongString
(
int port,
short *address,
int count
)
54
4 Intel Architecture
4.3 Interface Variations
Table 4-2
Routine
Function Header
Description
sysDelay( )
sysIntDisablePIC( )
STATUS sysIntDisablePIC
(int intLevel)
Disables a programmable
interrupt controller (PIC)
interrupt level.
sysIntEnablePIC( )
STATUS sysIntEnablePIC
(int intLevel)
sysOSMTaskGateInit( )
STATUS sysOSMtaskGateInit
(void)
vxCpuShow( )
vxCr[0234]Get( )
vxCr[0234]Set( )
vxDrGet( )
void vxDrGet
(
int * pDr0,
int * pDr1,
int * pDr2,
int * pDr3,
int * pDr4,
int * pDr5,
int * pDr6,
int * pDr7
)
vxDrSet( )
void vxDrSet
(
int dr0,
int dr1,
int dr2,
int dr3,
int dr4,
int dr5,
int dr6,
int dr7
)
vxDrShow( )
55
VxWorks
Architecture Supplement, 6.2
Table 4-2
Routine
Function Header
Description
vxEflagsGet( )
vxEflagsSet( )
vxPowerModeGet( )
vxPowerModeSet( )
STATUS vxPowerModeSet
(UINT32 mode)
vxTssSet( )
vx[GIL]dtrGet( )
void vx[GIL]dtrGet
(long long int * pValue)
vxSseShow( )
Register Routines
The following routines read Intel Architecture register values, and require one
parameter, the task ID:
eax( )
esi( )
56
ebx( )
ebp( )
ecx( )
esp( )
edx( )
eflags( )
edi( )
4 Intel Architecture
4.3 Interface Variations
VxWorks for Intel Architecture 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 cache is purged each time VxWorks
changes an instruction to a software break instruction.
A hardware breakpoint uses the processors debug registers to set the breakpoint.
The Pentium 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,
int
int
type,
task,
int
BOOL
count,
quiet,
/*
/*
/*
/*
/*
/*
/*
/*
*/
*/
*/
*/
*/
*/
*/
*/
BRK_DATAW1
BRK_DATAW2
BRK_DATAW4
BRK_DATARW1
BRK_DATARW2
BRK_DATARW4
A maximum number of hardware breakpoints can be set on the target system. This
is a hardware limit and cannot be changed. For Intel Architecture targets, this limit
is four hardware breakpoints. The address parameter of a hardware breakpoint
command does not need to be 4-bytes aligned for data breakpoints on Intel
Architecture. The address parameter is 1-byte aligned if width access is 1 byte, 2bytes aligned if width access is 2 bytes, and 4-bytes aligned if width access is 4
bytes.
For more information, see the reference entry for bh( ).
57
VxWorks
Architecture Supplement, 6.2
Disassembler: l( )
If you are using the target shell, the VxWorks disassembler l( ) routine does not
support 16-bit code compiled for earlier generations of 80x86 processors. However,
the disassembler does support 32-bit code for Intel Architecture processors.
Memory Probe: vxMemProbe( )
The vxMemProbe( ) routine, which probes an address for a bus error, is supported
on the Intel Architecture (Pentium) architectures by trapping both general
protection faults and page faults.
Interrupt Lock Level: intLock( ) and intUnlock( )
The Intel Architecture (Pentium) architecture includes a single interrupt signal for
external interrupts, and is able to enable and disable external interrupts to the
CPU. The Intel Architecture (Pentium) architecture does not have an on-chip
interrupt controller, and therefore does not have the capability of controlling the
interrupt mask/lock level. The global variable intLockMask is set to 1 and is not
used by intLock( ). The intLock( ) routine simply disables the external interrupt,
while the intUnlock( ) routine restores the previous state of the signal (that is,
enables it if it was previously enabled). Locking the individual external interrupt
line or masking the interrupt level is done by a companion interrupt controller
device driver such as the i8259Intr.c or ioApicIntr.c. These drivers are provided as
source code in installDir/vxworks-6.2/target/src/drv/intrCtl.
IntArchLib: intVecSet2( ) and intVecGet2( )
Routines that manipulate the memory type range registers (MTRR), performance
monitoring counter (PMC), timestamp counter (TSC), machine check architecture
(MCA), and model specific registers (MSR) are included. The routines are listed in
Table 4-2.
58
4 Intel Architecture
4.3 Interface Variations
The routine vxCpuShow( ) shows the CPU type, family, model, and supported
features.
The routines vxCr0Get( ), vxCr2Get( ), vxCr3Get( ), and vxCr4Get( ) get the
current values from the respective control registers, while the routines vxCr0Set( ),
vxCr2Set( ), vxCr3Set( ), and vxCr4Set( ) assign values to the respective control
registers.
The routines vxEflagsGet( ) and vxEflagsSet( ) respectively get and set the
EFLAGS register.
The routines vxDrGet( ) and vxDrSet( ) respectively get and set the debug
registers. vxDrShow( ) shows the content of the debug registers. These routines are
intended to be primitive and generate exceptions if they are not claimed by WDB
or the debug library.
The routines vxTssGet( ) and vxTssSet( ) respectively get and set the task register.
The routines vxGdtrGet( ), vxIdtrGet( ), and vxLdtrGet( ) get the current value of
the respective system registers: GDTR, IDTR, and LDTR.
The routine vxLdtrSet( ) sets the content of the local descriptor table.
The routines vxPowerModeGet( ) and vxPowerModeSet( ) respectively get and
set the power management mode.
NOTE: The vxPowerModeGet( ) and vxPowerModeSet( ) routines are deprecated,
see 4.4.26 Power Management, p.79.
The vxCsGet( ), vxDsGet( ), and vxSsGet( ) routines get the current value of the
code segment, data segment, and stack segment, respectively.
taskSRSet( )
The routine taskSRSet( ) sets its second parameter to the EFLAGS register of the
specified task.
59
VxWorks
Architecture Supplement, 6.2
these tools are replaced with objcopypentium and no longer supported. For more
information, see the reference entries for each tool.
hexDec
converts an a.out-format object file into a Motorola hex record.
aoutToBinDec
extracts text and data segments from an a.out file and writes them to standard
output as a simple binary image.
xsymDec
extracts the symbol table from an a.out file.
60
boot disks
operating mode and byte order
Celeron processors
cache issues
FPU, MMX, SSE, and SSE2 support
segmentation
paging with MMU
ring level protection
interrupts
exceptions
stack management
context switching
machine check architecture (MCA)
registers
counters
advanced programmable interrupt controller (APIC)
I/O mapped devices
memory-mapped devices
memory considerations for VME
ISA/EISA bus
PC104 bus
4 Intel Architecture
4.4 Architecture Considerations
PCI bus
software floating-point emulation
VxWorks memory layout
For more information on the Intel Architecture, consult the Intel Architecture
Software Developers Manual.
61
VxWorks
Architecture Supplement, 6.2
Do not assume that a given family or model has any specific feature. For
example, do not assume that family value 5 (that is, a P5 family processor)
implies a floating-point unit on-chip; use the feature flags to make this
determination.
Do not assume processors with higher family or model numbers have all the
features of a processor with a lower family or model number. For example, a
processor with a family value 6 (that is, a P6 family processor) may not
necessarily have all the features of a processor with a family value of 5.
Do not assume that a given family or model includes a specific feature. For
example, do not assume that a P5 family processor always includes a
floating-point unit. You can use the feature flags to determine what features
are available on your chip.
Do not assume that processors with a higher family or model number include
all of the features included in a processor with a lower family number. For
example, a P6 family processor may not include all of the features available for
a P5 family processor.
For more information on Pentium M processors, see the Intel Web site. For
information on identifying your CPU and its features, see the Intel Application Note
AP-485.
62
4 Intel Architecture
4.4 Architecture Considerations
4.4.5 Caches
The CD and NW flags in CR0 control the overall caching of system memory. The
PCD and PWT flags in CR3 control the caching of the page directory. The PCD and
PWT flags in the page directory or page table entry control page-level caching. In
cacheLib, the WBINVD instruction is used to flush the cache if the CLFLUSH
instruction is not supported by the processor.
P5 (Pentium) family processors have separate L1 instruction and data on-chip
caches. Each cache is 8 KB. The P5 family data cache supports both write-through
and write-back update policies. The PWT flag in the page table entry controls the
write-back policy for that page of memory.
P6 (PentiumPro, II, III) family processors include separate L1 instruction and data
caches, and a unified internal L2 cache. The P6 processor MESI data cache protocol
maintains consistency with internal L1 and L2 caches, caches of other processors,
and with an external cache in both update policies. The operation of the MESI
protocol is transparent to software.
P7 (Pentium 4) family processors include a trace cache that caches decoded
instructions, as well as an L1 data cache and an L2 unified cache. The CLFLUSH
instruction allows the selected cache line to be flushed from memory.
63
VxWorks
Architecture Supplement, 6.2
Saving and restoring floating-point registers adds to the context switch time of a
task. Therefore, floating-point registers are not saved and restored for every task.
Only those tasks spawned with the task option VX_FP_TASK will have
floating-point state, MMX technology state, and streaming SIMD state saved and
restored. If a task executes any floating-point operations, MMX operations, or
streaming SIMD operations, it must be spawned with VX_FP_TASK.
NOTE: The value of VX_FP_TASK changed from 0x0008 (VxWorks 5.5) to
0x01000000 (VxWorks 6.x). However, its meaning and usage remain unchanged.
64
Precision
Overflow
Underflow
Division by zero
Denormalized operand
Invalid operation
4 Intel Architecture
4.4 Architecture Considerations
Do not rely on register contents across transitions between FPU and MMX
code modules.
When transitioning between MMX code and FPU code, save the MMX register
state (if it will be needed in the future) and execute an EMMS instruction to
empty the MMX state.
When transitioning between FPU and MMX code, save the FPU state, if it will
be needed in the future.
The XMM registers and the FPU/MMX registers represent separate execution
environments. This has certain ramifications when executing SSE, SSE2, MMX and
FPU instructions in the same task context:
Those SSE and SSE2 instructions that operate only on the XMM registers (such
as the packed and scalar floating-point instructions and the 128-bit SIMD
integer instructions) can be executed without any restrictions in the same
instruction stream with 64-bit SIMD integer or FPU instructions. For example,
an application can perform the majority of its floating-point computations in
the XMM registers using the packed and scalar floating-point instructions, and
at the same time use the FPU to perform trigonometric and other
transcendental computations. Likewise, an application can perform packed
64-bit and 128-bit SIMD integer operations simultaneously without
restrictions.
Those SSE and SSE2 instructions that operate on MMX registers (such as the
CVTPS2PI, CVTTPS2PI, CVTPI2PS, CVTPD2PI, CVTTPD2PI, CVTPI2PD,
MOVDQ2Q, MOVQ2DQ, PADDQ, and PSUBQ instructions) can also be
executed in the same instruction stream as 64-bit SIMD integer or FPU
instructions. However, these instructions are subject to the restrictions on the
65
VxWorks
Architecture Supplement, 6.2
4.4.8 Segmentation
In the default configurationthat is, error detection and reporting and RTPs
disabledthree code segments and one data segment are defined in the global
descriptor table (GDT). The GDT is defined as table sysGdt[ ] in sysALib.s, and is
copied to the destination address at (LOCAL_MEM_LOCAL_ADRS +
GDT_BASE_OFFSET). The defined code and data segments are:
They are fully overlapped in the 4 GB, 32-bit address space (flat model). These
segments are used when a task changes its execution mode during its lifetime.
When RTPs are enabled, an additional three segments, a call gate, and a TSS
descriptor are added to the GDT. The three segments are level 3 (PL3) for use by
user-mode RTP tasks. The segments include one data, one code, and one stack
segment. The call gate and TSS descriptor are used by the system call mechanism
to allow a mode switch to occur when a system call is made.
When error detection and reporting is enabled, the IDT gets a task gate entry for
page fault management. The GDT gets two TSS entries (one for OSM save
information and one for OSM restore information) and one task gate entry. An LDT
entry is also established for context switching through TSS.
66
4 Intel Architecture
4.4 Architecture Considerations
The enhanced MMU on P6 and P7 family processors supports two additional page
attribute bits.
The global bit (G) indicates a global page when set. When a page is marked global,
and the page global enable (PGE) bit in register CR4 is set, the page-table or
page-directory entry for the page is not invalidated in the TLB when register CR3
is loaded. This bit is provided to prevent frequently used pages (such as pages that
contain kernel or other operating system or executive code) from being flushed
from the TLB.
The page-level write-through/write-back bit (PWT) controls the write-through or
write- back caching policy of individual pages or page tables. When the PWT bit is
set, write-through caching is enabled for the associated page or page table. When
the bit is clear, write-back caching is enabled for the associated page and page
table.
The following macros describe these attribute bits in the physical memory
descriptor table sysPhysMemDesc[ ] in sysLib.c.
MMU_ATTR_CACHE_COPYBACK
(or VM_STATE_WBACK)
MMU_ATTR_CACHE_OFF
(or VM_STATE_CACHEABLE_NOT)
VM_STATE_GLOBAL
VM_STATE_GLOBAL_NOT
Support is provided for two page sizes, 4 KB and 4 MB. The linear address for 4 KB
pages is divided into three sections. These sections are as follows:
Page directory entry
Page table entry
Page offset
bits 22 through 31
bits 12 through 21
bits 0 through 11
67
VxWorks
Architecture Supplement, 6.2
The linear address for 4 MB pages is divided into two sections. These sections are
as follows:
Page directory entry
Page offset
bits 22 through 31
bits 0 through 21
The GDT is defined as the table sysGdt[ ] in sysALib.s. The table begins with five
entries: a null entry, an entry for program code, an entry for program data, an entry
for exceptions, and an entry for interrupts. If error detection and reporting is
enabled, an additional entry is added for task gate management of the OSM stack
as well as two TSS entries (one for OSM save information and one for OSM restore
information). If RTPs are enabled, an entry is provided for level 3 (user-mode)
support. The table is initially set to have an available memory range of
0x0-0xffffffff. For boards that support PCI, INCLUDE_PCI is defined in config.h
and VxWorks does not alter the pre-set memory range. This memory range is
available at run-time with the MMU configuration.
If INCLUDE_PCI is not defined (the default for boards that do not support PCI),
VxWorks adjusts the GDT using the sysMemTop( ) routine to check the actual
memory size during system initialization and set the table to have an available
memory range of 0x0-sysMemTop( ). This causes a general protection fault to be
generated for any memory access outside the memory range 0x0-sysMemTop( ).
4.4.11 Interrupts
Interrupt service routines (ISRs) are executed in supervisor mode (PL0) with the
tasks supervisor stack or the dedicated interrupt stack.
68
4 Intel Architecture
4.4 Architecture Considerations
The task supervisor stack is the default stack, and its use does not require the OS
to perform any software intervention. Whereas, the dedicated interrupt stack does
require software manipulation. That is, you can control the trade-off between
performance and memory consumption by selecting the stack used with an ISR. If
you want faster interrupt response time, use the task stack; if you want to save on
memory consumption, use the dedicated interrupt stack. To use the dedicated
interrupt stack, perform intStackEnable(TRUE) in the task level.
Interrupt Handling
Exceptions and the NMI interrupt are assigned vectors in the range of 0 through
31. Unassigned vectors in this range are reserved for possible future use. The
vectors in the range 32 to 255 are provided for maskable interrupts.
The Intel Architecture (Pentium) architecture enables or disables all maskable
interrupts with the IF flag in the EFLAGS register. An external interrupt controller
handles multi-level priority interrupts. The most popular interrupt controller is the
Intel 8259 PIC (programmable interrupt controller) which is supported by
VxWorks as an interrupt controller driver.
The Fully Nested Mode and the Special Fully Nested Mode are supported and
configurable in the BSP. In the Special Fully Nested Mode, when an interrupt
request from a slave PIC is in service, the slave is not locked out from the masters
priority logic and further interrupt requests from higher-priority IRQs within the
slave are recognized by the master and initiate interrupts to the processor.
The PIC (8259A) IRQ0 is hard-wired to the PIT (8253) channel 0 in a PC
motherboard. IRQ0 is the highest priority in the 8259A interrupt controller. Thus,
the system clock interrupt handler blocks all lower-level interrupts. This may
cause a delay of the lower-level interrupts in some situations even though the
system clock interrupt handler finishes its job without any delay. This is quite
natural from the hardware point of view, but may not be ideal from the application
software standpoint. The following modes are supplied to mitigate this situation
by providing the corresponding configuration macros in the BSP. The three
mutually exclusive modes are Early EOI Issue in IRQ0 ISR, Special Mask Mode in
IRQ0 ISR, and Automatic EOI Mode. For more information, see your BSP
documentation.
The intLock( ) and intUnlock( ) routines control the IF flag in the EFLAGS register.
The sysIntEnablePIC( ) and sysIntDisablePIC( ) routines control a specified PIC
interrupt level.
69
VxWorks
Architecture Supplement, 6.2
The interrupt descriptor table (IDT) occupies the address range from 0x0 to 0x800,
starting from LOCAL_MEM_LOCAL_ADRS (also called the interrupt vector table,
see Figure 4-1). Vector numbers 0x0 to 0x1f are handled by the default exception
handler. Vector numbers 0x20 to 0xff are handled by the default interrupt handler.
The trap gate is used for exceptions (vector numbers 0x0 - 0x1f). The configurable
global variable sysIntIdtType, which can be set to either trap gate or interrupt gate
in the BSP, is used for interrupts (vector numbers 0x20 - 0xff). The difference
between an interrupt gate and a trap gate is its effect on the IF flag: using an
interrupt gate clears the IF flag, which prevents other interrupts from interfering
with the current interrupt handler.
Each vector entry in the IDT contains the following information:
OSM
The OSM stack is needed for handling and recovery of stack overflow/underflow
conditions and is triggered immediately following a page fault (stack
overflow/underflow conditions are seen as a page fault). Issues that exist when
possible stack overflow/underflow occurs are passed to the OSM stack. A task
gate is used for the page fault. This allows VxWorks to jump to the OSM task
routine. The task routine then establishes an OSM task, reconfigures both OSM TSS
entries and the segment descriptors to their proper states before the exception
occurs, and then enters the excStub as if handling a standard page fault. By using
a new safe stack, the OSM allows the user to attempt a recovery and to debug
the issue that caused the stack problem.
BOI and EOI
The interrupt handler calls intEnt( ) and saves the volatile registers (eax, edx, and
ecx). It then calls the ISR, which is usually written in C. Finally, the handler restores
the saved registers and calls intExit( ).
The beginning-of-interrupt (BOI) and end-of-interrupt (EOI) routines are called
before and after the ISR. The BOI routine ascertains whether or not the interrupt is
stray; if it is stray, the BOI routine jumps to intExit( ). If the interrupt is not stray,
70
4 Intel Architecture
4.4 Architecture Considerations
the BOI routine returns to the caller. The EOI routine issues an EOI signal to the
interrupt controller, if necessary.
Some device drivers (depending on the manufacturer, the configuration, and so
on) generate a stray interrupt on IRQ7 (which is used by the parallel driver), and
on IRQ15. The global variable sysStrayIntCount is incremented each time such an
interrupt occurs, and a dummy ISR is connected to handle these interrupts. For
more information about sysStrayIntCount, see your BSP documentation.
Interrupt Mode
Three interrupt modes are supported. The PIC Mode is the default interrupt mode.
This mode uses the popular i8259A interrupt controller. The Virtual Wire Mode
uses local APIC and i8259A. The Symmetric I/O Mode uses local APIC and I/O
APIC. For more information, see your BSP documentation and 4.4.18 Advanced
Programmable Interrupt Controller (APIC), p.74.
4.4.12 Exceptions
Exception handlers are executed in supervisor mode (PL0) with the task
supervisor stack. All exceptions are expected to use the exception stack.
Exceptions differ from interrupts, with regard to the operating system, because
interrupts are executed at the interrupt level and exceptions are executed at the
task level.
After saving all registers on the supervisor stack, the task prints out the exception
messages and then suspends itself. Execution can be resumed with the information
stored in the supervisor stack.
The processor generates an exception stack frame in one of two formats,
depending on the exception type. The types are as follows:
(EIP + CS + EFLAGS) or (ERROR + EIP + CS + EFLAGS)
The CS (Code Selector) register is taken from the vector table entry. That entry is
the sysCsExc global variable defined in the BSP.
71
VxWorks
Architecture Supplement, 6.2
4.4.16 Registers
Memory Type Range Register (MTRR)
72
4 Intel Architecture
4.4 Architecture Considerations
/* base register */
/* mask register */
/* MTRR */
/*
/*
/*
/*
MTRR
MTRR
MTRR
MTRR
cap register */
defType register */
fixed range registers */
variable range registers */
4.4.17 Counters
Performance Monitoring Counters (PMCs)
The P5 (Pentium) and P6 (PentiumPro, II, III) families of processors have two
performance-monitoring counters for use in monitoring internal hardware
operations. These counters are duration or event counters that can be programmed
to count any of approximately 100 different types of events, such as the number of
instructions decoded, number of interrupts received, or number of cache loads.
PMCs are initialized in sysHwInit( ).
73
VxWorks
Architecture Supplement, 6.2
The local APIC/xAPIC module is a driver for the local advanced programmable
interrupt controller in the P6 (PentiumPro, II, III) and P7 (Pentium 4) families of
processors. The local APIC/xAPIC is included in selected P6 and P7 processors.
On P6 and P7 family processors, the presence or absence of an on-chip local APIC
can be detected using the CPUID instruction. When the CPUID instruction is
executed, bit 9 of the feature flags returned in the EDX register indicates the
presence (set) or absence (clear) of an on-chip local APIC.
The local APIC performs two main functions for the processor:
It processes local external interrupts that the processor receives at its interrupt
pins as well as local internal interrupts generated by software.
The local APIC controls the dispatching of interrupts (to its associated processor)
that it receives either locally or from the I/O APIC. It provides facilities for
queuing, nesting, and masking interrupts. The local APIC handles the interrupt
delivery protocol with its local processors as well as accesses to APIC registers. In
addition, it manages interprocessor interrupts and remote APIC register reads. A
timer on the local APIC allows local generation of interrupts, and local interrupt
pins permit local reception of processor-specific interrupts.
74
4 Intel Architecture
4.4 Architecture Considerations
The local APIC can be disabled and used in conjunction with a standard
8259A-style interrupt controller. Disabling the local APIC can be done in hardware
for Pentium (P5) processors or in software for P6 and P7 family processors.
The local APIC in P7 (Pentium 4) processors (called the xAPIC) is an extension of
the local APIC found in P6 family processors. The primary difference between the
APIC architecture and xAPIC architecture is that with Pentium 4 processors, the
local xAPICs and I/O xAPIC communicate with one another through the
processors system bus; whereas, with P6 family processors, communication
between the local APICs and the I/O APIC is handled through a dedicated 3-wire
APIC bus. Also, some of the architectural features of the local APIC have been
extended and/or modified in the local xAPIC.
The base address of the local APIC and I/O APIC is taken from the MP
configuration table (for more information, see Intel MP Specification Version 1.4) or
the IA32_APIC_BASE MSR. If the local APIC driver is unable to find the addresses,
it uses LOAPIC_BASE and IOAPIC_BASE as defined in the BSP. This driver contains
three routines for use. The routines are:
loApicInit( ) initializes the local APIC for the interrupt mode chosen.
loApicShow( ) shows the local APIC registers.
loApicMpShow( ) shows the MP configuration table.
The MP specification defines three interrupt modes: virtual wire mode, symmetric
I/O mode, and PIC mode. Local APIC is used in the virtual wire mode (define
VIRTUAL_WIRE_MODE in the BSP) and the symmetric I/O mode (define
SYMMETRIC_IO_MODE in the BSP). However, it is not used in PIC mode (the
default interrupt mode) which uses the 8259A PIC.
In the virtual wire mode, interrupts are generated by the 8259A equivalent PICs,
but delivered to the boot strap processor by the local APIC. The local APIC is
programmed to act as a virtual wire; that is, it is logically indistinguishable from
a hardware connection. This is a uniprocessor compatibility mode.
In symmetric I/O mode, the local and I/O APICs are fully functional, and
interrupts are generated and delivered to the processors by the APICs. Any
interrupt can be delivered to any processor. This is the only multiprocessor
interrupt mode.
The local and I/O APICs support interrupts in the range of 32 to 255. Interrupt
priority is implied by its vector, according to the following relationship: priority =
vector / 16. Here the quotient is rounded down to the nearest integer value to
determine the priority, with 1 being the lowest and 15 the highest. Because vectors
0 through 31 are reserved for exclusive use by the processor, the priority of user
defined interrupts range from 2 to 15. A value of 15 in the interrupt class field of
75
VxWorks
Architecture Supplement, 6.2
the task priority register (TPR) masks off all interrupts that require interrupt
service. A P6 family processors local APIC includes an in-service entry and a
holding entry for each priority level. To avoid losing interrupts, software should
allocate no more than 2 interrupt vectors per priority. P7 (Pentium 4) family
processors expand this support by allowing two interrupts per vector rather than
per priority level.
I/O APIC/xAPIC
The I/O APIC/xAPIC module is a driver for the I/O advanced programmable
interrupt controller for P6 (PentiumPro, II, III) and P7 (Pentium 4) family
processors. The I/O APIC/xAPIC is included in some Intel system chip sets, such
as ICH2. Software intervention may be required to enable the I/O APIC/xAPIC on
some chip sets.
The 8259A interrupt controller is intended for use in uniprocessor systems; I/O
APIC can be used in either uniprocessor or multiprocessor systems. The I/O APIC
handles interrupts very differently than the 8259A. Briefly, these differences are:
The I/O APIC unit consists of a set of interrupt input signals, a 24-entry by 64-bit
interrupt redirection table, programmable registers, and a message unit for
sending and receiving APIC messages over the APIC bus or the front-side (system)
bus. I/O devices inject interrupts into the system using one of the I/O APIC
interrupt lines. The I/O APIC selects the corresponding entry in the redirection
table and uses the information in that entry to format an interrupt request message.
Each entry in the redirection table can be individually programmed to indicate
edge/level sensitive interrupt signals, the interrupt vector and priority, the
destination processor, and how the processor is selected (statically and
dynamically). The information in the table is used to transmit a message to other
APIC units (via the APIC bus or the front-side (system) bus).
I/O APIC is used in the symmetric I/O mode (define SYMMETRIC_IO_MODE in
the BSP). The base address of the I/O APIC is determined in loApicInit( ) and
stored in the global variables ioApicBase and ioApicData. The ioApicInit( )
routine initializes the I/O APIC with information stored in ioApicRed0_15 and
76
4 Intel Architecture
4.4 Architecture Considerations
The local APIC timer library contains routines for the timer in the Intel local
APIC/xAPIC in P6 (PentiumPro, II, III) and P7 (Pentium 4) family processors.
The local APIC contains a 32-bit programmable timer for use by the local processor.
This timer is configured through the timer register in the local vector table. The
time base is derived from the processors bus clock, divided by a value specified in
the divide configuration register. After reset, the timer is initialized to zero. The
timer supports one-shot and periodic modes. The timer can be configured to
interrupt the local processor with an arbitrary vector.
The library gets the system clock from the local APIC timer and auxiliary clock
from either RTC or PIT channel 0 (define PIT0_FOR_AUX in the BSP). The macro
APIC_TIMER_CLOCK_HZ must also be defined to indicate the clock frequency of
the local APIC timer. The parameters SYS_CLK_RATE_MIN, SYS_CLK_RATE_MAX,
AUX_CLK_RATE_MIN, and AUX_CLK_RATE_MAX must be defined to provide
parameter checking for the sysClkRateSet( ) and sysAuxClkRateSet( ) routines.
The timer driver uses the processors on-chip TSC (timestamp counter) for the
timestamp driver. The TSC is a 64-bit timestamp counter that is incremented every
processor clock cycle. The counter is incremented even when the processor is
halted by the HLT instruction or the external STPCLK# pin. The timestamp counter
is set to 0 following a hardware reset of the processor. The RDTSC instruction reads
the timestamp counter and is guaranteed to return a monotonically increasing
unique value whenever executed, except for 64-bit counter wraparound. Intel
guarantees, architecturally, that the timestamp counter frequency and
configuration will be such that it will not wraparound within 10 years after being
reset to 0. The period for counter wrap is several thousands of years in P6
(PentiumPro, II, III) and P7 (Pentium 4) family processors.
77
VxWorks
Architecture Supplement, 6.2
78
4 Intel Architecture
4.4 Architecture Considerations
79
VxWorks
Architecture Supplement, 6.2
Anchor for the shared memory network (if there is shared memory on the
board).
Boot Line
80
4 Intel Architecture
4.4 Architecture Considerations
Initial Stack
size depends on size of system image and interrupt stack. The end of the free
memory pool for this board is returned by sysMemTop( ).
Figure 4-1 shows a lower memory option.
Figure 4-2 illustrates the typical upper memory configuration.
All addresses shown in Figure 4-2 are relative to the start of memory for a
particular target board. The start of memory (corresponding to 0x0 in the
memory-layout diagram) is defined as LOCAL_MEM_LOCAL_ADRS under
INCLUDE_MEMORY_CONFIG for each target.
In general, the boot image is placed in lower memory and the VxWorks image is
placed in upper memory, leaving a gap between lower and upper memory. Some
BSPs have additional configurations which must fit within their hardware
constraints. For details, see the reference entry for each BSP.
81
VxWorks
Architecture Supplement, 6.2
Figure 4-1
+800
GDT
+1100
SM Anchor
+1200
Boot Line
KEY
+1300
= Available
Exception Message
+2000
= Reserved
FD DMA Area
+5000
Initial Stack
+8000
System Image
WDB Memory Pool
Interrupt Stack
_end
82
+100000
sysMemTop( )
4 Intel Architecture
4.4 Architecture Considerations
Figure 4-2
( 2 KB )
+800
GDT
+1100
SM Anchor
+1200
Boot Line
+1300
Exception Message
+2000
FD DMA Area
+5000
KEY
= Available
= Reserved
(no memory)
Initial Stack
+a0000
+100000
+108000
System Image
_end
WDB Memory Pool
Interrupt Stack
sysMemTop( )
83
VxWorks
Architecture Supplement, 6.2
84
5
MIPS
5.1 Introduction 85
5.2 Supported Processors 85
5.3 Interface Variations 88
5.4 Architecture Considerations 95
5.5 Reference Material 113
5.1 Introduction
This chapter provides information specific to VxWorks development on MIPS
processors.
85
VxWorks
Architecture Supplement, 6.2
MIPS32sf
This category includes both big- and little-endian versions of the library. The
32-bit R4000-style processors are represented here.
MIPS64
This category includes both big- and little-endian versions of the library. The
64-bit R4000 and later processors are represented here.
The VxWorks 6.2 libraries support a wide range of MIPS CPUs, including MIPS32
and MIPS64 implementations. Because of the wide range of MIPS processors
available, it is beyond the scope of this document to provide a complete listing of
supported CPUs. However, Table 5-1 provides information for a representative
group of CPUs supported by VxWorks.
NOTE: Table 5-1 is accurate at the time of this writing. However, support for
additional CPUs and libraries may be added at any time. For a complete and
updated list of supported MIPS devices, libraries, and BSPs, see the Wind River
Online Support Web site.
When reviewing the information in the table, you should note that the cache
support for a particular processor is independent of the library.
Each MIPS ISA level contains a superset of the instructions in the preceding level.
Normally, this means that processors implementing ISA III (for example, MIPS64)
are supported by both the ISA II MIPS32 libraries and the ISA III MIPS64 libraries.
However, processors implementing the ISA II (for example, MIPS32) are only
supported by the ISA II MIPS32 libraries.
Table 5-1
CPU
CPU Variant
ISA Level
Library
bcm1250
_bcm125x
MIPS64
MIPS64xxx
bcm1250e
_bcm125x
MIPS64
MIPS64xxx
Broadcom Devices
_mti4kx
MIPS32
MIPS32sfxxx
MIPS32sfxxxle
4kec
_mti4kx
MIPS32
MIPS32sfxxx
MIPS32sfxxxle
86
5 MIPS
5.2 Supported Processors
Table 5-1
CPU
CPU Variant
ISA Level
Library
5kc
_mti5kx
MIPS32 a
MIPS32sfxxx
MIPS32sfxxxle
5kf
_mti5kx
MIPS64
MIPS32sfxxx
MIPS32sfxxxle
MIPS64xxx
MIPS64xxxle
24kc
_mti24kx
MIPS32b
MIPS32sfxxx
MIPS32sfxxxle
24kec
_mti24kx
MIPS32
MIPS32sfxxx
MIPS32sfxxxle
_vr55xx
IV
MIPS32sfxxx
MIPS32sfxxxle
MIPS64xxx
MIPS64xxxle
MIPS64
MIPS64xxx
NEC Devices
vr5500
_rm9xxx
_tx49xx
MIPS32
MIPS32sfxxx
MIPS32sfxxxle
tx4938
_tx49xx
MIPS64
MIPS64xxx
MIPS64xxxle
a. The 5kc is a MIPS64 device with an optional floating-point unit. However, because
VxWorks does not provide MIPS64 support for software floating-point operations, it is
listed as a MIPS32 device.
b. Toolchain support for the Revision 2 instruction set implemented in 4kec and 24kc
processors is not available at this time. However, in the _mti24kx variant kernel
libraries, the use of a series of nop or ssnop instructions used to handle hazards has
been replaced by the ehb instruction by using a .word 0x000000c0 directive.
87
VxWorks
Architecture Supplement, 6.2
NOTE: The library support examples provided in Table 5-1 represent both
For complete documentation, see the reference entries for the libraries,
subroutines, and tools discussed in the following sections.
88
5 MIPS
5.3 Interface Variations
5.3.1 dbgArchLib
tt( ) Routine
In VxWorks for MIPS, the tt( ) routine does not currently display parameter
information. A more complete stack trace, including function call parameter
information, may be available through the use of a host-based debugger.
Support for the bh( ) debugger command is provided for those MIPS processor
cores that are MIPS32 and MIPS64 compliant in VxWorks 6.2 and newer releases.
The MIPS32/MIPS64 specification provides a mechanism to support up to eight
hardware breakpoints (also referred to as watchpoints). Currently, only the
following MIPS32/MIPS64 compliant processor cores are supported:
Data write
Data read
Instruction execution
NOTE: This leaves only bits 31..3 implemented for specifying the address (Vaddr)
in the WatchLo register(s) for the breakpoint. This arrangement only allows
watchpoints to be set on doubleword boundaries. This means that because bits 2..0
are ignored, executing an instruction at either 0xc0010000 or 0xc0010004 results in
a watchpoint exception. While the instruction not designated as the watchpoint is
not processed beyond the exception handling, operational speed may be reduced.
Watchpoints set on instructions that reside in branch delay slots are not available
as valid watchpoint addresses. However, nothing prevents you from setting these
89
VxWorks
Architecture Supplement, 6.2
5.3.2 intArchLib
In VxWorks for MIPS, the routines intLevelSet( ) and intVecBaseSet( ) have no
effect. For a discussion of the MIPS interrupt architecture, see 5.4.7 Interrupts, p.99.
5.3.3 taskArchLib
The routine taskSRInit( ) is specific to the MIPS architecture. This routine allows
you to change the default status register with which a task is spawned. For more
information, see 5.4.7 Interrupts, p.99.
The kernel resides in kseg0 and kseg1 because these address ranges do not
utilize the MMU.
RTPs reside in the kernel heap, which is allocated in kseg0. RTPs run in the
kernel protection state.
90
5 MIPS
5.3 Interface Variations
RTPs reside in kuseg (the lower 2 GB of the 32-bit virtual address space).
When the VxWorks kernel includes memory management, the kernel reserves a
portion of the hardware translation lookaside buffer (TLB) registers to create a
persistent memory map for the kernel text segment. This persistent memory map
eliminates any address translation overhead for instruction references within the
kernel text segment. BSPs provided by Wind River initialize the TLB registers
appropriately for mapped operation. Pre-VxWorks 6.0 BSPs that make use of the
MMU (for example, for accessing memory and peripheral devices at addresses
beyond the top of the 32-bit address space) need to be modified to avoid conflicting
with the new memory management design of this VxWorks release.
Data Segment Alignment
When the VxWorks kernel includes memory management, static TLB entries are
used to provide the address mapping for the kernel text segment. During the build
process, mapped kernels are linked with the load address of the data segment
aligned to a multiple of an MMU page boundary. This has two effects:
It minimizes the number of TLB entries needed to statically map the kernel
text.
For all practical purposes, the physical memory between the end of the kernel text
section and the beginning of the kernel data is unallocated and unusable.
However, because the padding is done in the linker, the kernel is not increased in
size by the padding amount.
5.3.5 Caches
For most MIPS devices, the caching characteristics of memory in kseg0 are
determined at startup time by the K0 field of the CONFIG register, and should not
be changed once set. For this reason, the VxWorks cacheEnable( ) and
cacheDisable( ) routines are not implemented for MIPS and return ERROR.
For mapped kernels, cache characteristics can be controlled on a page-by-page
basis through the use of the standard VM library API calls.
91
VxWorks
Architecture Supplement, 6.2
92
5 MIPS
5.3 Interface Variations
For more information on building VxWorks Image Projects, see the Wind River
Workbench Users Guide or the VxWorks Command-Line Tools Users Guide.
Mapped Kernel Build Details
In order to support a mapped kernel, the Wind River-supplied MIPS BSPs for this
VxWorks release have been updated in the following ways:
could result in an incorrect linkage address, and could prevent the makefile
from correctly selecting between mapped and unmapped kernels.
93
VxWorks
Architecture Supplement, 6.2
The BSP config.h files have been modified to include logic to correctly set the
INCLUDE_MMU_BASIC component and SW_MMU_ENABLE parameter
dependent upon whether INCLUDE_MAPPED_KERNEL or INCLUDE_RTP are
defined. If INCLUDE_RTP is added to config.h, it must be done before this
logic. Also, the LOCAL_MEM_LOCAL_ADRS, RAM_LOW_ADRS, and
RAM_HIGH_ADRS definitions in config.h have been removed. For BSP builds,
these values are provided in Makefile and the definitions are passed to the
compiler on the command line. For project builds, these values are determined
by the presence or absence of the INCLUDE_MAPPED_KERNEL component.
New startup code has been added to sysALib.s to provide initialization of the
MMU to create static entries in the MMU that allow loading the kernel into
mapped memory space. This avoids the overhead of running the TLB refill
handler when accessing kernel code.
94
5 MIPS
5.4 Architecture Considerations
Other Recommendations
However, the clean is not necessary if you are certain that a mapped kernel
was never built in the BSP directory.
Use caution if you need to modify the logic in config.h that determines the
definitions of INCLUDE_MMU_BASIC and SW_MMU_ENABLE. Specifically, all
combinations of these variables produce unmapped kernels (which must be
linked at appropriate addresses) except if INCLUDE_MMU_BASIC is defined
and SW_MMU_ENABLE is set to FALSE. In this case, you build a kernel that
expects to be mapped but, because the linkage address is determined in
Makefile (which is configured to build an unmapped kernel), the kernel will
not boot.
If you switch between mapped and unmapped kernels in the same BSP
directory, always run make clean before attempting to build the new kernel.
memory ordering
debugger
gp-rel addressing
95
VxWorks
Architecture Supplement, 6.2
reserved registers
signal support
floating-point support
interrupts
memory management unit (MMU)
AIM model for MMU
virtual memory mapping
memory layout
64-bit support
hardware breakpoints
96
5 MIPS
5.4 Architecture Considerations
Software Signal
IV_TLBMOD_VEC
SIGBUS
IV_TLBL_VEC
SIGBUS
IV_TLBS_VEC
SIGBUS
IV_ADEL_VEC
Address Load
SIGBUS
IV_ADES_VEC
Address Store
SIGBUS
IV_IBUS_VEC
SIGSEGV
IV_DBUS_VEC
SIGSEGV
IV_SYSCALL_VEC
System Call
SIGTRAP
IV_BP_VEC
Breakpoint
SIGTRAP
IV_RESVDINST_VEC
Reserved Instruction
SIGILL
IV_CPU_VEC
Coprocessor Unusable
SIGILL
IV_FPA_UNIMP_VEC
Unimplemented Instruction
SIGFPE
IV_FPA_INV_VEC
Invalid Operation
SIGFPE
IV_FPA_DIV0_VEC
Divide-by-zero
SIGFPE
97
VxWorks
Architecture Supplement, 6.2
Table 5-2
Software Signal
IV_FPA_OVF_VEC
Overflow
SIGFPE
IV_FPA_UFL_VEC
Underflow
SIGFPE
IV_FPA_PREC_VEC
Inexact
SIGFPE
asin( )
fabs( )
sinh( )
atan( )
floor( )
sqrt( )
atan2( )
fmod( )
tan( )
ceil( )
log10( )
tanh( )
cos( )
log( )
trunc( )
cosh( )
pow( )
Few 32-bit MIPS processors supported by the MIPS32sf libraries have a hardware
floating-point unit. As a result, floating-point hardware for these processors is not
supported by VxWorks. However, VxWorks provides software emulation support
for the math routines listed above. These math routines are provided using the
VxWorks math libraries.
On 64-bit MIPS III and above microprocessors, a hardware floating-point unit is
often available. On these devices, there is an option of either emulating thirty-two
single-precision (32-bit) floating-point registers, or using the thirty-two
double-precision (64-bit) floating-point registers. Note that VxWorks hardware
floating-point support is available only for processors that include both a complete
double-precision floating-point hardware implementation and the ISA III
instruction set. Table 5-3 shows the available MIPS libraries and the level of
floating-point support provided by each for all possible MIPS CPU types. Note
that access to the 32-bit, single-precision, floating-point registers is not supported
by any VxWorks library. CPUs with this type of floating-point unit must use the
software floating-point emulation provided in the MIPS32 libraries.
98
5 MIPS
5.4 Architecture Considerations
Table 5-3
None or Single-Precision
MIPS32sfxxx
MIPS32sfxxxle
MIPS32sfxxx
MIPS32sfxxxle
Double-Precision
MIPS32sfxxx
MIPS32sfxxxle a
MIPS32sfxxx
MIPS32sfxxxle
MIPS64xxx
MIPS64xxxle a
Floating-Point Hardware
5.4.7 Interrupts
MIPS Interrupts
The MIPS architecture has inputs for six external hardware interrupts and two
software interrupts. In cases where the number of hardware interrupts is
insufficient, board manufacturers can multiplex several interrupts on one or more
interrupt lines.
The MIPS CPU treats exceptions and interrupts in the same way; that is, it branches
to a common vector and provides status and cause registers that let the system
software determine the CPU state. The CPU does not generate an IACK cycle. This
function must be implemented in software or in board-level hardware. (For
example, the VMEbus IACK cycle is a board-level hardware function.) VxWorks
99
VxWorks
Architecture Supplement, 6.2
for MIPS has implemented an interrupt and exception stack for all tasks, including
both user and kernel tasks.
Because the MIPS CPU does not provide an IACK cycle, the interrupt handler must
acknowledge (or clear) the interrupt condition. If the interrupt handler does not
acknowledge the interrupt, VxWorks hangs while repeatedly trying to process the
interrupt condition. The unacknowledged interrupts can fill the work queue and
cause a workQPanic( ) event.
VxWorks for MIPS uses a 256-entry table of vectors. Exception or interrupt
handlers can be attached to any given vector with the intConnect( ) and
intVecSet( ) routines. Note that for interrupt sources whose lines are shared on a
PCI bus, the pciIntConnect( ) routine should be used to attach the handler. The
files installDir/vxworks-6.2/target/h/arch/mips/ivMips.h and bspname.h list the
vectors used by VxWorks.
VxWorks for MIPS follows the same stack conventions as all other VxWorks 6.x
architectures. There is a single interrupt stack, per-task exception stacks, and
per-task execution stacks.
Interrupt Support Routines
Because the MIPS architecture does not use interrupt levels, the intLevelSet( )
routine is not implemented. The six external interrupts and two software
interrupts can be masked or enabled by manipulating eight bits in the status
register with intDisable( ) and intEnable( ). Be careful to pass correct arguments
to these routines because the MIPS status register controls much more than
interrupt generation.
For interrupt control, the intLock( ) and intUnlock( ) routines are recommended.
The intLock( ) routine prevents interrupts from occurring while the current task is
running. However, if some action is taken that causes another task to run (such as
a call to semTake( ) or taskDelay( )), the intLock( ) routine is not honored while
the other task is running. For more information, see the reference entry for
intLock( ).
To change the default status register with which all tasks are spawned, use the
taskSRInit( ) routine. The taskSRInit( ) routine is provided in case the BSP must
mask any interrupts from all tasks. This is useful for systems that do not connect
each interrupt line to an appropriate signal or that connect the lines to unwanted
signals. Such lines can cause spurious interrupts. Masking these interrupts can
prevent this from occurring. When using this routine, call it before kernelInit( ) in
sysHwInit( ).
100
5 MIPS
5.4 Architecture Considerations
/*
/*
/*
/*
PRIO_TABLE intPrioTable[] =
{
{CAUSE_SW1,(ULONG) IV_SWTRAP0_VEC, 0x0100, 0},
{CAUSE_SW2,(ULONG) IV_SWTRAP1_VEC, 0x0200, 0},
{CAUSE_IP3,(ULONG) sysVmeDeMux, 0x0400,
IV_VME_BASE_VEC},
{CAUSE_IP4,(ULONG) sysIoDeMux, 0x0800,
IV_IO_BASE_VEC},
{CAUSE_IP5,(ULONG) IV_TIMER0_VEC, 0x1000, 0},
{CAUSE_IP6,(ULONG) sysFpaDeMux, 0x2000,
IV_FPA_BASE_VEC},
{CAUSE_IP7,(ULONG) IV_TIMER1_VEC, 0x4000, 0},
{CAUSE_IP8,(ULONG) IV_BUS_ERROR_VEC, 0x8000, 0}
};
*/
*/
*/
*/
/* sw trap 0 */
/* sw trap 1 */
/* VME muxed */
/* IO muxed
/* timer 0
*/
*/
/* FPA muxed */
/* timer 1
*/
/* bus error */
When an interrupt is received, the handler maps the highest-priority pending line
to its corresponding table entry. It does so in three steps. First, the demultiplex field
is read. If the field is zero, field two is taken as the vector number for the BSR table.
Otherwise, field two is interpreted as a demultiplex function and called with field
four passed as its parameter. When multiple sources share an interrupt line, the job
of the demultiplex function is to calculate a desired vector number and pass it back
to the handler. Next, the mask field is read, and interrupts not currently pending
and not masked are re-enabled. Finally, the handler uses the vector number as an
index into the BSR table and calls the interrupt service routine previously installed
by the user with intConnect( ) or intVecSet( ).
Because tying interrupting sources to the processors interrupt lines is
board-dependent and sometimes arbitrary, VxWorks allows the BSP author to set
the prioritization of interrupt lines. The pointer sysHashOrder points to a lookup
101
VxWorks
Architecture Supplement, 6.2
table that the interrupt handler uses to perform the actual mapping of pending
interrupt lines to a corresponding table entry in intPrioTable. The operation of the
lookup table is simple; that is, the IP field of the cause register is used as an index
into the lookup table to obtain a value that is then used as an index into
intPrioTable.
Acknowledging the Interrupt Condition
Because MIPS processors do not provide an IACK cycle, it is the job of the
user-attached interrupt handler to acknowledge (or clear) the interrupt condition.
The sysAutoAck( ) routine must be provided as a default handler for any possible
interrupt condition. If a spurious interrupt occurs, it is the job of sysAutoAck( ) to
acknowledge the interrupt condition. If an interrupt condition is not
acknowledged, VxWorks tries continuously to process the interrupt condition,
resulting in a workQPanic( ) event. If this occurs, a warm reset will fail to
auto-boot the target because the VxWorks environment variables have been
corrupted by an interrupt stack that has overflowed. A cold start will copy the
variables back into memory.
Interrupt Inversion
When a single interrupt is pending in the cause register, the kernel masks out that
interrupts bit before dispatching it to the interrupt handler. The kernel performs
this mask operation using the contents of the cause register in combination with
field three of the table intPrioTable. Interrupts not masked and not currently
pending are re-enabled. Often, the field three value only explicitly masks its own
interrupt. As a result, any subsequent interrupt, even if it is of a lower priority, can
interrupt the interrupt service routine (ISR). This is known as interrupt inversion.
To prevent interrupt inversion, modify the interrupt masks listed in intPrioTable.
The new values should mask not only the interrupt in question, but all
lower-priority interrupts as well. For example, the interrupt mask for the
highest-priority interrupt is 0xff00. Similarly, the next-highest priority interrupt
mask is 0x7f00. These values explicitly mask the interrupt and all lower-priority
interrupts.
Keep in mind that the value of the appropriate interrupt mask is also dependent
upon whether the least significant bit (LSB) or the most significant bit (MSB) of the
102
5 MIPS
5.4 Architecture Considerations
mask is the highest priority. If the LSB is the highest priority, the masks are as
shown in Table 5-4:
Table 5-4
0 (software, highest)
0xff00
0xfe00
0xfc00
0xf800
0xf000
0xe000
0xc000
7 (lowest)
0x8000
If the MSB is the highest priority, the masks are as shown in Table 5-5:
Table 5-5
0 (software, lowest)
0x0100
0x0300
0x0700
0x0f00
0x1f00
0x3f00
0x7f00
7 (highest)
0xff00
103
VxWorks
Architecture Supplement, 6.2
Note that due to the processors mapping of bits 1 and 0 to software interrupts,
most MIPS BSPs select the MSB as the highest priority. This causes hardware
interrupts to take precedence over software interrupts.
VMEbus Interrupt Handling
The VMEbus has seven interrupt levels. On most MIPS VME boards, these
interrupts are bound to a single interrupt line. This requires software to sense the
VMEbus interrupt and demultiplex the interrupt condition to a single pending
interrupt level. This can be performed using intPrioTable.
It is possible to bind to VMEbus interrupts without vectored interrupts enabled, as
long as the VMEbus interrupt condition is acknowledged with sysBusIntAck( ). In
this case, there is no longer a direct correlation with the vector number returned
during the VMEbus IACK cycle. The vector number used to attach the interrupt
handler corresponds to one of the seven VMEbus interrupt levels as defined in
bspname.h. Mapping the seven VMEbus interrupts to a single MIPS interrupt is
board-dependent.
Vectored interrupts do not change the handling of any interrupt condition except
VMEbus interrupts. All of the necessary interrupt-acknowledgement routines are
provided in either sysLib.c or sysALib.s.
Extended Interrupts on the RM9000
In the original MIPS architecture, provision is made for eight interrupt sources: six
hardware interrupts and two software interrupts. For most MIPS targets, this is
sufficient. With the advent of more complex embedded systems, six hardware
interrupts may not suffice. One common solution is to multiplex multiple interrupt
sources onto a single interrupt pin. This approach requires two levels of processing
to handle each interrupt. First, it must be determined that the interrupt came from
the multiplexed interrupt input. Second, the multiplexed input that caused the
interrupt must be determined.
The PMC Sierra RM9000 family of processors provides an alternative solution.
These processors make provisions for four additional hardware interrupt inputs.
This allows additional expansion without requiring multiple interrupts to be
multiplexed on a single input.
PMC Sierra implemented this change in a manner consistent with the original
design of the status and cause registers. Specifically, the Interrupt Pending (IP)
field of the cause register was extended from 8 to 16 bits, as shown in Figure 5-1.
Six of these bits are now defined; the remaining two are reserved for future use.
This expansion of the IP field was possible because the added bits were not
previously defined.
104
5 MIPS
5.4 Architecture Considerations
However, the status register did not have extra bits available for the needed
additional interrupt mask fields. Therefore, the mask bits had to be placed in a new
register, the interrupt control register (Coprocessor 0, Set 1, Register 20), shown in
Figure 5-1. This field is considered to be an extension of the Interrupt Mask (IM)
field, and mask bits for interrupts 15:8 are placed in bits 15:8 of the interrupt
control register.
Figure 5-1
23
0
CE
W2 W1 IV
8
Interrupt Pending (IP[15:0])
Exc Code
Cause Register
31
15
XX CU CO FR RE DS
8
Interrupt Mask (IM[7:0])
Status Register
31
15
0
8
Interrupt Mask (IM[15:8])
0
TE
VS
While four additional hardware interrupts have been added, six bits of the
extensions to the IP and IM fields have been used. Bits 11:8 of these fields
correspond to the newly added hardware interrupt inputs. Bit 12 is used to control
the Timer interrupt source that was multiplexed with Interrupt input 5 in the
original design. For backward compatibility, the Timer interrupt may still be
placed on Interrupt 5, but setting the TE bit (bit 7) of the interrupt control register
frees Interrupt 5 for use solely as a hardware input, and moves the Timer interrupt
to Interrupt 12. The second additional interrupt input is used in conjunction with
the Performance Counters implemented in the RM9000 family. This has been
placed on Interrupt 13.
The additional hardware interrupts on the RM9000 family add to the intPrioTable
that is used by the exception and interrupt handling routines in excLib to call a
user-attached interrupt handler. A typical extended interrupt table is as follows:
PRIO_TABLE intPrioTable[] =
{
{CAUSE_SW1,(ULONG) IV_SWTRAP0_VEC,
{CAUSE_SW2,(ULONG) IV_SWTRAP1_VEC,
{CAUSE_IP3,(ULONG) IV_IORQ0_VEC,
0x000100, 0},
0x000200, 0},
0x000400, 0},
/* sw trap 0
/* sw trap 1
/* Reserved
105
*/
*/
*/
VxWorks
Architecture Supplement, 6.2
{CAUSE_IP4,(ULONG) IV_IORQ1_VEC,
{CAUSE_IP5,(ULONG) IV_IORQ2_VEC,
{CAUSE_IP6,(ULONG) IV_IORQ3_VEC,
{CAUSE_IP7,(ULONG) IV_IORQ4_VEC,
{CAUSE_IP8,(ULONG) IV_TIMER_VEC,
{CAUSE_IP9,(ULONG) IV_IORQ6_VEC,
{CAUSE_IP10,(ULONG)IV_IORQ7_VEC,
{CAUSE_IP11,(ULONG)IV_IORQ8_VEC,
{CAUSE_IP12,(ULONG)IV_IORQ9_VEC,
{CAUSE_IP13,(ULONG)IV_IORQ10_VEC,
{CAUSE_IP14,(ULONG)IV_IORQ11_VEC,
{CAUSE_IP15,(ULONG)IV_IORQ12_VEC,
{CAUSE_IP16,(ULONG)IV_IORQ13_VEC,
0x000800,
0x001000,
0x002000,
0x004000,
0x008000,
0x010000,
0x020000,
0x040000,
0x080000,
0x100000,
0x200000,
0x400000,
0x800000,
0},
0},
0},
0},
0},
0},
0},
0},
0},
0},
0},
0},
0},
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
Uart
Expansion Conn
Expansion Conn
Expansion Conn
Timer
Expansion Conn
Expansion Conn
Expansion Conn
Expansion Conn
Alternate Tmr
Perf Counter
Reserved
Reserved
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
};
106
5 MIPS
5.4 Architecture Considerations
107
VxWorks
Architecture Supplement, 6.2
Figure 5-2
kuseg
512 MB
0000 0000
0
Virtual Memory
Physical Memory
As indicated in Figure 5-2, VxWorks operation is limited to kernel mode in the two
unmapped memory segments, kseg0 and kseg1. A physical addressing range of
512 MB is available. The on-chip translation lookaside buffer (TLB) is not
supported in this mode therefore access to kuseg and kseg2 is not available.
To summarize the kseg0 and kseg1 segments:
kseg0
When the most significant three bits of the virtual address are 100, the 229byte
(512 MB) kernel physical space, labeled kseg0, is the virtual address space
selected. The physical address selected is defined by subtracting 0x8000.0000
from the virtual address. The cache mode for these accesses is determined by
the K0 field of the configuration register, which is initialized in the BSP
romInit( ) routine.
kseg1
When the most significant three bits of the virtual address are 101, the 229byte
(512 MB) kernel physical space, labeled kseg1, is the virtual address space
selected. The physical address selected is defined by subtracting 0xA000.0000
from the virtual address. Caches are always disabled for accesses to these
addresses; physical memory or memory-mapped I/O device registers are
accessed directly.
108
5 MIPS
5.4 Architecture Considerations
Figure 5-3
minus1
temp
FFFF E000
5
E000 0000
kseg2
kernel
C000 0000
kseg1
A000 0000
kseg0
8000 0000
512 MB
kuseg
RTPs
0000 0000
40 KB
32 KB
0000 0000
Virtual Memory
Variable
mapping
through vmLib
Physical Memory
Figure 5-3 illustrates the memory map used for mapped kernels. In mapped mode,
kernel text and data are located in kseg2, while RTPs operate in kuseg. A region at
the top of the 32-bit address space is used for temporary storage of working
variables during exception processing. The descriptions of the additional segments
kseg2, kuseg, and minus1 are as follows:
kuseg
When the most significant three bits of the virtual address are 000, the 231byte
user virtual space, labeled kuseg, is selected. Access to kuseg addresses
requires a TLB entry to map that virtual address to a physical address. The
specifics of the translation between virtual and physical addresses are
dynamic and managed by the virtual memory (VM) library. Cache
characteristics and write protection are controlled (through the VM library) by
control bits in the TLB entry, and may be selected on a page-by-page basis.
kseg2
When the most significant three bits of the virtual address are 110, the 229byte
kernel virtual space, labeled kseg2, is selected. Access to kseg2 addresses
109
VxWorks
Architecture Supplement, 6.2
The memory layout of a mapped MIPS kernel occupies memory in kseg2 for the
kernel text and data sections, kseg0 and kseg1 for vectors and DMA device
buffers, kuseg for RTPs, and minus1 for variable storage while entering and
exiting exception handling code. For single core BSPs, the value of
LOCAL_MEM_LOCAL_ADRS is typically defined as 0xC0000000 (the virtual
starting address of kseg2) for mapped kernels. In multi-core BSPs,
LOCAL_MEM_LOCAL_ADRS is normally adjusted for each subsequent core,
depending upon the system requirements.
110
5 MIPS
5.4 Architecture Considerations
Because the MMU is not yet set up when the boot ROM runs, the mapped kernel
is loaded into kseg0, just as it is for unmapped kernels. However, the kseg0
address is an alias of the kseg2 address at which the kernel is linked. When the
boot ROM loads the mapped kernel and transfers to its entry point, the mapped
kernel sets up the MMU so that the kernel text and data can be accessed at their
mapped addresses in kseg2. Then, the boot process continues by running from
kseg2.
It should be noted that alternate values are required for
LOCAL_MEM_LOCAL_ADRS, RAM_LOW_ADRS, and RAM_HIGH_ADRS for
mapped kernels. The mapped kernel build mechanism takes these differences into
account.
Figure 5-4
ROM Image
ROM_TEXT_ADRS
ROM Image
(copied into RAM)
2
RAM_HIGH_ADRS
LOCAL_MEM_SIZE
VxWorks Image
(loaded by ROM)
RAM_LOW_ADRS
LOCAL_MEM_LOCAL_ADRS
111
VxWorks
Architecture Supplement, 6.2
Exception Vectors
Initial stack set up by romInit( ) and used by usrInit( ) until usrRoot( ) has
allocated the stack. Its size is determined by STACK_SAVE.
System Image
The VxWorks image entry point. The VxWorks image consists of three
segments: .text, .data, and .bss.
Interrupt Stack
The memory allocated for system use. The size of the memory pool is
dependent on the size of the system image and interrupt stack. The end of the
system memory pool is determined by sysMemTop( ).
Figure 5-5
ISR_STACK_SIZE
Interrupt Stack
end
System Image
bss
data
text
STACK_SAVE
Initial Stack
Exception Vectors
112
RAM_LOW_ADRS
LOCAL_MEM_LOCAL_ADRS
5 MIPS
5.5 Reference Material
The information given in this section is current at the time of writing; should you
decide to use these documents, you may wish to contact the manufacturer or
publisher for the most current version.
See MIPS Run. Sweetman, Dominic. Morgan Kaufmann Publishers, Inc.,
San Francisco, CA. 1999.
113
VxWorks
Architecture Supplement, 6.2
114
6
PowerPC
6.1 Introduction
This chapter provides information specific to VxWorks development on supported
PowerPC processors.
115
VxWorks
Architecture Supplement, 6.2
VxWorks PowerPC
CPU Family
Description
PPC403
PPC405
PPC440
PPC603
PPC604
PPC85XX
MPC85XX
PPC860
PPC32
NOTE: Support for additional processor core types may be added periodically. See
the Wind River Online Support Web site for the latest information.
116
6 PowerPC
6.3 Interface Variations
For complete documentation, see the reference entries for the libraries, routines,
and tools discussed in the following sections.
you do not reuse objects compiled for a different environment, including an older
version of VxWorks.
117
VxWorks
Architecture Supplement, 6.2
rx, HIADJ(VALUE)
rx, rx, LO(VALUE)
rx, HI(VALUE)
rx, rx, LO(VALUE)
The PowerPC MMU introduces a distinction between instruction and data MMU
and allows them to be separately enabled or disabled. Two parameters,
USER_I_MMU_ENABLE and USER_D_MMU_ENABLE, are provided in the Params
tab of the Properties window under SELECT_MMU. The default settings of these
parameters are specified by the BSP. Wind River-supplied BSPs for PowerPC 405
and PowerPC 440 processors specify USER_I_MMU_ENABLE as FALSE because this
setting provides performance benefits in images that do not support RTPs (see
PowerPC 405 Performance, p.124 and PowerPC 440 Performance, p.126).
Wind River-supplied BSPs for other PowerPC processor types specify both
USER_I_MMU_ENABLE and USER_D_MMU_ENABLE as TRUE.
118
6 PowerPC
6.3 Interface Variations
NOTE: When configuring a VxWorks image for use with real-time processes
(RTPs), both the instruction and the data MMU must be enabled.
MMU_ATTR_CACHE_WRITETHRU
(or VM_STATE_CACHEABLE_WRITETHROUGH)
MMU_ATTR_CACHE_OFF (or VM_STATE_CACHEABLE_NOT)
MMU_ATTR_SUP_RWX (or VM_STATE_WRITEABLE)
MMU_ATTR_PROT_SUP_READ | MMU_ATTR_PROT_SUP_EXE
(or VM_STATE_WRITEABLE_NOT)
MMU_ATTR_CACHE_COHERENCY (or VM_STATE_MEM_COHERENCY)
MMU_ATTR_CACHE_GUARDED (or VM_STATE_GUARDED)
NOTE: In VxWorks 5.5, memory protection attributes are set using various
VM_STATE_xxx macros. These macros (as listed above) are still supported for this
release. However, these macros may be removed in a future release. Wind River
recommends that you use the MMU_ATTR_xxx macros for new development and
that you update any existing BSP to use the new macros whenever possible. For
more information on the VM_STATE_xxx macros, see the VxWorks Migration Guide.
NOTE: Memory coherency page state is only supported for PowerPC 603,
PowerPC 604, MPC85XX, and PowerPC 970. On PowerPC 970 processors, the
memory coherency attribute is not supported; PowerPC 970 always enforces
memory coherency, whether the attribute is set or not.
The first constant sets the page descriptor cache mode field in cacheable
write-through mode. Cache coherency and guarded modes are controlled by the
119
VxWorks
Architecture Supplement, 6.2
The PowerPC 603 (including MPC82XX and MPC83XX) and PowerPC 604
(including MPC7XX, MPC74XX, PowerPC 750CX, 750FX, and 750GX; collectively,
the PowerPC 604 family) MMU supports two models for memory mapping. The
first, the block address translation (BAT) model, allows mapping of a memory
block ranging in size from 128 KB to 256 MB (or larger, depending on the CPU) into
a BAT register. The second, the segment model, gives the ability to map the
memory in pages of 4 KB. VxWorks for PowerPC supports both memory models.
PowerPC 603/604 Block Address Translation Model
The block address translation (BAT) model takes precedence over the segment
model. However, the BAT model is not supported by the VxWorks vmLib or cache
libraries. Therefore, routines provided by those libraries are not effective, and no
errors are reported, in memory spaces mapped by BAT registers. Typically, in
VxWorks, the BATs are only used to map large external regions, or PROM/flash,
where fine grain control is unnecessary; this has the advantage of reducing the size
of the page table entry (PTE) table used by the segment model.
All PowerPC 603 and PowerPC 604 family members include eight BATs: four
instruction BATS (IBAT) and four data BATs (DBAT). The BAT registers are always
active, and must be initialized during boot. Typically, romInit( ) initializes all
(active) BATs to zero so that they perform no translation. No further work is
required if the BATs are not used for any address translation.
Motorola MPC7X5, MPC74X5, MPC8349, MPC8272, and MPC8280 CPUs have an
additional four IBAT and four DBAT registers. These extra BATs can be enabled or
disabled (HID0 or HID1, depending on the CPU); they are disabled by hardware
reset. Configuring these additional BATs for VxWorks is optional.
The IBM PowerPC 750FX also adds four IBAT and four DBAT registers, but these
are always enabled. In this case, the additional BATs must be configured.
120
6 PowerPC
6.3 Interface Variations
The data structure sysBatDesc[ ], defined in sysLib.c, handles the BAT register
configuration. All of the configuration constants used to fill sysBatDesc[ ] are
defined in installDir/vxworks-6.2/target/h/arch/ppc/mmu603Lib.h for both the
PowerPC 603 and the PowerPC 604. Providing the correct entries in sysBatDesc[ ]
is sufficient to configure the basic four BATs; no additional software configuration
is required. For information on configuring all eight BAT registers, see the
following section. If sysBatDesc[ ] is not defined by the BSP, the BATs are left alone
after being configured by romInit( ).
6
Enabling Additional BATs
If the extra BATs are to be used, the following steps must be performed in the BSP:
1.
2.
3.
The sysBatDesc[ ] array essentially doubles in size, and the order of the entries is
fixed. The initial 16 entries are identical in meaning to the original array, so may
remain unchanged. For example (from the sp745x BSP):
UINT32 sysBatDesc [2 * (_MMU_NUM_IBAT + _MMU_NUM_DBAT +
_MMU_NUM_EXTRA_IBAT + _MMU_NUM_EXTRA_DBAT)] =
{
/* I BAT 0 */
((ROM_BASE_ADRS & _MMU_UBAT_BEPI_MASK) | _MMU_UBAT_BL_1M |
_MMU_UBAT_VS | _MMU_UBAT_VP),
((ROM_BASE_ADRS & _MMU_LBAT_BRPN_MASK) | _MMU_LBAT_PP_RW |
_MMU_LBAT_CACHE_INHIBIT),
0,0,
/* I BAT 1 */
0,0,
/* I BAT 2 */
0,0,
/* I BAT 3 */
/* D BAT 0 */
((ROM_BASE_ADRS & _MMU_UBAT_BEPI_MASK) | _MMU_UBAT_BL_1M |
_MMU_UBAT_VS | _MMU_UBAT_VP),
((ROM_BASE_ADRS & _MMU_LBAT_BRPN_MASK) | _MMU_LBAT_PP_RW |
_MMU_LBAT_CACHE_INHIBIT),
0,0,
0,0,
0,0,
/* D BAT 1 */
/* D BAT 2 */
/* D BAT 3 */
121
VxWorks
Architecture Supplement, 6.2
/*
* These entries are for the the I/D BATs (4-7) on the MPC7455/755.
* They should be defined in the following order.
* IBAT4U,IBAT4L,IBAT5U,IBAT5L,IBAT6U,IBAT6L,IBAT7U,IBAT7L,
* DBAT4U,DBAT4L,DBAT5U,DBAT5L,DBAT6U,DBAT6L,DBAT7U,DBAT7L,
*/
0,0,
/* I BAT 4 */
0,0,
/* I BAT 5 */
0,0,
/* I BAT 6 */
0,0,
/* I BAT 7 */
0,0,
/* D BAT 4 */
0,0,
/* D BAT 5 */
0,0,
/* D BAT 6 */
0,0
/* D BAT 7 */
};
This routine reads sysBatDesc[ ], initializes the BAT registers, and performs any
other required setup; for example, configure HID0 for MPC74X5. For additional
BAT register numbers and configuration information, see the CPU-specific
reference manual. The following example routines initialize the MPC7X5:
/*
* mmuPpcBatInitMPC74x5 initializes the standard 4 (0-3) I/D BATs &
* the additional 4 (4-7) I/D BATs present on the MPC74[45]5.
*/
IMPORT void mmuPpcBatInitMPC74x5 (UINT32 *pSysBatDesc);
Finally, the BAT initialization routine must be connected to the MMU initialization
hook, _pSysBatInitFunc, which is NULL by default:
IMPORT FUNCPTR _pSysBatInitFunc;
_pSysBatInitFunc = mmuPpcBatInitMPC7x5;
122
6 PowerPC
6.3 Interface Variations
The application programmer interface for the PowerPC 603/604 memory mapping
unit is the same as that described previously for the MMU translation model (see
MMU Translation Model, p.119).
For PowerPC 604, the page table size depends on the total memory to be mapped.
The larger the memory to be mapped, the bigger the page table. The VxWorks
implementation of the segment model follows the recommendations given in
PowerPC Microprocessor Family: The Programming Environments. The total size of the
memory to be mapped is computed during MMU library initialization, allowing
dynamic determination of the page table size. Table 6-2 shows the correspondence
between the total amount of memory to map and the page table size for PowerPC
604 processors.
Table 6-2
8 MB or less
64 KB
16 MB
128 KB
32 MB
256 KB
64 MB
512 KB
128 MB
1 MB
256 MB
2 MB
512 MB
4 MB
1 GB
8 MB
2 GB
16 MB
4 GB
32 MB
123
VxWorks
Architecture Supplement, 6.2
The translation table size depends on the total memory to be mapped. The larger
the memory to be mapped, the bigger the table.
NOTE: VxWorks allocates page-aligned descriptor arrays from the heap at virtual
For optimal performance, the number of translation lookaside buffer (TLB) entries
for data access should be maximized. To eliminate instruction MMU contention for
TLB entries, leave USER_I_MMU_ENABLE undefined except in cases where the
system will be running RTPs. Because a virtual address is always the same as the
real address in a system that is not running RTPs, enabling the instruction MMU
provides no additional functionality but can result in a performance impact.
NOTE: USER_I_MMU_ENABLE must be defined for systems that require RTP
support.
The PowerPC 440 core provides a 36-bit physical address space and a 32-bit
program (virtual) address space. The mapping is accomplished with translation
lookaside buffers (TLBs), which are managed by software.
The PowerPC 440 is an implementation of the Book E processor specification. The
MMU is always active and all program addresses are translated by the TLBs. The
MSRIS and MSRDS bits are used to extend the virtual address space so that TLB
lookups can happen from two different address spaces for either instruction or
data references. This easily allows for a static map to be used for boot and basic
operation when MSR(IS,DS) = (0,0) (VxWorks regards this as MMU disabled), and
enables dynamic 4 KB page mapping (MMU enabled) when MSRIS = 1 or
MSRDS = 1.
124
6 PowerPC
6.3 Interface Variations
Boot Sequencing
After a processor reset, the board support package sets up a temporary static
memory model. The following steps are included in the BSP romInit.s module:
1.
2.
The processor hardware maps a single 4 KB page of memory at the top of the
32-bit program address space and branches to the reset vector (located in the
last word of the program address space).
3.
4.
The resetEntry( ) routine initializes the TLB entries to map the entire program
address space to physical address space devices and memory, using large size
(256 MB) translation blocks. Unused TLBs are marked as invalid. The MSRIS
and MSRDS fields are set to zero, and execution continues with an rti to the
romInit( ) routine.
Run-Time Support
The VxWorks kernel provides support for the PowerPC 440 memory management
unit (MMU). To include this support, configure INCLUDE_MMU_BASIC.
VxWorks supports two cooperating models for memory mapping. The first, the
static model, allows mapping of memory blocks ranging from 1 KB to 256 MB in size
by dedicating an individual processor TLB entry to each block. The second, the
dynamic model, provides the ability to map physical memory in 4 KB pages using
the remaining available TLB entries in a round-robin fashion.
PowerPC 440 Static Model
125
VxWorks
Architecture Supplement, 6.2
the MMU enabled (that is, MSRIS = 1 or MSRDS = 1), some entry descriptions in
sysStaticTlbDesc[ ] set attribute _MMU_TLB_TS_1.
All of the configuration constants used to fill sysStaticTlbDesc[ ] are defined in
installDir/vxworks-6.2/target/h/arch/ppc/mmu440Lib.h.
PowerPC 440 Dynamic Model
For optimal performance, the number of TLB entries for data access should be
maximized as follows:
1.
2.
support.
126
6 PowerPC
6.3 Interface Variations
The MPC85XX CPU uses 32-bit virtual and physical addressing similar to the
PowerPC 60x processors.
The MPC85XX is an implementation of the Book E processor specification. The
MMU is always active and all addresses are translated by a TLB0 (dynamic,
fixed-4 KB size TLB) or a TLB1 (static, variable-size TLB) entry. This easily allows
for a static map to be used for boot and basic operations when MSR(IS,DS) = (0,0)
(VxWorks regards this as MMU disabled), and enables dynamic 4 KB page
mapping when MSRIS = 1 or MSRDS = 1 (MMU enabled).
Boot Sequencing
After a processor reset, the board support package sets up a temporary static
memory model. The following steps are included in the BSP romInit.s module:
1.
2.
The processor hardware maps a single 4 KB page of memory at the top of the
32-bit program address space and branches to the reset vector (located in the
last word of the program address space).
3.
4.
The resetEntry( ) routine initializes the TLB entries to map the entire program
address space to physical address space devices and memory, using large size
(256 MB) translation blocks. The internally mapped registers are mapped with
a static TLB here also and the base address is changed to 0xFE000000.
Run-Time Support
The VxWorks kernel provides support for the MPC85XX memory management
unit (MMU). To include this support, configure INCLUDE_MMU_BASIC.
VxWorks supports two cooperating models for memory mapping. The first, the
static model, allows mapping of memory blocks ranging from 1 KB to 256 MB in size
by dedicating an individual processor TLB entry to each block. The second, the
dynamic model, provides the ability to map physical memory in 4 KB pages using
the remaining available TLB entries in a round-robin fashion.
MPC85XX Static Model
127
VxWorks
Architecture Supplement, 6.2
the size of the table, but should be kept to a minimum to allow the remaining TLB
entries on the chip to be used for the dynamic model.
The static TLB entry registers are set by the initialization software in the MMU
library.
Entry descriptions in sysStaticTlbDesc[ ] that set the _MMU_TLB_TS_0 attribute
are used when VxWorks has the MMU disabled (that is, MSR(IS,DS) = (0,0)). All
of the configuration constants used to fill sysStaticTlbDesc[ ] are defined in
installDir/vxworks-6.2/target/h/arch/ppc/mmuE500Lib.h.
MPC85XX Dynamic Model
The MPC8XX memory mapping model allows you to map memory in 4 KB pages;
requests for larger page sizes are mapped into an appropriate number of 4 KB
pages. The translation table is organized into two levels. The top level consists of
an array of 1,024 Level 1 (L1) table descriptors; each of these descriptors can point
to an array of 1,024 Level 2 (L2) table descriptors. Three mapping attributes are
defined in the L1 descriptors (copy-back, write-through, and guarded cache
modes), the others (cache off and all access permission attributes) are defined in
the L2 descriptors. This affects granularity. For example, if one 4 KB page is
mapped in copy-back mode, all pages within the corresponding 4 MB block (1,024
x 4 KB pages) are mapped in copy-back mode, except for any pages having cache
128
6 PowerPC
6.3 Interface Variations
off defined. That is, the cache mode setting of a single page can affect the cache
mode setting of all mapped pages in the block.
The application programmer interface for the MPC8XX memory mapping unit is
described previously for the MMU translation model (see MMU Translation Model,
p.119). MPC8XX processors that implement hardware memory coherency
typically do not support the use of the MMU_ATTR_CACHE_COHERENCY (or
VM_STATE_MEM_COHERENCY) attribute; the state MMU_ATTR_CACHE_OFF (or
VM_STATE_CACHEABLE_NOT) identifies a page as memory-coherent.
RTP Limitation
PowerPC Coprocessors
Coprocessor Number
Name
Floating-Point
VX_FP_TASK
AltiVec
VX_ALTIVEC_TASK
SPE
VX_SPE_TASK
6.3.6 vxLib
vxTas( )
129
VxWorks
Architecture Supplement, 6.2
Known problems with C++ mixed linking of AltiVec and non-AltiVec modules
The following features are supported for the AltiVec unit by the VxWorks kernel.
Tasks that use the AltiVec unit must be spawned with the VX_ALTIVEC_TASK
option flag set.
130
6 PowerPC
6.3 Interface Variations
The MPC74XX processors AltiVec registers are saved and restored as part of
the task context. The VxWorks kernel saves and restores all 32 AltiVec registers
when switching between AltiVec contexts. The value of the VRSAVE register
is preserved, but not used, by the context switch code.
The AltiVec-specific routines shown in Table 6-4 have been added to VxWorks.
Table 6-4
AltiVec-Specific Routines
Routine
Command Syntax
Description
altivecInit( )
altivecTaskRegsShow( ) [task]
altivecTaskRegsSet( )
[task, ALTIVECREG_SET *]
altivecTaskRegsGet( )
[task, ALTIVECREG_SET *]
altivecProbe( )
altivecSave( )
[ALTIVEC_CONTEXT *]
altivecRestore( )
[ALTIVEC_CONTEXT *]
131
VxWorks
Architecture Supplement, 6.2
Table 6-4
Routine
Command Syntax
Description
vec_malloc( )
size_t
vec_calloc( )
vec_realloc( )
vec_free( )
void *p
NOTE: Memory allocation in VxWorks for PowerPC 604 is always 16-byte aligned;
vec_malloc( ), vec_calloc( ), and vec_realloc( ) are aliases for alloc( ).
Layout of the AltiVec EABI Stack Frame
The stack frame for routines using the AltiVec registers adds the following areas to
the standard EABI frame:
alignment padding (always zero bytes because the frame is always 16-byte
aligned)
The stack frame layout for routines using the AltiVec registers is shown in
Figure 6-1. Non-AltiVec stack frames are unchanged from prior VxWorks releases.
132
6 PowerPC
6.3 Interface Variations
Figure 6-1
direction
of stack
expansion
LR save word
8+P
8+P+A
8+P+A+V
8+P+A+V+L
8+P+A+V+L+X
8+P+A+V+L+X+Z
8+P+A+V+L+X+Z+Y
Saved CR (C)
8+P+A+V+L+X+Z+Y+W
8+P+A+V+L+X+Z+Y+W+C
8+P+A+V+L+X+Z+Y+W+C+G
8 or 0 bytes padding
Old SP
High Address
133
VxWorks
Architecture Supplement, 6.2
The AltiVec specification adds a new family of vector data types to the C language.
vector types are 128 bits long, and are used to manipulate values in AltiVec
registers. Under control of a compiler option, vector is now a keyword in the C and
C++ languages. The AltiVec programming model introduces five new keywords as
simple type-specifiers: vector, __vector, pixel, __pixel, and bool.
!
CAUTION: vector is used as both a C++ class name and a C variable name in the
VxWorks header files and some BSP source files, and conflicts with the vector
keyword. Where possible, use __vector rather than vector in VxWorks code as a
precaution.
Formatted Input and Output of Vector Types
%vc
%vd
%vhd
%vf
vector float
%vu
%vs
For a comprehensive discussion on the new format specifications, see the AltiVec
Technology Programming Interface Manual. The following example program
illustrates the input and output of sample vector values as well as several
formatting variations.
134
6 PowerPC
6.3 Interface Variations
void testFormattedIO()
{
__vector unsigned char s;
__vector signed int I;
__vector signed short SI;
__vector __pixel P;
__vector float F;
s = (__vector unsigned char)
(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F);
I
SI
P
F
=
=
=
=
(__vector
(__vector
(__vector
(__vector
FLOAT
FLOAT
FLOAT
FLOAT
FLOAT
FLOAT
*e5.6*:
*E5.6*:
*g5.6*:
*G5.6*:
*f.7* :
*e*
:
(%,5.6ve)\n", F);
(%:5.6vE)\n", F);
(%;5.6vg)\n", F);
(%5.6vG)\n", F);
(%_.7vf)\n", F);
(%ve)\n", F);
0)
FLOAT
FLOAT
FLOAT
FLOAT
+50:
*e5.6*:
*E5.6*:
*g5.6*:
*G5.6*:
+51:
+52:
+53:
+54:
+55:
+56:
+57)
(-3.141593e+00,3.141593e+00,9.800000e+00,0.000000e+00)
(-3.141593E+00:3.141593E+00:9.800000E+00:0.000000E+00)
(-3.14159;3.14159; 9.8;
0)
(-3.14159 3.14159
9.8
0)
135
VxWorks
Architecture Supplement, 6.2
Compiling Modules with the Wind River Compiler to Use the AltiVec Unit
Modules that use the AltiVec registers and instructions must be compiled with the
Wind River Compiler option: -tPPC7400FV:vxworks62 (or
-tPPC970FV:vxworks62 for PowerPC 970). Use of this flag always enables the
AltiVec keywords __vector, __pixel, and __bool.
The Wind River Compiler also enables the AltiVec keywords vector, pixel, bool
(and vec_step) by default if the -tPPC7400FV (or -tPPC970FV for PowerPC 970)
option is used. However, each keyword can be individually enabled or disabled
with the Wind River Compiler (dcc) option -Xkeywords=mask, where mask is a
logical OR of the values in Table 6-6.
Table 6-6
Mask
Keyword Enabled
0x01
extended
0x02
pascal
0x04
inline
0x08
packed
0x10
interrupt
0x20
vector
0x40
pixel
0x80
bool
0x100
vec_step
136
6 PowerPC
6.3 Interface Variations
For example, the following command-line sequence enables bool and vec_step,
but disables vector and pixel (and also all of the non-AltiVec keywords in
Table 6-6). For more information, see your release notes.
% dcc -tPPC7400FV:vxworks62 -Xkeywords=0x180-DCPU=PPC604
-DTOOL_FAMILY=diab -DTOOL=diab -c fioTest.c
CAUTION: vector is used as both a C++ class name and a C variable in the VxWorks
header and source files, and conflicts with the vector keyword.
6
The version of the Wind River Compiler included with this VxWorks release is
fully compliant with the Motorola AltiVec EABI document.
Compiling Modules with GNU to Use the AltiVec Unit
Modules that use the AltiVec registers and instructions must be compiled with the
-Wa and -maltivec flags (or -mcpu=power4 -Wa and -mppc64bridge for
PowerPC 970). These flags enable the following five keywords as a new family of
types: bool, vector, __vector, pixel, and __pixel.
!
CAUTION: vector is used as both a C++ class name and a C variable in the VxWorks
header and source files, and conflicts with the vector keyword enabled by the
-maltivec option.
The version of the GNU compiler included with this VxWorks release is fully
compliant with the Motorola AltiVec EABI specification.
!
and scanf( ) family of routines. Applications calling these routines with more than
eight integer-class or more than eight floating-point arguments may behave
unpredictably.
Extensions to the WTX Protocol for AltiVec Support
The presence and state of the AltiVec unit must also be communicated to the
Workbench host tools, such as the debugger. The following WTX API routines are
available for AltiVec support.
137
VxWorks
Architecture Supplement, 6.2
Table 6-7
Routine
Command
Syntax
wtxTargetHasAltivecGet( ) hWtx
Description
138
6 PowerPC
6.3 Interface Variations
foo ();
// continue using the non-volatile vector registers
asm ( "addi 9, 31, 32" );
// local <- v24
asm ( "stvx 24, 0, 9" );
printf ("Finally, local = (%vld)\n", local);
}
To produce a partially linked object file2.o, compile the two files with the
following commands:
% ccppc -mcpu=604 -c file1.cpp
% ccppc -mcpu=604 -nostdlib -maltivec -r file1.o file2.cpp
Routine foo in file1.cpp is non-AltiVec code. Therefore, the try...catch block in foo
does not save and restore the AltiVec context. Within the try...catch block, the call
to bar alters the value of vector register v24. Because file1.cpp does not save
AltiVec context, the value 0 in v24 assigned by bar remains unchanged when the
program flow returns to Start. The original value 15, assigned before the call to bar,
is now corrupted. Hence, the incorrect output, local = (0,0,0,0).
139
VxWorks
Architecture Supplement, 6.2
Because both modules now have AltiVec code (compiled with the -maltivec
option), the try...catch block in foo now saves and restores the AltiVec context. The
value 15 originally assigned in Start is faithfully restored by foo when it returns.
The following features are supported for the SPE unit by the VxWorks kernel.
Run-time detection of the SPE unit is possible using the speProbe( ) routine.
This routine is used internally by VxWorks to prevent attempts to enable SPE
for a CPU that lacks such a unit.
Tasks that use the SPE unit must be spawned with the VX_SPE_TASK option
flag set.
Tasks created without the VX_SPE_TASK option that use SPE instructions incur
an SPE Unavailable Exception error, and the task is suspended.
140
6 PowerPC
6.3 Interface Variations
The MPC85XX processors upper 32 bits in the general purpose registers are
saved and restored as part of the task context. The VxWorks kernel saves and
restores all 32 SPE register extensions when switching between SPE contexts.
The SPEFSCR and the accumulator are also saved in the context switch.
Table 6-8
The speSave( ) and speRestore( ) routines save and restore the upper 32 bits of
the general purpose register contents from memory. These routines can be
called from interrupt handlers. Before calling these routines, you must ensure
that memory is allocated to store the values, and that the memory is aligned
on a 32-bit boundary.
SPE-Specific Routines
Routine
Command Syntax
Description
speInit( )
speTaskRegsShow( )
[task]
speTaskRegsSet( )
[task, SPEREG_SET *]
aspeTaskRegsGet( )
[task, SPEREG_SET *]
speProbe( )
speSave( )
[SPE_CONTEXT *]
speRestore( )
[SPE_CONTEXT *]
The stack frame for routines using the whole of the 64-bit general purpose registers
adds the following areas to the standard EABI frame:
141
VxWorks
Architecture Supplement, 6.2
alignment padding (always zero bytes because the frame is always 8-byte
aligned)
The stack frame layout for routines using the upper 32 bits of the general purpose
registers is shown in Figure 6-2. Non-SPE stack frames are unchanged from prior
VxWorks releases.
Figure 6-2
direction
of stack
expansion
Old SP
LR save word
8+P
8+P+A
8+P+A+V
8+P+A+V+L
8+P+A+V+L+Z
Saved CR (C)
8+P+A+V+L+Z+Y
8+P+A+V+L+Z+Y+C
High Address
The required alignment for the SPE EABI specification is 16 bytes. Therefore, it is
compatible to call routines compiled for SPE from certain other PowerPC
EABI-compliant code that assumes an 8-byte alignment for the stack boundary.
However, the converse does not hold true and undefined results can occur.
C Language Extension for Vector Types
The SPE specification adds a new family of vector data types to the C language.
These data types are 64-bit entities which have other data types embedded in them.
The new entities are: __ev64_u16__, __ev64_s16__, __ev64_u32__, __ev64_s32__,
__ev64_u64__, __ev64_s64__, and __ev64_fs__. The type __ev604_opaque__
represents any of the above types.
142
6 PowerPC
6.3 Interface Variations
The SPE Programming Interface Manual also specifies vector conversions for
formatted I/O. VxWorks supports the new formatted input and output of vector
data types using the printf( ) and scanf( ) class routines shown in Table 6-9.
Table 6-9
Format String
%hr
%r
%lr
%hR
%R
%lR
For a comprehensive discussion on the new format specifications, see the SPE
Programming Interface Manual.
Compiling Modules with the Wind River Compiler to Use the SPE Unit
Modules that use the SPE registers and instructions must be compiled with the
Wind River Compiler option: -tPPCE500FS:vxworks62.
% dcc -tPPCE500FS:vxworks62 -DCPU=PPC85XX -DTOOL_FAMILY=diab -DTOOL=diab
-c fioTest.c
The version of the Wind River Compiler included with this VxWorks release is
fully compliant with the Motorola SPE EABI document.
Compiling Modules with the GNU Compiler to Use the SPE Unit
Modules that use the SPE registers and instructions must be compiled with the
GNU compiler option: -mcpu=8540.
% ccppc -mcpu=8540 -fno-builtin -Wall -DCPU=PPC85XX -DTOOL_FAMILY=gnu
-DTOOL=gnu -c fioTest.c
The version of the GNU compiler included with this VxWorks release is fully
compliant with the Motorola SPE EABI specification.
143
VxWorks
Architecture Supplement, 6.2
The presence and state of the SPE unit must also be communicated to the
Workbench host tools, such as the debugger. The following WTX API routines are
available for SPE support.
Table 6-10
Routine
Command
Syntax
Description
wtxTargetHasSpeGet( )
hWtx
divide-by-zero handling
SPE exceptions under likely overflow/underflow conditions
SPE unavailable exception in relation to task options
26-bit addressing and extended-call exception vector support
byte order
hardware breakpoint access types
PowerPC register usage
cache information
AIM model for caches
AIM model for MMU
floating-point support
VxMP support for MPC boards
exceptions and interrupts
memory layout
power management
build mechanism
real-time processes (RTPs)
144
6 PowerPC
6.4 Architecture Considerations
145
VxWorks
Architecture Supplement, 6.2
Because both kinds of floating-point instructions require the use of the SPE
coprocessor, the MSRSPE bit is enabled when either options is specified for the task.
The following are some of the behaviors that result from this semantic:
Tasks spawned with VX_FP_TASK but without VX_SPE_TASK do not save and
restore the upper 32 bits of GPRs upon context switch.
Tasks that use both scalar and vector floating-point instructions can only be
spawned with VX_SPE_TASK. However, as a good programming practice, you
should regard scalar floating-point as associated with VX_FP_TASK.
Branches across larger address ranges must be made to an absolute 32-bit address
with the help of the LR or CTR register. Each absolute 32-bit jump is accomplished
with a sequence of at least three instructions (more, if the register state must be
preserved). This is rarely needed and is expensive in terms of execution speed and
code size. Such large branches are typically seen only in very large downloaded
modules and very large (greater than 32 MB) system images.
One way of getting around this restriction for downloadable applications is to use
the -mlongcall compiler option in the GNU compiler. However, this option may
introduce an unacceptable amount of performance penalty and extra code size for
some applications. It is for this reason that the VxWorks kernel is not compiled
using -mlongcall.
146
6 PowerPC
6.4 Architecture Considerations
Another way to get around this limitation is to increase the size of the WDB
memory pool for host tools. By default, the WDB pool size is set to one-sixteenth
of the amount of free memory. Memory allocations for host-based tools (such as the
shell) are done out of the WDB pool first, and then out of the general system
memory pool. Requests larger than the available amount of WDB pool memory are
done directly out of the system memory pool. If an application is anticipated to be
located outside of the WDB poolthus potentially crossing the 32 MB threshold
the size of the WDB memory pool can be increased to ensure the application fits
into the required space.
To change the size of the WDB memory pool, redefine the macro WDB_POOL_SIZE
in your BSP config.h file. This macro is defined in
installDir/vxworks-6.2/target/config/all/configAll.h as follows:
#define WDB_POOL_SIZE
((sysMemTop() - FREE_RAM_ADRS)/16)
Redefining WDB_POOL_SIZE in your BSP local config.h file alters the macro for
that BSP only.
Branching Across Large Address Ranges Using the Wind River Compiler
The Wind River Compiler handles far branching in a different way than the GNU
compiler. The linker automatically inserts branch islands in the code for far
addresses known at link time. Thus, this slower branch approach is used only
when necessary.
Extended-Call Exception Vector Support
147
VxWorks
Architecture Supplement, 6.2
load a 32-bit address into the LR, and make a call to it. Therefore, using
extended-call exception vectors incurs an additional eleven instruction overhead
in increased interrupt latency. It is therefore not advisable to use this feature unless
absolutely necessary.
This release still maintains the earlier style 26-bit call vectors as the default. Using
a single bl/bla instruction is much more efficient than the multiple-instruction
sequence described previously. It is expected that most targets will continue to use
the original relative branch (default) style exception handling.
A new global boolean, excExtendedVectors, has been added, that allows users to
enable extended-call exception vectors. By default, excExtendedVectors is set to
FALSE. When set to TRUE, extended-call vectors are enabled. excExtendedVectors
must be set to TRUE before the exception vectors are initialized in the VxWorks boot
sequence (that is, before the call to excVecInit( )). Setting excExtendedVectors after
excVecInit( ) does not achieve the desired result, and results in unpredictable
system behavior. Selection of extended-call exception vectors is done on a per-BSP
basis in order to minimize the impact on those BSPs that do not require this feature.
Enabling Extended-Call Exception Vectors for Command-Line BSP Builds
148
6 PowerPC
6.4 Architecture Considerations
PowerPC 405 targets have two data breakpoints and two instruction breakpoints.
149
VxWorks
Architecture Supplement, 6.2
Address data parameters are 1-byte aligned if width access is 1 byte, 2-bytes
aligned if width access is 2 bytes, 4-bytes aligned if width access is 4 bytes, and
cache-line-size aligned if access is a data cache line (32 bytes on PowerPC 405).
Instruction accesses are always 4-byte aligned.
PowerPC 405 processors allow the following access types for hardware
breakpoints. The byte width means break on all accesses between (addr) and
(addr + x):
Table 6-11
Access Type
Breakpoint Type
Instruction.
0xa
0xb
0xc
PowerPC 603
The PowerPC 603 processor has a single instruction breakpoint, and no data
breakpoints. The PowerPC 603 allows the following access types for hardware
breakpoints:
150
6 PowerPC
6.4 Architecture Considerations
Table 6-12
Access Type
Breakpoint Type
Instruction.
NOTE: PowerPC 603 _83xx and _g2le variants include two instruction and two
PowerPC 604 (including MPC7XX and MPC74XX), PowerPC 440, MPC8XX, and MPC85XX
The PowerPC 604, MPC75X, and MPC74XX CPUs have one data and one
instruction breakpoint. Data and instruction access must be 4-byte aligned
The MPC8XX and PowerPC 440 have 4 instruction and 2 data breakpoints. Data
access is 1-byte aligned on MPC8XX and PowerPC 440 CPUs.
The MPC85XX has 2 instruction and 2 data breakpoints. Data access is 1-byte
aligned.
All of these processors allow the following access types for hardware breakpoints:
Table 6-13
Access Type
Breakpoint Type
Instruction.
Data read/write.
Data read.
Data write.
PowerPC 970
VxWorks for PowerPC does not include support for hardware breakpoints on
PowerPC 970 processors.
151
VxWorks
Architecture Supplement, 6.2
PowerPC Registers
Register Name
Usage
gpr0
gpr1
gpr2
gpr3
gpr4-gpr10
gpr11-gpr12
gpr13
gpr14-gpr30
gpr31
sprg4-sprg7
usprg0
fpr0
fpr1
fpr2-fpr8
fpr9-fpr13
fpr14-fpr31
152
6 PowerPC
6.4 Architecture Considerations
6.4.8 Caches
The following subsections augment the information in the VxWorks Kernel
Programmers Guide.
Most PowerPC processors contain an instruction cache and a data cache. In the
default configuration, VxWorks enables both caches, if present. To disable the
instruction cache, highlight the USER_I_CACHE_ENABLE macro in the Params tab
under INCLUDE_CACHE_ENABLE and remove the TRUE; to disable the data cache,
highlight the USER_D_CACHE_ENABLE macro and remove the TRUE.
For most boards, the cache capabilities must be used with the MMU to resolve
cache coherency problems. The page descriptor for each page selects the cache
mode. This page descriptor is configured by filling the data structure
sysPhysMemDesc[ ] defined in sysLib.c. (For more information about cache
coherency, see the reference entry for cacheLib. For information about the MMU
and VxWorks virtual memory, see the VxWorks Kernel Programmers Guide: Memory
Management. For MMU information specific to the PowerPC family, see
6.3.4 Memory Management Unit (MMU), p.118.)
The state of both data and instruction caches is controlled by the WIMG1
information saved either in the BAT (block address translation) registers or in the
segment descriptors. Because a default cache state cannot be supplied, each cache
can be enabled separately after the corresponding MMU is turned on. For more
information on these cache control bits, see PowerPC Microprocessor Family: The
Programming Environments, published jointly by Motorola and IBM.
On PowerPC processors, cache flush at a specific address is usually performed by
the dcbst instruction. Flushing of the entire cache usually involves loading from
main memory over an address range. The starting address of the address range to
load from is determined by the value stored in the variable cachePpcReadOrigin.
The default value of cachePpcReadOrigin is 0x10000; this value can be changed in
the BSP.
During initialization of the MMU library (before cache is enabled for the first time),
cachePpcReadOrigin is set to a suitably aligned address within the first cacheable
entry of sysPhysMemDesc[ ] that is of a sufficient size to accommodate the flush
mechanism requirements. The required size is processor-dependent: 4 MB for
PPC970, one and a half times the size of the cache for other processors. If the MMU
1. W: the WRITETHROUGH or COPYBACK attribute.
I: the cache-inhibited attribute.
M: the memory coherency required attribute.
G: the guarded memory attribute.
153
VxWorks
Architecture Supplement, 6.2
is not configured, or if such a block of memory cannot be found, the default value
of cachePpcReadOrigin is used. If your BSP overrides the default value of
cachePpcReadOrigin, the overridden value is used in place of the default value.
cachePpcReadOrigin needs to point to cacheable memory in order for the load to
properly displace modified entries in the cache that is flushed. A cacheable block
of at least one an a half times the size of the cache is required due to the nature of
the pseudo LRU (Least Recently Used) algorithm used by several processors. If this
scheme does not work for a your target system for any reason, you must override
cachePpcReadOrigin in sysHwInit( ) in the BSP.
PowerPC 405
PowerPC 405 targets, when not using the MMU, control the W, I, and G attributes
using special purpose registers (SPRs). (Because it does not provide any hardware
support for memory coherency, this processor always considers the M attribute to
be off.)
See the processor users manual for detailed descriptions of the data cache
cacheability register (DCCR), data cache write-through register (DCWR),
instruction cache cacheability register (ICCR), and storage guarded register (SGR).
PowerPC 440
The Book E specification and the PowerPC 440 core implementation do not
provide a means to set a global cache enable/disable state, nor do they permit
independently enabling or disabling the instruction and data caches.
In the default configuration, VxWorks enables both caches. If you disable one
cache, you must disable the other. To disable both caches, highlight the
USER_I_CACHE_ENABLE and USER_D_CACHE_ENABLE macros in the Params tab
under INCLUDE_CACHE_ENABLE and remove the TRUE.
The state of both data and instruction caches is controlled by the WIMG
information saved either in the static TLB entry registers or in the dynamic
memory mapping descriptors. Because a default cache state cannot be supplied,
both caches are enabled after the corresponding MMU is turned on.
If an application requires a different cache mode for instruction versus data access
on the same region of memory, #undef USER_I_MMU_ENABLE, #define
USER_D_MMU_ENABLE, use sysStaticTlbDesc[ ] to set up the instruction access
mode, and sysPhysMemDesc[ ] to set up the data access mode.
The VxWorks cache library interface has changed for the following two calls:
STATUS cacheEnable(CACHE_TYPE cache);
STATUS cacheDisable(CACHE_TYPE cache);
154
6 PowerPC
6.4 Architecture Considerations
The cache argument is ignored and the instruction and data caches are both enabled
or disabled together. If called before the MMU library is initialized, cacheEnable( )
returns OK and signals the MMU library to activate the cache after it has completed
initialization. If the MMU library is active (that is, MSRDS = 1), cacheEnable( )
returns ERROR.
PowerPC 603 and 604
On PowerPC 603 and 604 processors, cache is disabled when the MMU is disabled.
For more information on the PowerPC 6xx MMU implementation, see PowerPC
60x Memory Mapping, p.120.
PowerPC 970
Because of the cache and MMU properties of PowerPC 970 targets, any memory
region that can potentially contain segment register tables (that is, any space which
may be part of the kernel heap when a task is created) must not be configured as
cache-inhibited in sysPhysMemDesc[ ].
In addition, PowerPC 970 targets ignore the W and M attribute settings. The M
attribute is considered to always be set and the W attribute is set based on the cache
level. For more information, see the PowerPC 970 reference documentation.
PowerPC 440
PowerPC 603 (for the MPC82XX family)
PowerPC 604 (including the MPC74XX family)
MPC8XX
MPC85XX
PowerPC 970
These CPU families now implement the cacheClear( ) VxWorks API routines. Prior
to VxWorks 6.0, PowerPC processors did not populate the cacheClear( ) routine
155
VxWorks
Architecture Supplement, 6.2
and cacheClear( ) was equivalent to a no-op. The PowerPC 405 family continues to
operate this way.
The vmPageLock( ) routine requires the use of static TLB entries. This routine also
requires alignment of the lock regions to ensure minimal resource usage in general.
The vmPageOptimize( ) routine requires variable page size support in the
dynamic TLB entries. Both routines provide a mechanism for reducing TLB misses
and should boost system performance when used correctly.
The configuration components for AIM for MMU are as follows:
#define INCLUDE_AIM_MMU_CONFIG
#ifdef INCLUDE_AIM_MMU_CONFIG
#define INCLUDE_AIM_MMU_MEM_POOL_CONFIG /* Configure the memory pool
allocation for page tables */
#define INCLUDE_AIM_MMU_PT_PROTECTION
/* Page Table protection */
#endif
#ifdef INCLUDE_AIM_MMU_MEM_POOL_CONFIG
#define AIM_MMU_INIT_PT_NUM 0x40
#define AIM_MMU_INIT_PT_INCR 0x20
#endif
156
6 PowerPC
6.4 Architecture Considerations
#define INCLUDE_MMU_OPTIMIZE
#ifdef INCLUDE_MMU_OPTIMIZE
#define INCLUDE_LOCK_TEXT_SECTION
#define INCLUDE_PAGE_SIZE_OPTIMIZATION
#endif
Page locking of the text section will fail if the alignment of text and the number of
resources available are not sufficient. For PowerPC 405 and PowerPC 440
processors, the resource is pulled from the general TLB pool which has 64 entries.
The allowance set aside by the architecture for locking is 5 static pages (this may
change). For MPC85XX processors, the resource is pulled from the TLB1 entries
(also known as CAM entries). There are 16 TLB1 entries available. If the BSP uses
too many entries, it may not be possible to enable this feature.
The PowerPC 405, 440 (soft-float), and MPC860 processors do not support
hardware floating-point instructions. However, VxWorks provides a
floating-point library that emulates these mathematical routines. All ANSI
floating-point routines have been optimized using libraries from U. S. Software.
acos( )
ciel( )
fabs( )
log10( )
sqrt( )
asin( )
cos( )
floor( )
pow( )
tan( )
atan( )
cosh( )
fmod( )
sin( )
tanh( )
atan2( )
exp( )
log( )
sinh( )
asinf( )
cosf( )
fmodf( )
sinf( )
tanhf( )
atanf( )
expf( )
logf( )
sinhf( )
atan2f( )
fabsf( )
log10f( )
sqrtf( )
The following floating-point routines are not available on PowerPC 405, 440
(soft-float), and MPC860 processors:
157
VxWorks
Architecture Supplement, 6.2
cbrt( )
log2( )
cbrtf( )
log2f( )
infinity( )
round( )
infinityf( )
roundf( )
irint( )
sincos( )
irintf( )
sincosf( )
iround( )
trunc( )
iroundf( )
truncf( )
MPC85XX
no floating point
both float and double data types are allowed, but actual operands
and results are single-precision only using hardware floating-point
instructions
both float and double data types are allowed, single-precision uses
hardware floating-point, double-precision uses software integer
instructions
asin( )
cos( )
floor( )
pow( )
tan( )
atan( )
cosh( )
fmod( )
sin( )
tanh( )
atan2( )
exp( )
log( )
sinh( )
158
asinf( )
cosf( )
fmodf( )
sinf( )
tanhf( )
atanf( )
expf( )
logf( )
sinhf( )
atan2f( )
fabsf( )
log10f( )
sqrtf( )
6 PowerPC
6.4 Architecture Considerations
infinity( )
round( )
infinityf( )
roundf( )
irint( )
sincos( )
irintf( )
sincosf( )
iround( )
trunc( )
iroundf( )
truncf( )
The following floating-point routines are available for PowerPC 440 (hard-float),
60x, and 970 processors:
acos( )
ciel( )
fabs( )
log10( )
sqrt( )
asin( )
cos( )
floor( )
pow( )
tan( )
atan( )
cosh( )
fmod( )
sin( )
tanh( )
atan2( )
exp( )
log( )
sinh( )
The following subset of the ANSI routines is optimized using libraries from
Motorola:
acos( )
cos( )
pow( )
asin( )
exp( )
sin( )
atan( )
log( )
sqrt( )
atan2( )
log10( )
infinity( )
round( )
irint( )
sincos( )
iround( )
trunc( )
The MSR FE0 and FE1 bits select the floating-point exception mode.
The FPSCR VE, OE, UE, ZE, XE, NI, and RN bits enable or disable the
corresponding floating-point exceptions and rounding mode. (See archPpc.h
for the macro PPC_FPSCR_VE and so forth.)
You can access register values using the routines vxMsrGet( ), vxMsrSet( ),
vxFpscrGet( ), and vxFpscrSet( ).
159
VxWorks
Architecture Supplement, 6.2
The VxMP product for Motorola PowerPC boards has special software routines
that compensate for the lack of atomic TAS operations in the PowerPC and the lack
of atomic instruction propagation to and from these boards. This software consists
of the routines sysBusTas( ) and sysBusTasClear( ).
The software implementation uses ownership of the VMEbus as a semaphore; in
other words, no TAS operation can be performed by a task until that task owns the
VME bus. When the TAS operation completes, the VME bus is released. This
method is similar to the special read-modify-write cycle on the VME bus in which
the bus is owned implicitly by the task issuing a TAS instruction. (This is the
hardware implementation employed, for example, with a 68K processor.)
However, the software implementation comes at a price. Execution is slower
because, unlike true atomic instructions, sysBusTas( ) and sysBusTasClear( )
require many clock cycles to complete.
Configuring VMEbus TAS
160
6 PowerPC
6.4 Architecture Considerations
Systems using multiple VME boards where at least one board is a Motorola
PowerPC board must have a Motorola PowerPC board set with a processor ID
equal to 0 (the board whose memory is allocated and shared). This is because a TAS
operation on local memory by, for example, a 68K processor does not involve VME
bus ownership and is, therefore, not atomic as seen from a Motorola PowerPC
board.
This restriction does not apply to systems that have globally shared memory
boards that are used for shared memory operations. In this case, specifying
SM_OFF_BOARD as TRUE on the Params tab of the properties window for the
processor with ID of 0 and setting the associated parameters enables you to assign
processor IDs in any configuration.
PowerPC 405, 440, and MPC85XX processors support two classes of exceptions
and interrupts: normal and critical. The PowerPC 440GX and 440EP processors, also
referred to as revision x5 of the PowerPC 440, have an additional class called
machine check interrupt. This release correctly attaches default handlers to the
corresponding vectors. excVecSet( ), which internally recognizes whether the
vector being modified is normal or critical, can be used with either class of vector
and is the preferred method for connecting alternative handlers.
The routines excCrtConnect( ) and excIntCrtConnect( ) are available in addition to
the basic routines excConnect( ) and excIntConnect( ):
STATUS excCrtConnect (VOIDFUNCPTR *vectr, VOIDFUNCPTR routine);
STATUS excIntCrtConnect (VOIDFUNCPTR *vectr, VOIDFUNCPTR routine);
161
VxWorks
Architecture Supplement, 6.2
INCLUDE_440X5_DCACHE_RECOVERY
This macro makes data cache parity errors recoverable. Selecting this option
also selects INCLUDE_440X5_PARITY_RECOVERY, and sets
USER_D_CACHE_MODE to CACHE_WRITETHROUGH.
INCLUDE_440X5_TLB_RECOVERY
This macro makes TLB parity errors recoverable. Selecting this option also
selects INCLUDE_440X5_PARITY_RECOVERY and INCLUDE_MMU_BASIC.
The INCLUDE_MMU_BASIC component is required because TLB recovery
requires setup performed by MMU library initialization. However, you can to
undefine (#undef) both USER_D_MMU_ENABLE and USER_I_MMU_ENABLE
if you do not want the functionality provided by the MMU library.
INCLUDE_440X5_PARITY_RECOVERY
This macro sets the PRE bit in CCR0. This macro is required by the 440x5
hardware if either data cache or TLB recovery is enabled. Selecting this option
also selects INCLUDE_EXC_HANDLING.
INCLUDE_440X5_TLB_RECOVERY_MAX
This macro dedicates a TLB entry to the machine check handler, and a separate
TLB entry to the remaining interrupt/exception vectors, in order to maximize
the ability to recover from TLB parity errors. Selecting this option also selects
INCLUDE_440X5_TLB_RECOVERY.
INCLUDE_440X5_MCH_LOGGER
This macro causes the machine check handler to log recovered events which
are otherwise handled transparently by the OS and the application.
MPC85XX
162
6 PowerPC
6.4 Architecture Considerations
IVOR
Interrupt Type
Offset
IVOR0
Critical input
0x100
IVOR1
Machine checka
0x200
IVOR2
Data storage
0x300
IVOR3
Instruction storage
0x400
IVOR4
External input
0x500
IVOR5
Alignment
0x600
IVOR6
Program
0x700
IVOR7
0x800
IVOR8
System call
0x900
IVOR9
0xa00
IVOR10
Decrementer
0xb00
IVOR11
0xc00
IVOR12
0xd00
IVOR13
0xe00
IVOR14
0xf00
IVOR15
Debug
0x1000
IVOR32
0x1100
IVOR33
0x1200
IVOR34
0x1300
IVOR35
Performance monitor
0x1400
163
VxWorks
Architecture Supplement, 6.2
a. If cache parity recovery is enabled in the BSP config.h file, IVOR1 will be
modified to address 0x1500, where the parity recovery code resides. Exception
processing will fall back to address 0x200 after examining the MCSR if the
machine check is not caused by parity error.
excVecGet( ) and excVecSet( )
Relocated Vectors
On some PowerPC processors, certain exception vectors are located very close to
each other. In order to fit the prologue instructions that prepare the values needed
for excEnt( ) and intEnt( ), it becomes necessary to move these vectors to a different
address. Thus, such vectors are relocated. Table 6-16 lists the relocated vectors. All
standard VxWorks API routines correctly use the relocated addresses when the
original address is supplied. Examples of these routines include excVecSet( ),
excVecGet( ), and excIntConnectTimer( ).
Table 6-16
Name
Interrupt Type
PIT
FIT
164
Affected
Processors
PowerPC 405,
PowerPC 405F
From
To
0x1000
0x1080
0x1010
0x1300
6 PowerPC
6.4 Architecture Considerations
Table 6-16
Name
Interrupt Type
Affected
Processors
PowerPC 604
(PowerPC 604,
MPC7XX,
MPC74XX, and
PowerPC 970)
From
To
0xf00
0xf80
Note that the relocated vectors and addresses are not user changeable. If you
relocate other vectors, or change a relocated vectors address, VxWorks does not
convert to the new address properly.
Anchor for the shared memory network and VxMP shared memory objects (if
there is shared memory on the board).
Boot Line
The VxWorks system image itself (three sections: text, data, and bss). The entry
point for VxWorks is at the start of this region, which is BSP dependent (see the
BSP-specific documentation).
Host Memory Pool
165
VxWorks
Architecture Supplement, 6.2
Interrupt Stack
Size depends on the size of the system image. The sysMemTop( ) routine
returns the address of the end of the free memory pool.
Error Detection and Reporting Preserved Memory
Size is defined in PM_RESERVED_MEM. This memory is used when
INCLUDE_EDR_PM is defined.
All addresses shown in Figure 6-3 are relative to the start of memory for a
particular target board. The start of memory (corresponding to 0x0 in the
memory-layout diagram) is defined as LOCAL_MEM_LOCAL_ADRS under
INCLUDE_MEMORY_CONFIG for each target.
NOTE: The PowerPC architecture supports the placement of the exception vector
table (EVT) in high memory (0xfff00000) by setting the IP bit in the MSR;
PowerPC 4xx supports arbitrary placement of the EVT through the EVPR/IVPR
(exception vector prefix register/interrupt vector prefix register). However,
VxWorks does not support this placement.
166
6 PowerPC
6.4 Architecture Considerations
Figure 6-3
LOCAL_MEM_LOCAL_ADRS
SM Anchor
Boot Line
Exception Message
+0x3000
+0x4100
+0x4200
+0x4300
+0x4c00
Initial Stack
System Image
text
KEY
data
= Available
= Reserved
bss
_end
Interrupt Stack
sysMemTop( )
ED&R Reserved Memory
167
VxWorks
Architecture Supplement, 6.2
sfdiab
gnu
sfgnu
168
6 PowerPC
6.5 Reference Material
CPU
TOOL
diab
gnu
sfdiab
sfgnu
169
VxWorks
Architecture Supplement, 6.2
Wind River recommends that you consult the hardware documentation for your
processor or processor family as necessary during BSP development.
PowerPC Architecture References
The references provided in this section are current at the time of writing; should
you decide to use these documents, you may wish to contact the manufacturer for
the most current version.
170
7
Renesas SuperH
7.1 Introduction
This chapter provides information specific to VxWorks development on Renesas
SuperH targets.
171
VxWorks
Architecture Supplement, 6.2
For complete documentation, see the reference entries for the libraries,
subroutines, and tools discussed in the following sections.
7.3.1 dbgArchLib
Register Routines
registers. Therefore, these registers are not included in the task context. The gbr( )
and vbr( ) routines return the register value only when the task is suspended or
stopped by an exception handler. Otherwise, the routines return the initial value of
0.
172
7 Renesas SuperH
7.3 Interface Variations
The tt( ) routine does not display the parameters of the subroutine call. For a
complete stack trace, use Wind River Workbench.
Software Breakpoints
VxWorks for Renesas SuperH supports both software and hardware breakpoints.
When you set a software breakpoint with the b( ) command, VxWorks replaces an
instruction with a trapa instruction. VxWorks restores the original instruction
when the breakpoint is removed.
If you set a breakpoint just after a delayed branch instruction, the b( ) command
returns the following warning message:
-> l 0x6001376,2
6001376 b1a0
bsr
+832
(==> 0x060016ba)
6001378
0606
(mov.l
r0,@(r0,r6))
-> b 0x6001378
WARNING: address 0x6001378 might be a branch delay slot
value = 0 = 0x0
->
In addition, you may see an illegal instruction exception when the breakpoint is
hit. However, the b( ) command does not prevent setting a breakpoint in a branch
delay slot because code just after a constant data may also match the pattern of a
delayed branch instruction.
173
VxWorks
Architecture Supplement, 6.2
Table 7-1
Bits
Value
Breakpoint Type
0-1
00
01
10
00
01
10
00
01
10
11
00
01
10
00
01
10
2-3
4-5
6-7
8-9
Access Value
Breakpoint Type
0x0000
0x0001
174
7 Renesas SuperH
7.3 Interface Variations
Table 7-2
Access Value
Breakpoint Type
0x0032
0x0026
brcrInit
BRCR value (or CCMFR value for SH-4A architectures) to initialize.
pBRCR
Address of the BRCR register (or CCMFR register for SH-4A architectures).
base[i]
Channel base addresses. Up to four channels are supported.
For example, in sysHwInit( ), add the following:
#if defined(INCLUDE_WDB) || defined (INCLUDE_DEBUG)
_func_wdbUbcInit = sysUbcInit;
#endif
175
VxWorks
Architecture Supplement, 6.2
/**********************************************************************
*
* sysUbcInit - Initialize the UBC structure
*
* This routine is called when setting the first hardware breakpoint to
* initialize the User Break Controller structure and identify the UBC.
*
*/
void sysUbcInit
(
UBC * pUbc
)
{
pUbc->brcrSize = BRCR_16_2;
pUbc->brcrInit = 0;
pUbc->pBRCR = (UINT32) UBC_BRCR;
pUbc->base[0] = (UINT32) UBC_BARA;
pUbc->base[1] = (UINT32) UBC_BARB;
}
7.3.2 excArchLib
Support for Bus Errors
SH7750 processors detect various types of access alignment errors as address error
exceptions, but do not support access timeout errors to non-existent memory.
The exception handling library provides a way to detect this type of bus error in a
board-dependent manner. To implement the bus timeout detection, the target
board must be able to detect the timeout and interrupt the CPU. This interrupt
should be non-maskable and edge-triggered.
176
7 Renesas SuperH
7.3 Interface Variations
The exception handling library uses a CPU-specific trap number (see ivSh.h) to
detect divide-by-zero errors. For example, the target shell responds to a
zero-divide condition with:
-> 1/0
Zero Divide
TRA Register: 0x00000004 (TRAPA #1)
Program Counter: 0x0c008a2a
Status Register: 0x40001001
shell restarted.
->
Other tasks handle the zero-divide trap as any other exception; the task is
suspended unless the trap is caught either as a signal (SIGFPE) or by installing a
user handler with intVecSet( ).
For application code, this implementation requires support from the compiler used
to build the code. The GNU compiler includes support for this type of exception.
However, the Wind River Compiler does not include this support. Therefore,
application code built with the Wind River Compiler does not generate an
exception for a divide-by-zero operation.
7.3.3 intArchLib
intConnect( ) Parameters
The intConnect( ) routine takes the following parameters: the interrupt vector
address, the handler function, and an integer parameter to the handler function.
The intConnect( ) routine can be extended by setting _func_intConnectHook to
the new routine, for example sysIntConnect( ). This routine can be implemented
for a BSP that has an off-chip interrupt controller (for example, VME).
intLevelSet( ) Parameters
177
VxWorks
Architecture Supplement, 6.2
The interrupt controllers priority registers (IPRA-IPRx) are different for each
SuperH CPU variant. Consult the appropriate SuperH hardware manual for
the bit definitions of these registers.
7.3.4 mathLib
VxWorks for Renesas SuperH supports the following double-precision math
routines:
acos( )
exp( )
log10( )
tanh( )
asin( )
fabs( )
modf( )
atan( )
floor( )
pow( )
atan2( )
fmod( )
sin( )
ceil( )
frexp( )
sinh( )
cos( )
cosh( )
ldexp( ) log( )
sqrt( )
tan( )
178
7 Renesas SuperH
7.3 Interface Variations
7.3.5 vxLib
vxTas( )
vxMemProbe( )
179
VxWorks
Architecture Supplement, 6.2
VxWorks for Renesas SuperH supports the following SuperH-specific GNU linker
(ldsh) options:
-EB
-EL
There are no SuperH-specific Wind River Compiler compiler (dcc) options. The
following SuperH target definitions are supported with the -t compiler option:
-tSH4EH:vxworks62
-tSH4LH:vxworks62
-tSH4EH:rtp
-tSH4LH:rtp
The target definitions listed in the previous section, also apply to the assembler.
The following Wind River Compiler assembler option is useful when building
GNU-compatible modules:
-Xalign-power2
180
7 Renesas SuperH
7.4 Architecture Considerations
There are no SuperH-specific Wind River Compiler linker options. The target
definitions listed in Wind River Compiler Options, p.180 apply to the linker as well.
This section describes characteristics of the Renesas SuperH architecture that you
should keep in mind as you write a VxWorks application. The following topics are
addressed:
181
VxWorks
Architecture Supplement, 6.2
return value
scratch registers
function parameters
call saved registers
frame pointer (call saved)
stack pointer
subroutine return address
FP to integer communication register
FP return value
FP scratch registers
FP parameters
call saved FP registers
not used by the compiler
182
7 Renesas SuperH
7.4 Architecture Considerations
RB = 1
TLB mis-hit exception handling
RB = 1
common processes for exception/interrupt handling
RB = 0
individual exception/interrupt handling
Generally, all VxWorks tasks run with BANK0 registers. There are some common
processes for exception and interrupt handling which run with BANK1, but those
processes switch back to BANK0 before dispatching to an individual handler. The
switching is done by applying a new SR value from intPrioTable[ ] in the BSP. One
exception is translation lookaside buffer (TLB) mis-hit exception handling which
runs with BANK1 to the end.
Event
Branch Address
Cause Register
Reset, Power-on
0xa0000000
EXPEVT
Exception, Trap
VBR + 0x100
EXPEVT/TRA
EXPEVT
Interrupt
INTEVT
VBR + 0x600
183
VxWorks
Architecture Supplement, 6.2
Multiple Interrupts
The status register of SuperH has 4 bits of interrupt masking field; thus it supports
15-levels of prioritized interrupts. Control of masking field is fully left to software.
To support the prioritized interrupt handling system on SuperH, VxWorks defines
a table of status register values in the BSP. This table is called intPrioTable[ ], and
is located in sysALib.
When a SuperH CPU accepts an interrupt request, it first blocks any succeeding
exception or interrupt by setting the block bit (BL) to 1 in the status register (SR),
the processor then branches to (VBR + 0x600).
The common interrupt dispatch code is loaded at (VBR + 0x600), and the processor
instructs the following: (1) save critical registers on interrupt stack, (2) update SR
with a value in intPrioTable[ ], (3) branch to an individual interrupt handler. Here,
step (2) typically unblocks higher-priority interrupts, thus multiple interrupts can
be processed. Also, the SR is not updated if the corresponding intPrioTable[ ]
entry is null.
As a specification of the on-chip interrupt controller (INTC), the processor may
branch to (VBR + 0x600) with a NULL value in the INTEVT register. This could
happen if the interrupt status or control flags of the on-chip peripheral modules are
modified while the BL bit of the SR is 0. To safely ignore this spurious interrupt,
the common interrupt dispatch code checks the INTEVT register value and
immediately calls the RTE (return from exception) instruction if the value is NULL.
184
7 Renesas SuperH
7.4 Architecture Considerations
Interrupt Stack
For VxWorks on all Renesas SuperH architectures, an interrupt stack allows all
interrupt processing to be performed on a separate stack. The interrupt stack is
implemented in software because the SuperH family does not support such a stack
in hardware. The interrupt stack size is defined by the ISR_STACK_SIZE macro in
the configAll.h file. The default size of the interrupt stack is 1000 bytes. The
interrupt stack is initialized by calling kernelInit( ).
For SuperH, the common interrupt dispatch code pushes some critical registers on
the interrupt stack while the BL bit of SR is 1. As a specification, SuperH
immediately reboots if any exception occurs while the BL bit is 1. Note that if the
MMU is enabled, any access to logical address space may lead to a TLB mis-hit
exception. In other words, no logical address space access is allowed while the BL
bit is 1 if the MMU is enabled. Therefore, the interrupt stack must be located on a
fixed physical address space (P1/P2) if the MMU is enabled. Interrupt stack
underflow/overflow guard pages are not available on SuperH architectures due to
the location of the stack in the P1/P2 area (which is MMU unmappable). The
SuperH version of kernelInit( ) internally calls intVecBaseGet( ) and uses the
upper three bits of its returned address as the base address of the interrupt stack,
so that you can specify your choice of P1/P2 to intVecBaseSet( ) in usrInit( ),
typically through a redefined macro VEC_BASE_ADRS in your BSP.
185
VxWorks
Architecture Supplement, 6.2
program text/data/bss. The ITLB has four full-associative entries, and the UTLB
has 64 full-associative entries. In a sense, the ITLB caches some UTLB entries and
the UTLB caches some page table entries on the physical memory. If an SH-4
processor accesses a virtual address that is not mapped on the UTLB, a TLB mis-hit
exception immediately takes place and control is transferred to the VxWorks TLB
mis-hit exception handler placed at the pre-determined vector address (VBR +
0x400). The TLB mis-hit handler walks through the translation table on physical
memory, and loads the missing virtual-to-physical address mapping to the TLBs,
if any exist. If the handler fails to find a valid page table entry for the accessed
virtual address, a TLB Miss/Invalid exception event is reported in the VxWorks
shell.
The SH-4 memory map is depicted in Figure 7-1. Note that the SH-4 memory map
is arranged into segments that have pre-determined modes of operation. Unlike
some processors that can set specific virtual addresses to any mode of operation,
SH-4 pre-assigns certain ranges of virtual addresses as accessible in privileged
mode or user mode.
Figure 7-1
Hard-Mapped, Uncached
On-Chip
Resources
E0000000
FFFFFFFF
E0000000
P3
TLB-Mapped, Cacheable
P2
Hard-Mapped, Uncached
P1
Hard-Mapped, Cached
C0000000
A0000000
80000000
P0/U0
2 GB
20000000
TLB-Mapped, Cacheable
512 MB
00000000
Virtual Memory
00000000
Physical Memory
In Figure 7-1, there are five memory segments: P0/U0, P1, P2, P3, and P4. The
lowest 2 GB segment is accessible in either privileged or user mode; it is called P0
186
7 Renesas SuperH
7.4 Architecture Considerations
in privileged mode, and U0 in user mode. The other segments are accessible only
in privileged modethat is, in the VxWorks supervisor mode.
The five SH-4 memory segments are also pre-designated as either TLB-mapped or
hard-mapped, as shown in Figure 7-1. Ranges of addresses designated as
TLB-mapped, P3 and P0/U0, use the TLB to determine the physical mappings for
the virtual addresses. Ranges of addresses specified as hard-mapped, P1 and P2,
do not use the TLB. Instead, SH-4 directly maps the virtual address starting at
physical address 0x0. Likewise, P4 is directly mapped to various on-chip resources.
To summarize each of the segments:
P0/U0
When the most significant bit of the virtual address is 0, the 2 GB user space
labeled P0/U0 is the virtual address space selected. All references to P0/U0 are
mapped through the TLB while the MMU is enabled. This memory segment
can be marked either as cacheable or uncacheable on a page-by-page basis.
P1
When the most significant three bits of the virtual address are 100, the 512 MB
kernel space labeled P1 is the virtual address space selected. References to P1
are not mapped through the TLB; the physical address selected is defined by
subtracting 0x80000000 from the virtual address. The cache mode for these
accesses is determined by the copyback (CB) bit of the cache control register
(CCR) mapped in P4, and the CB bit is set if the CACHE_COPYBACK_P1 option
is specified in the USER_D_CACHE_MODE parameter of the BSPs config.h
file.
P2
When the most significant three bits of the virtual address are 101, the 512 MB
kernel space labeled P2 is the virtual address space selected. References to P2
are not mapped through the TLB; the physical address selected is defined by
subtracting 0xA0000000 from the virtual address. Caches are always disabled
for accesses to these addresses; physical memory or memory-mapped I/O
device registers are accessed directly.
P3
When the most significant three bits of the virtual address are 110, the 512 MB
kernel space labeled P3 is the virtual address space selected. All references to
P3 are mapped through the TLB while the MMU is enabled. This memory
segment can be marked either as cacheable or uncacheable on a page-by-page
basis.
187
VxWorks
Architecture Supplement, 6.2
P4
When the most significant three bits of the virtual address are 111, the 512 MB
kernel space labeled P4 is the virtual address space selected. References to P4
are not mapped through the TLB; this space is mapped to various on-chip
resources. Caches are always disabled for accesses to these addresses; on-chip
registers or PCI bus windows are accessed directly.
While the memory segments P1 and P2 are both hard-mapped kernel segments,
both segments map to the same physical memory in the lowest 512 MB of memory.
As a result, to virtually reference a variable or code in P1 is to virtually reference
the same in P2. However, because P2 is not cacheable, virtually referencing a
variable or code in P2 results in an uncached reference. Note that the SH-4 MMU
manages a 29-bit physical address. In other words, the SH-4 MMU translates a
32-bit virtual address into a 29-bit physical address. Also note that virtual
addresses referenced in hard-mapped space do not cause a TLB mis-hit exception
at any time. These points are important to the implementation of the software side
of the MMU.
The current version of the MMU library for SuperH does not support SH-4A 32-bit
address extended mode (4 GB physical address memory space). VxWorks runs in
SH-4 29-bit emulation mode on SH-4A processors.
MMU_ATTR_SPL_1
MMU_ATTR_SPL_2
MMU_ATTR_SPL_3
NOTE: The above register settings are required for PCMCIA use. However, due to
the PTEA register value read/write operation during the TLB mishandle,
exception handling becomes much slower when the special attributes are
implemented. For this reason, Wind River does not recommend using the special
attributes unless they are required for PCMCIA support.
188
7 Renesas SuperH
7.4 Architecture Considerations
189
VxWorks
Architecture Supplement, 6.2
NOTE: The VM_STATE_xxx macros (listed above) are used in VxWorks 5.5 releases
and are still supported for this release. However, these macros may be removed in
the future. Wind River recommends that you use the MMU_ATTR_xxx macros for
new development and that you update any existing BSP to use the new macros
whenever possible. For more information on the VM_STATE_xxx macros, see the
VxWorks Migration Guide.
7.4.9 Caches
The SuperH cache implementation differs from processor to processor; refer to
your processor hardware manual for details. The SuperH target libraries include
support for the following processor types, as shown in Table 7-4. The SuperH
cache libraries for this release do not use the processor abstraction layer method
(referred to as cache AIM) used for certain other processors as of VxWorks 6.0.
Instead, the libraries are directly linked to the upper layer of the cache library as in
earlier VxWorks releases.
Table 7-4
Cache Library
Supported Processors
cacheSh7750Lib
The BSP must assign sysCacheLibInit to the cache library initialization routine.
For example:
FUNCPTR sysCacheLibInit = (FUNCPTR)
cacheSh7750LibInit;
190
7 Renesas SuperH
7.4 Architecture Considerations
The FPSCR register can also be set globally with the help of the global
fpscrInitValue variable (declare this variable as extern UINT32). This value must
be set early at startup. It is used to initialize __fpscr_values and each floating-point
tasks initial FPSCR value.
The default fpscrInitValue variable sets the rounding mode to the Round to Nearest
policy and enables denormalized numbers. The SH7750 processor requires
software support for handling denormalized numbers in the form of an exception
handler. This handler is provided with the VxWorks target library. If your
application does not require support for denormalized numbers you may change
the FPSCR setting accordingly. Disabling denormalized numbers causes the FPU
to treat them as zero. For more information, see the SH7750 Hardware Manual.
The floating-point context includes the extended floating-point registers. To save
and restore the extended floating-point registers at context switches, tasks
performing floating-point instructions should be spawned with the VX_FP_TASK
option. Interrupt handlers using floating-point operations must explicitly call
fppSave( ) and fppRestore( ). These two functions are also used to save and
restore the extended floating-point registers.
There are no special compiler flags required for enabling hardware or software
floating-point. Provided you use the appropriate target CPU option, both the GNU
compiler and the Wind River Compiler default to hardware floating-point for SH-4
processors. For more information, see 7.3.6 SuperH-Specific Tool Options, p.179.
For SuperH processors that have three power management (standby) control
registers, initialize the structure in sysHwInit( ) as follows:
191
VxWorks
Architecture Supplement, 6.2
vxPowerModeRegs.pSTBCR1 = STBCR;
vxPowerModeRegs.pSTBCR2 = STBCR2;
vxPowerModeRegs.pSTBCR3 = STBCR3;
The vxPowerModeSet( ) routine can be used to set the power mode. The
supported parameter values for this routine are:
VX_POWER_MODE_DISABLE
VX_POWER_MODE_SLEEP
VX_POWER_MODE_DEEP_SLEEP
VX_POWER_MODE_USER
Software Signal
INUM_TLB_READ_MISS
SIGSEGV
INUM_TLB_WRITE_MISS
SIGSEGV
192
7 Renesas SuperH
7.4 Architecture Considerations
Table 7-5
Software Signal
INUM_TLB_WRITE_INITIAL_MISS
SIGSEGV
INUM_TLB_READ_PROTECTED
SIGSEGV
INUM_TLB_WRITE_PROTECTED
SIGSEGV
INUM_READ_ADDRESS_ERROR
SIGSEGV
INUM_WRITE_ADDRESS_ERROR
SIGSEGV
INUM_FPU_EXCEPTION
SIGFPE
INUM_ILLEGAL_INST_GENERAL
SIGILL
INUM_ILLEGAL_INST_SLOT
SIGILL
INUM_TRAP_1
SIGFPE
193
VxWorks
Architecture Supplement, 6.2
Figure 7-2
FFFFFFFF
PCI
Window
Hard-Mapped
FC000000
PCI
Window
FC000000
P4
E0000000
E0000000
20000000
Area 7
Area 6
Area 5
Area 4
Area 3
Area 2
Area 1
Area 0
00000000
Virtual Memory
1C000000
18000000
14000000
10000000
0C000000
08000000
04000000
00000000
Physical Memory
194
7 Renesas SuperH
7.4 Architecture Considerations
beginning of the kernels data segment, and is used to export specific global
variables to the RTPs.
Figure 7-3
FFFFFFFF
P4
Hard-Mapped
On-Chip
Resources
E0000000
E0000000
P3
Kernel Region
TLB-Mapped
C0000000
P2
Hard-Mapped
A0000000
P1
Hard-Mapped
80000000
P0/U0
Shared Data
TLB-Mapped
40000000
RTP
TLB-Mapped
00000000
Kernel Region
TLB-Mapped
Virtual Memory
20000000
(512 MB)
Kernel Region
00000000
Physical Memory
195
VxWorks
Architecture Supplement, 6.2
Supervisor Mode
User Mode
Segment
Read
Write
Read
Write
P4
E0000000 - FFFFFFFF
n/a
n/a
P3
C0000000 - DFFFFFFF
n/a
n/a
n/a
n/a
n/a
n/a
P2 and P1
80000000 - BFFFFFFF
P0/U0
00000000 - 7FFFFFFF
X
X
X
X
X
X
196
7 Renesas SuperH
7.4 Architecture Considerations
SM Anchor
VxWorks itself (four sections: text, rodata, data, and bss). The entry point for
VxWorks (sysInit( )) is at the start of this region.
Interrupt Stack
197
VxWorks
Architecture Supplement, 6.2
Figure 7-4
VxWorks Memory Layout for the SH-4 System Module (P0 or P3)
sysPhysMemTop( )
ED&R and User Reserved Memory
Initially Unmapped RAM, Pages for RTPs,
SLs and SDs from this region
sysMemTop( )
Heap
VxIntStackBase
VxIntStackEnd
bss
data
etext
rodata
text
System Image
Kernel Region
+2000 RAM_LOW_ADRS
Initial Stack
Exception Message
Boot Line
SM Anchor
+1800
+1700
+1600
+1000
198
+c00
KEY
= Available
= Reserved
+800
+600
+400
+100
+0
LOCAL_MEM_LOCAL_ADRS
7 Renesas SuperH
7.5 Migrating Your BSP
than the actual physical memory. This is done to reduce boot-up time for the
default boot ROM shipped with the BSP or because of variations in physical
memory size on different hardware revisions. If this is the case for your BSP,
you can increase LOCAL_MEM_SIZE up to the physical memory size. This will
result in an increase in the system memory pool size. (If your BSP supports
LOCAL_MEM_AUTOSIZE, the physical memory size is calculated by the BSP
automatically.) For more information, see your BSP config.h or target.ref file.
All addresses shown in Figure 7-4 are relative to the start of memory for a
particular target board. The start of memory (corresponding to +0 in the
memory-layout diagram) is defined as LOCAL_MEM_LOCAL_ADRS in config.h
for each target.
199
VxWorks
Architecture Supplement, 6.2
200
A
Building Applications
A.1 Introduction
Wind River recommends that you use Workbench or the vxprj command-line
utility whenever possible to build your VxWorks image or application. Workbench
and vxprj are correctly pre-configured to build most types of projects. However,
this appendix provides architecture-specific information that you may need to
build certain types of VxWorks applications and libraries, specifically in situations
where you must invoke the make command directly.
For more information on building applications and libraries, see the Wind River
Workbench for VxWorks Users Guide or the VxWorks Command-Line Tools Users
Guide: Building Kernel and Application Projects.
201
VxWorks
Architecture Supplement, 6.2
This command compiles for a 32-bit MIPS target using the GNU compiler, with
software floating-point support and little-endian byte order.
Table A-1 shows the supported values for CPU and TOOL. When referencing this
table, note the following:
The CPU value used by the VxWorks build system does not necessarily
correspond to the exact microprocessor model.
The information in the table may not be up to date. For information regarding
current processor support, see your product release notes or the Online
Support Web site.
NOTE: Modules built with either gnu or diab can be linked together in any
combination, except for modules that require C++ support. Cross-linking of C++
modules is not supported in this release. For more information, see your product
migration guide.
Table A-1
CPU Value
TOOL Value
Processor Class
ARMARCH5
diab
ARM Architecture
Version 5 CPUs (running
in ARM state)
gnu
202
Floating Point
Endian
little
little
A Building Applications
A.2 Defining the CPU and TOOL Make Variables
Table A-1
CPU Value
TOOL Value
Processor Class
ARMARCH6
diab
ARM Architecture
Version 6 CPUs (running
in ARM state)
Floating Point
little
little
gnu
PENTIUM
diab
Pentium
little
little
gnu
PENTIUM2
diab
little
little
gnu
PENTIUM3
diab
little
little
gnu
PENTIUM4
diab
Pentium 4, Pentium M
little
little
gnu
XSCALE
MIPS32
gnu
Endian
XScale Architecture
CPUs (running in ARM
state)
little
diab
little
gnube
big
diabbe
big
sfgnu
32-bit MIPS
Software
big
sfdiab
32-bit MIPS
Software
big
sfgnule
32-bit MIPS
Software
little
sfdiable
32-bit MIPS
Software
little
203
VxWorks
Architecture Supplement, 6.2
Table A-1
CPU Value
TOOL Value
Processor Class
Floating Point
Endian
MIPS64
gnu
64-bit MIPS
Hardware
big
diab
64-bit MIPS
Hardware
big
gnule
64-bit MIPS
Hardware
little
diable
64-bit MIPS
Hardware
little
sfdiab
big
sfgnu
big
sfdiab
PowerPC 440GP
Software
big
sfgnu
PowerPC 440GP
Software
big
diab
PowerPC 440GX
Hardware
big
gnu
PowerPC 440GX
Hardware
big
diab
big
gnu
big
diab
big
gnu
big
PPC405
PPC440
PPC603
PPC604
204
A Building Applications
A.2 Defining the CPU and TOOL Make Variables
Table A-1
CPU Value
TOOL Value
Processor Class
PPC604
diab
MPC7445, MPC7450,
MPC7455
big
gnu
MPC7445, MPC7450,
MPC7455
big
sfdiab
MPC821, MPC823,
MPC823e, MPC850,
MPC850SAR, MPC855,
MPC855T, MPC860
big
sfgnu
MPC821, MPC823,
MPC823e, MPC850,
MPC850SAR, MPC855,
MPC855T, MPC860
big
sfdiab
MPC8540, MPC8560
big
sfgnu
MPC8540, MPC8560
big
diab
big
gnu
big
SH7750
gnu
SH-4
hardware
big
(kernel
applications
only)
gnule
SH-4
hardware
little
diab
SH-4
hardware
big
diable
SH-4
hardware
little
gnu
SH-4
hardware
big
gnule
SH-4
hardware
little
diab
SH-4
hardware
big
diable
SH-4
hardware
little
(AltiVeca)
PPC860
PPC85XX
PPC32
SH32
(RTPs only)
Floating Point
Endian
205
VxWorks
Architecture Supplement, 6.2
a. Motorola PowerPC MPC74XX CPUs are treated as a variation of the PowerPC 604 CPU
type. AltiVec support in the MPC74XX processors is in addition to the existing
PowerPC 604 functionality. Modules that make use of AltiVec instructions must be
compiled with certain compiler-specific options, but can be linked with modules that
do not use the AltiVec compile options. See 6.3.7 AltiVec and PowerPC 970 Support,
p.130, for details
Processors that are based on the x5 version of the PowerPC 440 core (such as
PowerPC 440GX or 440EP) require support for the recoverable machine check
mechanism even if none of the mechanisms optional capabilities are enabled.
In order to select the proper version of architecture support code, BSPs for
these processors must specify either CPU=PPC440 CPU_VARIANT=_x5 or
CPU=PPC32 CPU_VARIANT=_ppc440_x5.
Freescale Semiconductor, Inc. processors based on the G2_LE core, such as the
MPC827X and the MPC828X, vary from the traditional G2 core that belongs to
the PPC603 family in VxWorks. The G2_LE core provides additional BAT
registers in the MMU, includes additional SPRG registers, and incorporates
the critical interrupt class of exception. To select the proper architecture
support code, the BSP must specify either CPU=PPC603 CPU=VARIANT=_g2le
or CPU=PPC32 CPU_VARIANT=_ppc603_g2le.
Like the G2_LE core, the e300 core also provides additional BAT registers and
the critical interrupt class of exception. The e300 core is synonymous with the
Freescale PowerQUICC Pro processor family (processors such as the
MPC834X and MPC836X belong to this family). BSPs for this family must
specify either CPU=PPC603 CPU_VARIANT=_83xx or
206
A Building Applications
A.3 Make Variables to Support Additional Compiler Options
support code.
Backward Compatibility
207
VxWorks
Architecture Supplement, 6.2
On ARM and Intel XScale targets, the -Xcode-absolute-far flag (Wind River
Compiler (diab)) and the -mlong-calls flag (GNU compiler) may be required to
compile VxWorks downloadable kernel modules. These flags are required if the
board you are working with has more memory than can be accessed using relative
branches. The flags are not automatically passed to the build command and if the
flags are not added explicitly, the loader may issue a relocation overflow error (this
happens using both the GNU compiler and the Wind River Compiler).
A macro is already defined for this purpose in the respective compiler definition
(defs) files and can be included by modifying the compiler settings in your project
or specifying the appropriate option on the command line when building your
module. For example:
% make TOOL=tool CPU=cpu ADDED_CFLAGS=$(LONGCALL)
ADDED_C++FLAGS=$(LONGCALL)
MIPS
The MIPS Application Binary Interface (ABI) normally uses the jal instruction to
call functions not accessed through a pointer. Thus, the function call:
func( );
func
However, the bit encoding of the jal instruction contains only a 26-bit field to select
the word address of the entry point of the routine. Because MIPS instructions are
all word aligned, it is not necessary to specify the byte address; this implies that a
28-bit byte address can be inferred from a 26-bit word address, because the lower
2 bits of the byte address are always 0. The target address of a function call is
assumed to have the same pattern in the top 4 bits as the jal instruction which
references it.
The result of this limitation is that special consideration is required to reference
functions outside the current 512 MB address segment. For unmapped kernels, this
is rarely an issue because all code typically resides in the 512 MB KSEG0 segment.
However, mapped kernels running in systems with large amounts of memory may
require special precautions to deal with function call accesses not in the current
512 MB memory segment.
208
A Building Applications
A.3 Make Variables to Support Additional Compiler Options
Two solutions are possible: Either the routine can be accessed through a pointer
instead of directly, or the compiler can be instructed to modify the routine calling
convention to load the 32-bit address of the routine into a register and then use the
jalr instruction instead of jal.
The first approach requires changing the function call example presented above to
look something like the following:
{
VOIDFUNCPTR pFunc = func;
...
(*pFunc)();
...
}
The second solution requires adding an option to the compiler command line. For
the Wind River Compiler (diab), the -Xcode-absolute-far option is used, and for
the GNU compiler (gnu), the option is -mlong-calls. To specify these
command-line options, modify the compiler settings in your project or specify the
appropriate option on the command line when building the module. For example:
For the Wind River Compiler, use:
% make TOOL=diab CPU=cpu ADDED_CFLAGS="-Xcode-absolute-far"
ADDED_C++FLAGS="-Xcode-absolute-far"
Either of the above solutions causes the compiler to generate similar code for
calling the routine:
lui
addui
jalr
$24,%hi(func)
$24,$24,%lo(func)
$24
PowerPC
209
VxWorks
Architecture Supplement, 6.2
explicitly, the loader may issue a relocation overflow error (this happens using
both GNU and the Wind River Compiler (diab)).
To specify these flags, modify the compiler settings in your project or specify the
appropriate option on the command line when building the module. For example:
For the Wind River Compiler, use:
% make TOOL=diab CPU=cpu ADDED_CFLAGS="-Xcode-absolute-far"
ADDED_C++FLAGS="-Xcode-absolute-far"
For more information on relative branching, see 6.4.4 26-bit Address Offset
Branching, p.146.
processor, including those that provide hardware floating point support. However,
RTPs built with soft float options (sfdiab or sfgnu) will not be able to use the
processor hard float capability.
When extra options are required (for example, when you must compile for AltiVec
or SPE support), the extra options can be specified using the ADDED_CFLAGS
macro in the BSP makefile. For example, enable AltiVec support in the Wind River
Compiler (diab) by appending the following line to the end of Makefile for an RTP
application:
ADDED_CFLAGS += -tPPC7400FV:vxworks62
210
A Building Applications
A.4 Additional Compiler Options and Considerations
NOTE: The make rules to build RTPs are in rules.rtp and compiler-specific options
t
211
VxWorks
Architecture Supplement, 6.2
To compile C and C++ modules for debugging, you must use the -g compiler flag
to generate debug information. An example command line for the GNU compiler
is as follows:
% ccpentium -mcpu=pentium -IinstallDir/vxworks-6.2/target/h -fno-builtin \
-DCPU=PENTIUM -c -g test.cpp
In this example, installDir is the location of your VxWorks tree and -DCPU specifies
the CPU type. An equivalent example for the Wind River Compiler is as follows:
% dcc -tPENTIUMLH:vxworks62 -IinstallDir/vxworks-6.2/target/h \
-DCPU=PENTIUM -c -g test.cpp
A.4.2 MIPS
In some cases, special compiler options and considerations are required when
compiling applications for MIPS. The following sections discuss these instances.
212
A Building Applications
A.4 Additional Compiler Options and Considerations
Processors supported with the MIPS32sfgnu and MIPS32sfgnule CPU and TOOL
combinations use the R4000-compatible cache and eret instructions which are not
supported when using the -mips2 GNU compiler option. This incompatibility
does not generally cause a problem because these instructions are typically found
only in assembly-language kernel library code, not in user-provided code such as
BSPs. If your code needs to use these instructions, you should choose one of the
following recommended options:
Assemble the file with the Wind River Compiler (diab) toolchain, which
supports these instructions in -tMIPS2xx:vxworks62 (32-bit, soft float) modes.
Temporarily alter your ISA selection with the .set option as follows:
.set
eret
.set
mips3
mips0
eret
.word
Wind River does not support modifying the GNU compiler option from -mips2 to
-mips3. This may generate instructions that are not supported on all MIPS
processors, and will cause linkage problems with kernel libraries that are compiled
with the -mips2 option.
A.4.3 PowerPC
In some cases, special compiler options and considerations are required when
compiling applications for PowerPC. The following sections discuss these
instances.
MPC85XX CPUs have a Signal Processing Engine (SPE). The compiler option
-tPPCE500FG:vxworks62 or -tPPCE500FF:vxworks62 should be used for the
Wind River Compiler (diab) to generate SPE instructions. For the GNU compiler,
SPE instruction generation is already enabled by the -mcpu=8540 option. Refer to
your compiler documentation for more information.
213
VxWorks
Architecture Supplement, 6.2
To compile C and C++ modules for debugging, you must use the -g flag to generate
debug information. An example command line for the GNU compiler is as follows:
% ccppc -mcpu=603 -IinstallDir/vxworks-6.2/target/h -fno-builtin \
-DCPU=PPC603 -c -g test.cpp
In this example, installDir is the location of your VxWorks tree and -DCPU specifies
the CPU type. An equivalent example for the Wind River Compiler is as follows:
% dcc -tPPC603FH:vxwork55 -IinstallDir/vxworks-6.2/target/h \
-DCPU=PPC603 -c -g test.cpp
214
Index
Symbols
__fpscr_values 190
__ieee_status( ) 11, 29
_745x 206
_CACHE_ALIGN_SIZE 5, 23
_func_armPageSource 38
_func_excBErrIntAck 176
_func_intConnectHook 177
_func_intDisableRtn 178
_func_intEnableRtn 178
_func_vxMemProbeHook 8, 26, 179
_func_wdbUbcInit 175
_MMU_TLB_TS_0 125, 128
_ppc440_x5 206
_ppc604_745x 206
_pSysBatInitFunc 122
_x5 206
Numerics
routines
vxCr 55
16-bit instruction set (Thumb) 9, 27
26-bit address offset branching
PowerPC 146
26-bit processor mode
ARM 9, 26
A
a.out
Intel Architecture 59
ABI 151
access types
MPC85XX 151
MPC8XX 151
PowerPC 405 150
PowerPC 440 151
PowerPC 603 151
PowerPC 604 151
ADDED_C++FLAGS 207
ADDED_CFLAGS 207, 210
ADJUST_VMA 94
Advanced Programmable Interrupt Controller
see APIC
Advanced RISC Machines
see ARM
215
VxWorks
Architecture Supplement, 6.2
AIM 92
model for caches
MIPS 92
model for MMU
MIPS 107
SuperH 189
AltiVec 130
AltiVec-specific routines 131
C++ exception handling 138
enabling keywords 136
extensions to the WTX protocol 137
feature support 130
layout of the EABI stack frame 132
VxWorks run-time support for 130
WTX API routines 138
Altivec
compiling modules with the GNU compiler
137
compiling modules with the Wind River
Compiler 136
altivecInit( ) 131
altivecProbe( ) 130, 131
altivecRestore( ) 131
altivecSave( ) 131
altivecTaskRegsGet( ) 131
altivecTaskRegsSet( ) 131
altivecTaskRegsShow( ) 131
aoutToBinDec 60
APIC 74
APIC_TIMER_CLOCK_HZ 77
Application Binary Interface
see ABI
Application Specific Standard Product
see ASSP
architecture considerations
ARM 8
Intel Architecture 60
MIPS 95
PowerPC 144
SuperH 181
XScale 26
Architecture-Independent Model
see AIM
architectures
ARM 3
216
Intel Architecture 47
Intel XScale 21
MIPS 85
PowerPC 115
Renesas SuperH 171
archPpc.h 159
ARM 3
see also XScale
architecture considerations 8
BSP considerations for cache and MMU 15
BSP migration 17
VxWorks 5.5 compatibility 19
byte order 9
cache and memory management interaction
14
cache and MMU routines for individual
processor types 15
cache coherency 12
cacheLib 5, 7
caches 12
compiling downloadable kernel modules 208
controlling the CPU interrupt mask 6
cret( ) 4
dbgArchLib 6
dbgLib 5
defining cache and MMU types in the BSP 15
divide-by-zero handling 11
enabling backtracing 5
FIQ 11
floating-point library 11
floating-point support 11
hardware-assisted debugger compatibility 5
initializing the interrupt architecture library 7
intALib 6
intArchLib 6
interface variations 4
interrupt handling 6, 10
non-preemptive mode 7
preemptive mode 7
interrupt stack 10
interrupts and exceptions 10
IRQ 11
memory layout 16
MMU 13
processor mode 9
Index
B
b( ) 173
backtracing
enabling on ARM targets 5
enabling on XScale targets 22
banked registers
SuperH 182
BAT
enabling additional, PowerPC 121
PowerPC 120
bh( )
Intel Architecture 57
MIPS 89
PowerPC 149
SuperH 173
bitmap combinations
SuperH 174
bl 146, 147
bla 146, 147
block address translation
see BAT
blrl 147
BOI 70
Book E processor specification 124
boot floppies
VxWorks for Intel Architecture 61
boot ROMs
MIPS 95, 110
boot sequencing
MPC85XX 127
PowerPC 440 125
BOOT_LINE_OFFSET 19, 44
bootrom
MIPS 95
bootrom.hex
MIPS 95
branch addresses
SuperH 183
branching across large address ranges
PowerPC 146
brcrInit 175
brcrSize 175
breakpoints
Intel Architecture 57
MIPS 89
SuperH 173
BRK_DATARW1 57
BRK_DATARW2 57
BRK_DATARW4 57
BRK_DATAW1 57
BRK_DATAW2 57
BRK_DATAW4 57
BRK_INST 57
217
Index
VxWorks
Architecture Supplement, 6.2
C
C language
extensions for vector types
AltiVec 134
SPE 142
C++ modules
cross-linking 202
cache
AIM model for
PowerPC 155
ARM 12
configuration
ARM 12
XScale 29
218
61
Intel Architecture 63
locking
ARM 5, 13
MIPS 92
XScale 23, 30
memory management interaction
ARM 14
XScale 38
MIPS 91
PowerPC 153
SuperH 190
libraries and supported processors
cache coherency
ARM 12
PowerPC 119
XScale 30
CACHE_COPYBACK 13
CACHE_COPYBACK_P1 187
CACHE_WRITETHROUGH 13, 30, 162
cacheArchAlignSize 5, 23
cacheArchIntMask 16, 41
cacheArm1136jfLibInstall( ) 15
cacheArm926eLibInstall( ) 15
cacheArmXScaleLibInstall( ) 40
cacheClear( ) 13, 30, 155
cacheDisable( ) 91
cacheEnable( ) 14, 38, 91, 155
cacheInvalidate( ) 13, 30
cacheLib
ARM 5, 7
Intel Architecture 63
MIPS 92
PowerPC 153, 155
XScale 23, 25
cacheLibInit( ) 16, 41
cacheLock( ) 5, 13, 23, 30
cachePpcReadOrigin 153
cachetypeLibInstall( ) 15, 39
cacheUnlock( ) 5, 13, 23, 30
CC_ARCH_SPEC 207
Celeron processors 61
chanCnt 175
command-line build
enabling extended-call exception
vectors on PowerPC 148
190
Index
compiler options
adding using make variables 207
compiling
downloadable kernel modules 207
modules for debugging
Intel Architecture 212
PowerPC 214
RTP applications
PowerPC 210
config.h
ARM 19
Intel Architecture 68
MIPS 90, 93, 94, 110
PowerPC 147, 148, 161
SuperH 187, 199
XScale 41, 44
configAll.h
PowerPC 147
SuperH 185, 197
context switching
Intel Architecture 72
converting to network byte order
Intel Architecture 61
coprocessor abstraction
PowerPC 129
coprocessors
PowerPC 129
coprocTaskRegsGet( ) 63
coprocTaskRegsSet( ) 63
counters
Intel Architecture 73
cpsr( ) 6, 24
CPU 202
CPU interrupt mask
ARM 6
XScale 24
CPU_VARIANT 206
cpuPwrLightMgr 80
cpuPwrMgrEnable( ) 80
cpuPwrMgrIsEnabled( ) 80
cret( ) 4, 22
cross-linking of C++ modules 202
D
data cache
PowerPC 153
XScale 30
data MMU
PowerPC 118
data segment alignment
MIPS 91
data types
long long 113
dbgArchLib
ARM 6
MIPS 89
SuperH 172
XScale 23
dbgLib
ARM 5
SuperH 173
XScale 23
dcbst 153
DEC timer 166
DEFAULT_POWER_MGT_MODE 192
defining CPU variants for PowerPC 206
defining the CPU and TOOL make variables 202
diab 202
disassembler
Intel Architecture 58
divide-by-zero handling
ARM 11
PowerPC 145
SuperH 177
XScale 28
dtrGet( ) 56
dynamic model
MPC85XX 128
PowerPC 440 126
E
EABI 152
Motorola AltiVec EABI specification 137
Early EOI Issue 69
eax( ) 56
219
Index
VxWorks
Architecture Supplement, 6.2
-EB 180
ebp( ) 56
ebx( ) 56
ecx( ) 56
edi( ) 56
edx( ) 56
eflags( ) 56
efsadd 145
efsdiv 145
efsmul 145
efssub 145
-EL 180
ELF
Intel Architecture 59
Embedded Application Binary Interface
see EABI
enabling backtracing
ARM 5
XScale 22
enabling extended-call exception vectors
command-line builds
PowerPC 148
project builds
PowerPC 149
ENTIRE_CACHE 13
EOI 70
error detection and reporting
Intel Architecture 66
PowerPC 166
esi( ) 56
esp( ) 56
evfsadd 145
evfsdiv 145
evfsmul 145
evfssub 145
EVT
see exception vector table
EXC_MSG_OFFSET 19, 44
excArchLib
SuperH 176
excBErrVecInit( ) 176
excConnect( ) 161, 162
excCrtConnect( ) 161, 162
excEnt( ) 164
exception vector table 166
220
exception vectors
relocated vectors on PowerPC 164
exceptions
ARM 10
C++ exception handling and AltiVec support
138
floating-point on PowerPC 145
FPU on Intel Architecture 64
Intel Architecture 71
machine check architecture (MCA) 72
mapping onto software signals for MIPS 97
MIPS 97
PowerPC 161
SPE 145
SPE unavailable exception 145
SuperH 183
XScale 27, 28
excExtendedVectors 148, 149
excInit( ) 164
excIntConnect( ) 161, 162
excIntConnectTimer( ) 161, 164
excIntCrtConnect( ) 161, 162
excLib 105
excMchkConnect( ) 162
excVecGet( ) 10, 28, 164
excVecInit( ) 148, 149, 164
excVecSet( ) 10, 28, 161, 164
extended interrupts
MIPS RM9000 processors 104
extended-call exception vector support
PowerPC 147
extensions to the WTX protocol
AltiVec 137
SPE 144
EXTRA_DEFINE 93
F
fast interrupt 11, 28
fast interval timer 164
fdivp 211
fdivrp 211
FIQ
see fast interrupt
Index
FIT
see fast interval timer
floating-point
ARM 11
exceptions, PowerPC 145
library
ARM 11
XScale 29
MIPS 98
PowerPC 157
software floating-point emulation
Intel Architecture 79
SPE floating-point 145
SuperH 190
XScale 28
-fno-omit-frame-pointer 5, 22
formatted input and output of vector types
AltiVec 134
SPE 143
fppArchInit( ) 63
fppArchSwitchHook( ) 64
fppArchSwitchHookEnable( ) 51, 64
fppCtxShow( ) 51
fppCtxToRegs( ) 63
fppProbe( ) 50
FPPREG_SET 63
fppRegListShow( ) 51
fppRegsToCtx( ) 63
fppRestore( ) 63, 191
fppSave( ) 63, 191
fppTaskRegsGet( ) 64
fppTaskRegsSet( ) 64
fppXctxToRegs( ) 63
fppXregsToCtx( ) 63
fppXrestore( ) 63
fppXsave( ) 63
fpscrInitValue 191
fpscrSet( ) 190
fsubp 211
fsubrp 211
Fully Nested Mode 69
G
-G 0 96, 117, 212
G2_LE core 206
gbr( ) 172
GDT 66, 68
GDT_BASE_OFFSET 66
GDTR 59
Get( ) 55
routines
vx 56
vx 56
global descriptor table
see GDT
global variables
_func_vxMemProbeHook 8
Intel Architecture 49
intLockMask 58
ioApicBase 76
ioApicData 76
sysCoprocessor 50
sysCpuId 50
sysCsExc 50, 71
sysCsInt 50
sysCsSuper 50
sysIntIdtType 50, 70
sysPhysMemDescNumEnt 94, 95
sysProcessor 50
sysStrayIntCount 71
gnu 202
GNU assembler
-little 180
-relax 180
-small 180
SuperH-specific options 180
GNU compiler 146
compiling modules to use the AltiVec unit 137
compiling modules to use the SPE unit 143
enabling backtracing for ARM targets 5
enabling backtracing for XScale targets 22
-fno-omit-frame-pointer 5, 22
-G 0 96, 117, 212
-m4 179
-maltivec 137, 138
-mb 179
221
Index
VxWorks
Architecture Supplement, 6.2
-mbigtable 179
-mcpu=8540 213
-mcpu=power4 -Wa 137
-mdalign 179
-mieee 179
-mips2 213
-misize 179
-ml 179
-mlongcall 146, 209
-mlong-calls 208, 209
-mno-branch-likely 212
-mno-ieee 179
-mppc64bridge 137
-mrelax 179
-msdata 117
-O 212, 214
-O0 212, 214
small data area
PowerPC 117
SuperH-specific options 179
-Wa 137
GNU linker
-EB 180
-EL 180
SuperH-specific options 180
gp-rel addressing 96
H
hardware breakpoints
Intel Architecture 57
MIPS 89
SuperH 173
BSP requirements 175
hardware floating-point
MIPS 98
hexDec 60
HI 118
HIADJ 118
htons( ) 61
hWtx 138, 144
222
I
base 175
I/O APIC/xAPIC
Intel Architecture 76
i8259Intr.c 58
IA32_APIC_BASE 75
IDT
see interrupt descriptor table
IDT_INT_GATE 58
IDT_TASK_GATE 58
IDT_TRAP_GATE 58
IDTR 59
include file
MIPS board-specific 101
INCLUDE_440X5_DCACHE_RECOVERY 162
INCLUDE_440X5_MCH_LOGGER 162
INCLUDE_440X5_PARITY_RECOVERY 162
INCLUDE_440X5_TLB_RECOVERY 162
INCLUDE_440X5_TLB_RECOVERY_MAX 162
INCLUDE_CACHE_ENABLE 30, 153, 154
INCLUDE_CACHE_MODE 30
INCLUDE_CPU_LIGHT_PWR_MGR 80
INCLUDE_DEBUG 173
INCLUDE_EDR_PM 166
INCLUDE_EXC_EXTENDED_VECTORS 149
INCLUDE_EXC_HANDLING 162
INCLUDE_HW_FP 63, 190
INCLUDE_KERNEL 81, 166
INCLUDE_KERNEL_HARDENING 19, 44
INCLUDE_LOCK_TEXT_SECTION 189
INCLUDE_MAPPED_KERNEL 90, 93, 94
INCLUDE_MEMORY_CONFIG 17, 42, 81, 166
INCLUDE_MMU_BASIC 34, 66, 94, 95, 127, 162,
199
INCLUDE_PCI 68
INCLUDE_RTP 94
INCLUDE_SHOW_ROUTINES 34
INCLUDE_SM_OBJ 160
INCLUDE_SPE 140
INCLUDE_SW_FP 79
INCLUDE_SYS_HW_INIT_0 148
INCLUDE_WDB 17, 42, 81, 165
Index
instruction cache
PowerPC 153
XScale 30
instruction MMU
PowerPC 118
INT_NON_PREEMPT_MODEL 7, 24
INT_PREEMPT_MODEL 7, 24
intALib
ARM 6
XScale 24
intArchLib
ARM 6
Intel Architecture 58
MIPS 90
SuperH 177
XScale 24
intConnect( ) 10, 27, 100, 101, 177, 184
intDisable( ) 7, 25, 100, 178
Intel 8259 PIC 69
Intel Architecture 47
a.out and ELF-specific tools 59
Advanced Programmable Interrupt Controller
(APIC) 74
architecture considerations 60
architecture-specific global variables 49
architecture-specific routines 51
beginning-of-interrupt and end-of-interrupt
routines (BOI and EOI) 70
breakpoints and the bh( ) routine 57
cache 63
cacheLib 63
compiling modules for debugging 212
context switching 72
converting to network byte order (bigendian) 61
counters 73
disassembler, l( ) 58
error detection and reporting 66
exceptions 71
FPU exceptions 64
FPU support 63
getting and setting control register values 59
getting and setting the debug registers 59
getting and setting the EFLAGS register 59
getting and setting the task register 59
223
Index
VxWorks
Architecture Supplement, 6.2
supported processors 47
timestamp counter (TSC) 74
vxAlib 59
vxLib 59
VxWorks boot floppies 61
Intel StrongARM 31
Intel XScale
see XScale
intEnable( ) 7, 25, 100, 178
intEnt( ) 70, 71, 164
interface variations
ARM 4
Intel Architecture 49
MIPS 88
PowerPC 117
SuperH 172
XScale 22
interrupt conditions
acknowledging on MIPS processors 102
interrupt control modules 10, 27
interrupt controller
8259A interrupt controller 76
interrupt controller drivers 6, 24, 58, 69
interrupt descriptor table 70
interrupt handling
ARM 6
Intel Architecture 69
multiple interrupts
SuperH 184
VMEbus on MIPS processors 104
XScale 24, 27
interrupt inversion
MIPS 102
interrupt lock level
Intel Architecture 58
interrupt mode
Intel Architecture 71
interrupt stack
ARM 10
Intel Architecture 68
overflow and underflow protection
Intel Architecture 70
SuperH 185
XScale 28
224
interrupts
ARM 10
Intel Architecture 68
machine check interrupt 162
MIPS 99
NMI interrupt 69
normal and critical 161, 162
PowerPC 161
stack
size
SuperH 185
SuperH 183
intExit( ) 70, 71
intIFLock( ) 6, 24
intIFUnLock( ) 6, 24
intLevelSet( ) 90, 100, 177
intLibInit( ) 7, 24
intLock( ) 6, 24, 58, 69, 100, 178
intLockLevelGet( ) 7, 25
intLockLevelSet( ) 7, 25
intLockMask 58
intPrioTable 101, 102, 104, 105
intrCtl
ARM 10
Intel Architecture 58
XScale 27
intStackEnable( ) 51, 69
intUninitVecSet( ) 7, 25
intUnlock( ) 6, 24, 58, 69, 100
intVecBaseGet( ) 7, 25, 185
intVecBaseSet( ) 7, 25, 90, 101
intVecGet( ) 7, 25, 58
intVecGet2( ) 58
intVecSet( ) 7, 25, 58, 100, 101, 177
intVecSet2( ) 58
intVecShow( ) 7, 25
INUM_FPU_EXCEPTION 193
INUM_ILLEGAL_INST_GENERAL 193
INUM_ILLEGAL_INST_SLOT 193
INUM_READ_ADDRESS_ERROR 193
INUM_TLB_READ_MISS 192
INUM_TLB_READ_PROTECTED 193
INUM_TLB_WRITE_INITIAL_MISS 193
INUM_TLB_WRITE_MISS 192
INUM_TLB_WRITE_PROTECTED 193
Index
INUM_TRAP_1 193
INUM_WRITE_ADDRESS_ERROR
IOAPIC_BASE 75
ioApicBase 76
ioApicData 76
ioApicEnable( ) 77
ioApicIntr.c 58
ioApicIrqSet( ) 77
ioApicRed0_15 76
ioApicRed16_23 77
ioApicRedGet( ) 77
ioApicRedSet( ) 77
ioApicShow( ) 77
IRQ 11, 28
ISA/EISA bus
Intel Architecture 79
ISR_STACK_SIZE 71, 81, 166, 185
IV_ADEL_VEC 97
IV_ADES_VEC 97
IV_BP_VEC 97
IV_CPU_VEC 97
IV_DBUS_VEC 97
IV_FPA_DIV0_VEC 97
IV_FPA_INV_VEC 97
IV_FPA_OVF_VEC 98
IV_FPA_PREC_VEC 98
IV_FPA_UFL_VEC 98
IV_FPA_UNIMP_VEC 97
IV_IBUS_VEC 97
IV_RESVDINST_VEC 97
IV_SYSCALL_VEC 97
IV_TLBL_VEC 97
IV_TLBMOD_VEC 97
IV_TLBS_VEC 97
ivMips.h 100, 101
ivSh.h 177
J
jal 208
193
K
kernel build
configuration
MIPS default (unmapped) 92
MIPS mapped 93
MIPS mapped kernel details 93
MIPS mapped kernel precautions 94
kernel mode
MIPS 106
kernel text segment static mapping
MIPS 91
kernelInit( ) 100, 185
Index
L
l( ) 58
LDTR 59
libraries
cacheLib 63, 92, 153, 155
dbgArchLib 6, 23, 89, 172
dbgLib 5, 23, 173
excArchLib 176
excLib 105
intALib 6, 24
intArchLib 6, 24, 58, 90, 177
mathALib 49
mathLib 178
MIPS32sfdiable 96
MIPS32sfgnule 96
MIPS64diable 96
MIPS64gnule 96
pciConfigLib 79
pentiumALib 58
pentiumLib 58
pgMgrLib 193
taskArchLib 90
vmLib 5, 7, 23, 25, 107, 120, 156, 189
vxALib 8, 25, 59
vxLib 8, 26, 59, 129, 179
line allocation policy 32
-little 180
LOAPIC_BASE 75
loApicInit( ) 75, 76
225
VxWorks
Architecture Supplement, 6.2
loApicMpShow( ) 75
loApicShow( ) 75
local APIC timer
Intel Architecture 77
local APIC/xAPIC
Intel Architecture 74
LOCAL_MEM_AUTOSIZE 199
LOCAL_MEM_LOCAL_ADRS 17, 42, 66, 70, 81,
93, 94, 110, 166, 199
LOCAL_MEM_SIZE 110, 199
long long data type 113
M
-m4 179
mach( ) 172
machine check architecture 58, 72
machine check interrupt 161, 162
macl( ) 172
macros
ARMCACHE 15, 40
ARMMMU 15, 40
HI 118
HIADJ 118
INCLUDE_440X5_DCACHE_RECOVERY
162
INCLUDE_440X5_MCH_LOGGER 162
INCLUDE_440X5_PARITY_RECOVERY 162
INCLUDE_440X5_TLB_RECOVERY 162
INCLUDE_440X5_TLB_RECOVERY_MAX
162
INCLUDE_HW_FP 63, 190
ISR_STACK_SIZE 71, 81, 166, 185
make variables
CPU and TOOL 202
support for additional compiler options 207
Makefile
MIPS 90, 93, 110
PowerPC 210
-maltivec 137, 138
mapped kernel build details for MIPS 93
mapped kernel build precautions for MIPS 94
mapped kernels
MIPS 92
226
Index
MIPS 85
64-bit support 113
acknowledging the interrupt condition 102
AIM model for caches 92
AIM model for MMU 107
architecture considerations 95
building kernels 92
cache locking 92
cache support 91
cacheLib 92
compiling downloadable kernel modules 208
data segment alignment 91
dbgArchLib 89
debugging MIPS targets 96
default (unmapped) build configuration 92
exceptions 97
extended interrupts on the RM9000 104
floating-point support 98
gp-rel addressing 96
hardware breakpoints and the bh( ) routine 89
intArchLib 90
interface variations 88
interrupt inversion 102
interrupt support routines (ISRs) 100
interrupts 99
ISA level 86
kernel mode 106
kernel text segment static mapping 91
mapped build configuration 93
mapped kernel build details 93
mapped kernel build precautions 94
mapped kernel memory map 109
memory layout 110
mapped kernel 110
unmapped kernel 110
memory management unit (MMU) 90
-mips2 compiler option 213
MMU support 106
reference material 113
reserved registers 97
signal support 97
small data model support 212
supervisor mode 106
supported devices and libraries 86
supported processors 85
taskArchLib 90
tt( ) 89, 96
unmapped kernel memory map 108
virtual memory mapping 107
vmLib 107
MIPS VMEbus interrupt handling 104
-mips2 213
-mips3 213
MIPS32sf 86
MIPS32sfdiable 96
MIPS32sfgnule 96
MIPS64 86
MIPS64diable 96
MIPS64gnule 96
-misize 179
-ml 179
-mlongcall 146, 209
-mlong-calls 208, 209
MMU 13
AIM model
MIPS 107
PowerPC 156
SuperH 189
ARM 13
configurations
ARM 12
XScale 29
MIPS 90, 106
paging with Intel Architecture 66
PowerPC 118
SH-4-specific attributes 188
SuperH 185
default page size 185
translation model
PowerPC 119
valid MMU attribute combinations
for SH-4 196
XScale 30
MMU_ATTR_CACHE_COHERENCY 119, 129
MMU_ATTR_CACHE_COPYBACK 67
MMU_ATTR_CACHE_DEFAULT 119
MMU_ATTR_CACHE_GUARDED 119
MMU_ATTR_CACHE_OFF 67, 119, 129
MMU_ATTR_CACHE_WRITETHRU 119
MMU_ATTR_PROT_SUP_EXE 119
227
Index
VxWorks
Architecture Supplement, 6.2
MMU_ATTR_PROT_SUP_READ 119
MMU_ATTR_SPL_0 188
MMU_ATTR_SPL_1 188
MMU_ATTR_SPL_2 188
MMU_ATTR_SPL_3 188
MMU_ATTR_SUP_RWX 119
MMU_ATTR_VALID_NOT 189
MMU_STATE_CACHEABLE_MINICACHE
31, 33
mmu440Lib.h 126
mmu603Lib.h 121
mmuArm1136jfLibInstall( ) 15
mmuArm926eLibInstall( ) 15
mmuArmXScaleLibInstall( ) 40
mmuArmXSCALEPBit 35
mmuArmXSCALEPBitGet( ) 37
mmuArmXSCALEPBitSet( ) 35
mmuE500Lib.h 128
mmuLibInit( ) 39
mmuPArmXSCALEBitClear( ) 36
mmuPBitClear( ) 37
mmuPBitSet( ) 37
mmuPhysToVirt( ) 16, 40
mmuReadId( ) 8, 25
mmutypeLibInstall( ) 15, 39
mmuVirtToPhys( ) 16, 41
MMX technology 48
-mno-branch-likely 212
-mno-ieee 179
model specific register 58, 73
MPC744X
CPU variants 206
MPC745X
CPU variants 206
MPC827X
CPU variants 206
MPC828X
CPU variants 206
MPC834X
CPU variants 206
MPC836X
CPU variants 206
MPC85XX
exceptions and interrupts 161, 162
floating-point support 158
228
N
network byte order 61
NMI interrupt 69
non-preemptive mode
ARM 7
XScale 24
null dereference pointer detection
SuperH 189
NUM_L1_DESCS 34
O
-O 212, 214
-O0 212, 214
objcopypentium 60
operating mode
Intel Architecture 61
SuperH 181
OSM stack 70
Index
P
P bit 31
setting in virtual memory regions 37
setting in VxWorks 34
P5 architecture 48, 63
model-specific registers (MSRs) 73
performance monitoring counters (PMCs) 73
timestamp counter (TSC) 74
P6 architecture 48, 63
I/O APIC/xAPIC module 76
local APIC/xAPIC module 74
memory type range registers (MTRRs) 72
MMU 67
model-specific registers (MSRs) 73
performance monitoring counters (PMCs) 73
timestamp counter (TSC) 74
P7 architecture 48, 63
I/O APIC/xAPIC module 76
local APIC/xAPIC module 74
memory type range registers (MTRRs) 72
MMU 67
model-specific registers (MSRs) 73
timestamp counter (TSC) 74
pBRCR 175
PC104 bus
Intel Architecture 79
PCI bus
Intel Architecture 79
pciConfigLib
Intel Architecture 79
pciIntConnect( ) 100
Pentium
see Intel Architecture
Pentium II 63
Pentium III 63
Pentium M 62
model-specific registers (MSRs) 73
supported chipset 62
pentiumALib 58
pentiumBtc( ) 51
pentiumBts( ) 51
pentiumLib 58
pentiumMcaEnable( ) 51, 72
pentiumMcaShow( ) 51
pentiumMsrGet( ) 52, 72
pentiumMsrInit( ) 52
pentiumMsrSet( ) 52, 72
pentiumMsrShow( ) 52
pentiumMtrrDisable( ) 52
pentiumMtrrEnable( ) 52
pentiumMtrrGet( ) 52
pentiumMtrrSet( ) 52
pentiumPmcGet( ) 53
pentiumPmcGet0( ) 53
pentiumPmcGet1( ) 53
pentiumPmcReset( ) 53
pentiumPmcReset0( ) 53
pentiumPmcReset1( ) 53
pentiumPmcShow( ) 53
pentiumPmcStart( ) 52
pentiumPmcStart0( ) 52
pentiumPmcStart1( ) 52
pentiumPmcStop( ) 52
pentiumPmcStop0( ) 53
pentiumPmcStop1( ) 53
PentiumPro 63
pentiumSerialize( ) 53
pentiumTlbFlush( ) 53
pentiumTscGet32( ) 53
pentiumTscGet64( ) 53
pentiumTscReset( ) 53
PERF_MON
see performance monitor
performance
PowerPC 405 124
PowerPC 440 126
performance monitor (PERF_MON) 165
performance monitoring counter 58, 73
periodic interval timer 164
pgMgrLib
SuperH 193
PIT
see periodic interval timer
PIT0_FOR_AUX 77
PM_RESERVED_MEM 166
PMC 58
see performance monitoring counter 58
power management
Intel Architecture 59, 79
229
Index
VxWorks
Architecture Supplement, 6.2
PowerPC 166
SuperH 191
support for SH-4A processors 192
PowerPC 115
26-bit address offset branching 146
AIM Model for caches 155
AIM model for MMU 156
alignment constraints for SPE stack frames
142
AltiVec support 130
architecture considerations 144
branching across large address ranges 146
build mechanism 168
building applications
backward compatibility 207
byte order 149
C language extensions for vector types
(AltiVec) 134
C language extensions for vector types
(SPE) 142
C++ exception handling and AltiVec support
138
cache coherency 119
cache information 153
cacheLib 153, 155
compiling downloadable kernel modules 209
compiling modules for debugging 214
compiling modules for RTP applications 210
compiling modules to use the AltiVec unit
(GNU compiler) 137
compiling modules to use the AltiVec unit
(Wind River Compiler) 136
compiling modules to use the SPE unit
(GNU compiler) 143
compiling modules to use the SPE unit
(Wind River Compiler) 143
configuring VMEbus TAS 160
coprocessor abstraction 129
CPU_VARIANT 206
divide-by-zero handling 145
enabling additional BATs 121
error detection and reporting 166
exception vector table (EVT) 166
exceptions and interrupts 161
excVecGet( ) and excVecSet( ) 164
230
Index
PowerPC 970
see also AltiVec
architecture-specific routines 131
cache 155
floating-point support 159
hardware breakpoints 151
VxWorks run-time support for 130
PowerQUICC Pro 206
PPC_FPSCR_VE 159
PPC32 168, 210
pr( ) 172
preemptive mode
ARM 7
XScale 24
printf( ) 134, 137, 143
processor mode
ARM 9
XScale 26
project builds
enabling extended-call exception vectors 149
psrShow( ) 6, 23
R
r0( ) 172
RAM_HI_ADRS 110
RAM_HIGH_ADRS 93, 94, 111
RAM_LOW_ADRS 93, 94, 110, 111
real-time processes
see RTPs
reference material
ARM 20
Intel Architecture 84
MIPS 113
PowerPC 169
SuperH 200
XScale 44
register routines
Intel Architecture 56
SuperH 172
register usage
PowerPC 151
SuperH 182
231
Index
VxWorks
Architecture Supplement, 6.2
registers
Intel Architecture 72
PowerPC 152
-relax 180
Renesas SuperH
see SuperH
reserved registers
MIPS 97
resetEntry( ) 125, 127
ring level protection
Intel Architecture 68
RM9000
extended interrupts 104
ROM_TEXT_ADRS 110
romInit( ) 120, 125
SuperH 185
romInit.s
ARM 14
PowerPC 125, 127
XScale 39
routines
altivecInit( ) 131
altivecProbe( ) 130, 131
altivecRestore( ) 131
altivecSave( ) 131
altivecTaskRegsGet( ) 131
altivecTaskRegsSet( ) 131
altivecTaskRegsShow( ) 131
b( ) 173
bh( ) 57, 89, 149, 173
cacheArm1136jfLibInstall( ) 15
cacheArm926eLibInstall( ) 15
cacheArmXScaleLibInstall( ) 40
cacheClear( ) 13, 30, 155
cacheDisable( ) 91
cacheEnable( ) 14, 38, 91, 155
cacheInvalidate( ) 13, 30
cacheLibInit( ) 16, 41
cacheLock( ) 5, 13, 30
cacheUnlock( ) 5, 13, 30
coprocTaskRegsGet( ) 63
coprocTaskRegsSet( ) 63
cpsr( ) 6, 24
cpuPwrMgrEnable( ) 80
cpuPwrMgrIsEnabled( ) 80
232
cret( ) 4, 22
eax( ) 56
ebp( ) 56
ebx( ) 56
ecx( ) 56
edi( ) 56
edx( ) 56
eflags( ) 56
esi( ) 56
esp( ) 56
excBErrVecInit( ) 176
excConnect( ) 161, 162
excCrtConnect( ) 161, 162
excEnt( ) 164
excInit( ) 164
excIntConnect( ) 161, 162
excIntConnectTimer( ) 161, 164
excIntCrtConnect( ) 161, 162
excMchkConnect( ) 162
excVecGet( ) 10, 28, 164
excVecInit( ) 148, 149, 164
excVecSet( ) 10, 28, 161, 164
fppArchInit( ) 63
fppArchSwitchHook( ) 64
fppArchSwitchHookEnable( ) 51, 64
fppCtxShow( ) 51
fppCtxToRegs( ) 63
fppProbe( ) 50
fppRegListShow( ) 51
fppRegsToCtx( ) 63
fppRestore( ) 63, 191
fppSave( ) 63, 191
fppTaskRegsGet( ) 64
fppTaskRegsSet( ) 64
fppXctxToRegs( ) 63
fppXregsToCtx( ) 63
fppXrestore( ) 63
fppXsave( ) 63
fpscrSet( ) 190
gbr( ) 172
htons( ) 61
intConnect( ) 10, 27, 100, 101, 177, 184
intDisable( ) 7, 25, 100, 178
Intel Architecture 51
register routines 56
Index
pentiumMcaEnable( ) 51, 72
pentiumMcaShow( ) 51
pentiumMsrGet( ) 52, 72
pentiumMsrInit( ) 52
pentiumMsrSet( ) 52, 72
pentiumMsrShow( ) 52
pentiumMtrrDisable( ) 52
pentiumMtrrEnable( ) 52
pentiumMtrrGet( ) 52
pentiumMtrrSet( ) 52
pentiumPmcGet( ) 53
pentiumPmcGet0( ) 53
pentiumPmcGet1( ) 53
pentiumPmcReset( ) 53
pentiumPmcReset0( ) 53
pentiumPmcReset1( ) 53
pentiumPmcShow( ) 53
pentiumPmcStart( ) 52
pentiumPmcStart0( ) 52
pentiumPmcStart1( ) 52
pentiumPmcStop( ) 52
pentiumPmcStop0( ) 53
pentiumPmcStop1( ) 53
pentiumSerialize( ) 53
pentiumTlbFlush( ) 53
pentiumTscGet32( ) 53
pentiumTscGet64( ) 53
pentiumTscReset( ) 53
pr( ) 172
printf( ) 134, 137, 143
processor-specific ARM cache and MMU
routines 15
processor-specific XScale cache and MMU
routines 40
psrShow( ) 6, 23
r0( ) 172
resetEntry( ) 125, 127
romInit( ) 120, 125
scanf( ) 134, 137, 143
semTake( ) 100
speInit( ) 140
speProbe( ) 140
speRestore( ) 141
speSave( ) 141
speTaskRegsShow( ) 141
233
Index
VxWorks
Architecture Supplement, 6.2
sr( ) 172
sysAutoAck( ) 102
sysAuxClkRateSet( ) 77
sysBusIntAck( ) 104
sysBusTas( ) 129, 160, 179
sysBusTasClear( ) 160
sysClkRateSet( ) 77
sysCpuProbe( ) 50, 54
sysDelay( ) 55
sysInByte( ) 54, 78
sysInLong( ) 54, 78
sysInLongString( ) 54, 78
sysIntConnect( ) 177
sysIntDisablePIC( ) 55, 69
sysIntEnablePIC( ) 55, 69
sysInWord( ) 54, 78
sysInWordString( ) 54, 78
sysMemTop( ) 17, 42, 68, 81, 166
sysOSMTaskGateInit( ) 55
sysOutByte( ) 54, 78
sysOutLong( ) 54, 78
sysOutLongString( ) 54, 78
sysOutWord( ) 54, 78
sysOutWordString( ) 54, 78
sysUbcInit( ) 175
taskDelay( ) 100
taskSpawn( ) 131, 141
taskSRInit( ) 90, 100
taskSRSet( ) 59
tt( ) 4, 22, 89
usrInit( ) 17, 42, 81, 165, 185, 197
usrRoot( ) 17, 42, 81, 165, 190, 197
usrSpeInit( ) 140
vbr( ) 172
vec_calloc( ) 132
vec_free( ) 132
vec_malloc( ) 132
vec_realloc( ) 132
vmContextShow( ) 34
vmLibInit( ) 16, 41
vmPageLock( ) 107, 156, 185, 189
vmPageOptimize( ) 156
vmStateSet( ) 33
vxCpuShow( ) 55, 59, 61, 62
vxCr0Get( ) 59
234
vxCr2Get( ) 59
vxCr3Get( ) 59
vxCr4Get( ) 59
vxCsGet( ) 59
vxDrGet( ) 55, 59
vxDrSet( ) 55, 59
vxDrShow( ) 55, 59
vxDsGet( ) 59
vxEflagsGet( ) 56, 59
vxEflagsSet( ) 56, 59
vxFpscrGet( ) 159
vxFpscrSet( ) 159
vxGdtrGet( ) 59
vxIdtrGet( ) 59
vxLdtrGet( ) 59
vxLdtrSet( ) 59
vxMemProbe( ) 8, 26, 58, 179
vxMsrGet( ) 159
vxMsrSet( ) 159
vxPowerModeGet( ) 56, 59, 80
vxPowerModeSet( ) 56, 59, 80, 192
vxSseShow( ) 56
vxSsGet( ) 59
vxTas( ) 8, 25, 129, 179
vxTssGet( ) 56, 59
vxTssSet( ) 56, 59
workQPanic( ) 100, 102
WTX API routines for AltiVec support 138
WTX API routines for SPE support 144
wtxTargetHasAltivecGet( ) 138
wtxTargetHasSpeGet( ) 144
RTPs
CPU and TOOL definitions for PowerPC 169
Intel Architecture 66
limitation on MPC8XX 129
maximum number for SuperH targets 189
PowerPC 119
rules.rtp 211
run-time support
AltiVec 130
MPC85XX 127
PowerPC 440 125
PowerPC 970 130
VxWorks run-time support for the SPE 140
Index
S
scanf( ) 134, 137, 143
SDA
see small data area
segment model
PowerPC 603/604 122
segmentation
Intel Architecture 66
SELECT_MMU 118
semTake( ) 100
Set( ) 55
setting the P bit
in virtual memory regions 37
in VxWorks (XScale) 34
SH7751
on-chip PCI window mapping 193
SIGBUS 97
SIGFPE 97, 193
SIGILL 97, 193
signal processing engine
see SPE 140
signal support
MIPS 97
SuperH 192
SIGSEGV 97, 192
SIGTRAP 97
SIMD processing unit 140
SM_ANCHOR_OFFSET 19, 44
SM_OFF_BOARD 161
SM_TAS_HARD 160
SM_TAS_TYPE 160
-small 180
small data area
PowerPC 117
software breakpoints
ARM 5
Intel Architecture 57
SuperH 173
XScale 23
SPE
alignment constraints for stack frames 142
compiling modules with the GNU compiler
143
235
Index
VxWorks
Architecture Supplement, 6.2
236
194
Index
sysHwInit0( )
ARM 16
PowerPC 148
XScale 37, 41
sysHwInit2( )
ARM 7
XScale 24
sysInByte( ) 54, 78
sysInLong( ) 54, 78
sysInLongString( ) 54, 78
sysIntConnect( ) 177
sysIntDisablePIC( ) 55, 69
sysIntEnablePIC( ) 55, 69
sysIntIdtType 50, 70
sysInWord( ) 54, 78
sysInWordString( ) 54, 78
sysLib.c
ARM 12, 13, 14
Intel Architecture 49, 67
MIPS 94, 101, 104
PowerPC 119, 121, 125, 127, 153
SuperH 189
XScale 30, 31, 37, 39, 41
sysMemTop( ) 17, 42, 68, 81, 166
sysMinicacheFlushReadArea 39
sysOSMTaskGateInit( ) 55
sysOutByte( ) 54, 78
sysOutLong( ) 54, 78
sysOutLongString( ) 54, 78
sysOutWord( ) 54, 78
sysOutWordString( ) 54, 78
sysPhysMemDescNumEnt 94, 95
sysProcessor 50
sysStrayIntCount 71
sysUbcInit( ) 175
T
-t 96
T2_BOOTROM_COMPATIBILITY 19, 44
target.ref
Intel Architecture 61
SuperH 199
TAS 160
tas.b 179
taskArchLib
MIPS 90
taskDelay( ) 100
taskSpawn( ) 131, 141
taskSRInit( ) 90, 100
taskSRSet( ) 59
Thumb instruction set 3, 9, 27
timestamp counter 58, 74
TLB 91, 106
see also translation lookaside buffer (TLB)
TOOL 202
-tPPC7400FV 136
-tPPC970FV 136
-tPPCE500FF 213
-tPPCE500FG 213
-tPPCE500FS 158
translation lookaside buffer (TLB) 91, 106, 185
TSC
see timestamp counter
-tSH4EH 180
-tSH4LH 180
tt( ) 4, 22, 89, 96, 173
type extension (TEX) field 32
U
unaligned accesses
ARM 9
XScale 27
unmapped kernels
MIPS 92
USER_D_CACHE_ENABLE 30, 153, 154
USER_D_CACHE_MODE 13, 162, 187
USER_D_MMU_ENABLE 118, 154
USER_I_CACHE_ENABLE 30, 153, 154
USER_I_CACHE_MODE 13, 30
USER_I_MMU_ENABLE 118, 124, 126, 154
usrConfig.c
SuperH 190
usrInit( ) 17, 42, 81, 165, 185, 197
usrRoot( ) 17, 42, 81, 140, 165, 190, 197
usrSpe.c 140
usrSpeInit( ) 140
237
Index
VxWorks
Architecture Supplement, 6.2
V
vbr( ) 172
VEC_BASE_ADRS 185
vec_calloc( ) 132
vec_free( ) 132
vec_malloc( ) 132
vec_realloc( ) 132
vector data types
AltiVec 134
SPE 142
vector format conversion specifications
AltiVec 134
SPE 143
vector types
C language extensions
AltiVec 134
SPE 142
formatted input and output
AltiVec 134
SPE 143
virtual memory mapping
MIPS 107
SuperH 194
VIRTUAL_WIRE_MODE 75
VM_PAGE_SIZE 68, 185
VM_STATE_CACHEABLE 119
VM_STATE_CACHEABLE_MINICACHE 31, 33
VM_STATE_CACHEABLE_NOT 67, 119, 129
VM_STATE_CACHEABLE_WRITETHROUGH
119
VM_STATE_EX_BUFFERABLE 33, 34
VM_STATE_EX_BUFFERABLE_NOT 33, 34
VM_STATE_EX_CACHEABLE 33, 34
VM_STATE_EX_CACHEABLE_NOT 33, 34
VM_STATE_GLOBAL 67
VM_STATE_GLOBAL_NOT 67
VM_STATE_GUARDED 119
VM_STATE_MASK_EX_BUFFERABLE 33
VM_STATE_MASK_EX_CACHEABLE 33
VM_STATE_MEM_COHERENCY 119, 129
VM_STATE_VALID_NOT 189
VM_STATE_WBACK 67
VM_STATE_WRITEABLE 119
VM_STATE_WRITEABLE_NOT 119
238
vmContextShow( ) 34
VME
Intel Architecture 78
VMEbus
configuring TAS 160
interrupt handling on MIPS 104
vmLib
ARM 5, 7
MIPS 107
PowerPC 120, 156
SuperH 189
XScale 23, 25
vmLib.h
XScale 33
vmLibInit( ) 16, 41
vmPageLock( ) 107, 156, 185, 189
vmPageOptimize( ) 156
vmStateSet( ) 33
VX_ALTIVEC_TASK 129, 130
VX_FP_TASK 64, 65, 99, 129, 145, 159, 190, 191
VX_POWER_MODE_DEEP_SLEEP 192
VX_POWER_MODE_DISABLE 192
VX_POWER_MODE_SLEEP 192
VX_POWER_MODE_USER 192
VX_SPE_TASK 129, 140, 145
vxALib
ARM 8
Intel Architecture 59
XScale 25
vxCpuShow( ) 55, 59, 61, 62
vxCr0Get( ) 59
vxCr2Get( ) 59
vxCr3Get( ) 59
vxCr4Get( ) 59
vxCsGet( ) 59
vxDrGet( ) 55, 59
vxDrSet( ) 55, 59
vxDrShow( ) 55, 59
vxDsGet( ) 59
vxEflagsGet( ) 56, 59
vxEflagsSet( ) 56, 59
vxFpscrGet( ) 159
vxFpscrSet( ) 159
vxGdtrGet( ) 59
vxIdtrGet( ) 59
Index
vxLdtrGet( ) 59
vxLdtrSet( ) 59
vxLib
ARM 8
Intel Architecture 59
PowerPC 129
SuperH 179
XScale 26
vxMemProbe( ) 8, 26, 58, 179
VxMP 160
support for Motorola PowerPC boards 160
vxMsrGet( ) 159
vxMsrSet( ) 159
vxPowerModeGet( ) 56, 59, 80
vxPowerModeSet( ) 56, 59, 80, 192
vxprj 201
vxSseShow( ) 56
vxSsGet( ) 59
vxTas( ) 8, 25, 129, 179
vxTssGet( ) 56, 59
vxTssSet( ) 56, 59
W
-Wa 137
watchpoints 89
WDB memory pool
increasing the size on PowerPC 147
WDB_POOL_SIZE 17, 42, 81, 147, 165
Wind River assembler
SuperH-specific options 180
-Xalign-power2 180
Wind River Compiler
branching across large address ranges 147
compiling modules to use the AltiVec unit 136
compiling modules to use the SPE unit 143
enabling backtracing for ARM targets 5
enabling backtracing for XScale targets 22
small data area, PowerPC 117
SuperH-specific options 180
-t 96
-tPPC7400FV 136
-tPPC970FV 136
-tPPCE500FF 213
-tPPCE500FG 213
-tPPCE500FS 158
-tSH4EH 180
-tSH4LH 180
-Xcode-absolute-far 208, 209
-Xemul-gnu-bug 211
-Xkeywords 136
-Xno-optimized-debug 212, 214
-XO 212, 214
-Xsmall-const 117
-Xsmall-data 117
Wind River linker
SuperH-specific options 181
workQPanic( ) 100, 102
write policy 32
wtxTargetHasAltivecGet( ) 138
wtxTargetHasSpeGet( ) 144
X
X bit 31
-Xalign-power2 180
XB- 34
XB+ 34
XC- 34
XC+ 34
-Xcode-absolute-far 208, 209
-Xemul-gnu-bug 211
-Xkeywords 136
XMM registers 65
-Xno-optimized-debug 212, 214
-XO 212, 214
XScale 21
see also ARM
architecture considerations 26
BSP considerations for cache and MMU 40
BSP migration 42
VxWorks 5.5 compatibility 42
byte order 27
cache and memory management interaction
38
cache and MMU routines for individual
processor types 40
cache coherency 30
239
Index
VxWorks
Architecture Supplement, 6.2
cacheLib 23, 25
caches 29
compiling downloadable kernel modules 208
controlling the CPU interrupt mask 24
cret( ) 22
data cache 30
dbgArchLib 23
dbgLib 23
defining cache and MMU types in the BSP 40
divide-by-zero handling 28
enabling backtracing 22
FIQ 28
floating-point library 29
floating-point support 28
hardware-assisted debugger compatibility 23
initializing the interrupt architecture library
24
instruction cache 30
intALib 24
intArchLib 24
interface variations 22
interrupt handling 24, 27
non-preemptive mode 24
preemptive mode 24
interrupt stack 28
interrupts and exceptions 27
IRQ 28
memory layout 41
memory management extensions and
VxWorks 31
MMU 30
P bit 31
processor mode 26
providing an alternate routine for
vxMemProbe( ) 26
reference material 44
supported cache and MMU configurations 29
supported instruction sets 27
supported processors 22
tt( ) 22
type extension (TEX) field 32
unaligned accesses 27
vmLib 23, 25
vxALib 25
vxLib 26
240
X bit 31
-Xsmall-const 117
-Xsmall-data 117
xsymDec 60