7.3   Virtual Memory Configuration

The following discussion of configuration applies to both bundled and unbundled virtual memory support.

In the project facility, define the constants in Table 7-1 to reflect your system configuration.

Table 7-1:  MMU Configuration Constants


Constant
Description

INCLUDE_MMU_BASIC  
Basic MMU support without VxVMI option. 
INCLUDE_MMU_FULL  
Full MMU support with the VxVMI option. 
INCLUDE_PROTECT_TEXT  
Text segment protection (requires full MMU support). 
INCLUDE_PROTECT_VEC_TABLE  
Exception vector table protection (requires full MMU support). 

The appropriate default page size for your processor (4 KB or 8KB) is defined by VM_PAGE_SIZE in your BSP. If you must change this value for some reason, redefine VM_PAGE_SIZE in config.h. (See 8. Configuration and Build.)

To make memory noncacheable, it must have a virtual-to-physical mapping. The data structure PHYS_MEM_DESC in vmLib.h defines the parameters used for mapping physical memory. Each board's memory map is defined in sysLib.c using sysPhysMemDesc (which is declared as an array of PHYS_MEM_DESC). In addition to defining the initial state of the memory pages, the sysPhysMemDesc structure defines the virtual addresses used for mapping virtual-to-physical memory. For a discussion of page states, see Page States.

Modify the sysPhysMemDesc structure to reflect your system configuration. For example, you may need to add the addresses of interprocessor communication buffers not already included in the structure. Or, you may need to map and make noncacheable the VMEbus addresses of the shared-memory data structures. Most board support packages have a section of VME space defined in sysPhysMemDesc; however, this may not include all the space required by your system configuration.

I/O devices and memory not already included in the structure must also be mapped and made noncacheable. In general, off-board memory regions are specified as noncacheable; see VxWorks Network Programmer's Guide: Data Link Layer Network Components.


*

CAUTION: The regions of memory defined in sysPhysMemDesc must be page-aligned, and must span complete pages. In other words, the first three fields (virtual address, physical address, and length) of a PHYS_MEM_DESC structure must all be even multiples of VM_PAGE_SIZE. Specifying elements of sysPhysMemDesc that are not page-aligned leads to crashes during VxWorks initialization.

The following example configuration consists of multiple CPUs using the shared-memory network. A separate memory board is used for the shared-memory pool. Because this memory is not already mapped, it must be added to sysPhysMemDesc for all the boards on the network. The memory starts at 0x4000000 and must be made noncacheable, as shown in the following code excerpt:

/* shared memory */ 
{ 
(void *) 0x4000000,         /* virtual address */ 
(void *) 0x4000000,         /* physical address */ 
0x20000,              /* length */ 
/* initial state mask */ 
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE |VM_STATE_MASK_CACHEABLE, 
/* initial state */ 
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT 
}

For MC680x0 boards, the virtual address must be the same as the physical address. For other boards, the virtual and physical addresses are the same as a matter of convention.