去掉MMU的话,不行,程序都跑得不对了,我用syslib.c中的相同映像表,放在我demo板上一个工程里面跑,VxWorks镜像启动后,是可以访问d 0xf0040000的,映像表如下:
UINT32 sysBatDesc [2 * (_MMU_NUM_IBAT + _MMU_NUM_DBAT)] =
{
/* I BAT 0 */
((0xf8000000 & _MMU_UBAT_BEPI_MASK) | _MMU_UBAT_BL_32M |
_MMU_UBAT_VS | _MMU_UBAT_VP),
((0xf8000000 & _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 */
0, 0,
/* D BAT 0 */
((0xf8000000 & _MMU_UBAT_BEPI_MASK) | _MMU_UBAT_BL_32M |
_MMU_UBAT_VS | _MMU_UBAT_VP),
((0xf8000000 & _MMU_LBAT_BRPN_MASK) | _MMU_LBAT_PP_RW |
_MMU_LBAT_CACHE_INHIBIT),
/*0, 0,*/
/* D BAT 1 */
/* use DBAT1 to map CPM DPRAM and internal registers into data space */
/* NOTE! the internal space cannot be cached and should be guarded */
((0xF0000000 & _MMU_UBAT_BEPI_MASK) | _MMU_UBAT_BL_128K |
_MMU_UBAT_VS | _MMU_UBAT_VP),
((0xF0000000 & _MMU_LBAT_BRPN_MASK) | _MMU_LBAT_PP_RW |
_MMU_LBAT_CACHE_INHIBIT | _MMU_LBAT_GUARDED),
/* D BAT 2 */
0,0,
/* D BAT 3 */
0,0
};
/*
* sysPhysMemDesc[] is used to initialize the Page Table Entry (PTE) array
* used by the MMU to translate addresses with single page (4k) granularity.
* PTE memory space should not, in general, overlap BAT memory space but
* may be allowed if only Data or Instruction access is mapped via BAT.
*
* Address translations for local RAM, memory mapped PCI bus, the Board Control and
* Status registers, the MPC8260 Internal Memory Map, and local FLASH RAM are set here.
*
* PTEs are held, strangely enough, in a Page Table. Page Table sizes are
* integer powers of two based on amount of memory to be mapped and a
* minimum size of 64 kbytes. The MINIMUM recommended Page Table sizes
* for 32-bit PowerPCs are:
*
* Total mapped memory Page Table size
* ------------------- ---------------
* 8 Meg 64 K
* 16 Meg 128 K
* 32 Meg 256 K
* 64 Meg 512 K
* 128 Meg 1 Meg
* . .
* . .
* . .
*
* [Ref: chapter 7, PowerPC Microprocessor Family: The Programming Environments]
*
*/
PHYS_MEM_DESC sysPhysMemDesc [] =
{
{
/* Vector Table and Interrupt Stack */
(void *) 0x00000000,
(void *) 0x00000000,
0x00010000,
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT
},
{
/* RAM on 60x bus - Must be second entry for Auto Sizing */
(void *) 0x00010000,
(void *) 0x00010000,
0x08000000 - 0x00010000,
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE |
VM_STATE_MASK_CACHEABLE | VM_STATE_MASK_MEM_COHERENCY,
VM_STATE_VALID | VM_STATE_WRITABLE |
VM_STATE_CACHEABLE | VM_STATE_MEM_COHERENCY
},
{
/* MPC8260 Internal Memory Map */
(void *) 0xf000000,/*0xf000000*/
(void *) 0xf000000,
0x20000,/*0x20000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
/* MPC8272 HPI Memory Map */
(void *) 0x0d000000,/*0x0d000000*/
(void *) 0x0d000000,
0x100000,/*0x100000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
/* MPC8272 fpga0 Memory Map */
(void *) 0x0e000000,/*0x0e000000*/
(void *) 0x0e000000,
0x40000,/*0x40000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
#if 1
{
/* MPC8272 fpga1 Memory Map */
(void *) 0x0f000000,/*0x0f000000*/
(void *) 0x0f000000,
0x100000,/*0x100000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
#endif
{
/* MPC8272 coder Memory Map */
(void *) 0x0A000000,/*0x0A000000*/
(void *) 0x0A000000,
0x100000,/*0x100000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
/* MPC8272 decoder Memory Map */
(void *) 0x0c000000,/*0x0c000000*/
(void *) 0x0c000000,
0x100000,/*0x100000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
#ifdef INCLUDE_PCI
{
(void*)0x80000000,/*0x80000000*/
(void*)0x80000000,
0x01000000,/*0x01000000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
(void*)0x90000000,/*0x90000000*/
(void*)0x90000000,
0x01000000,/*0x01000000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
(void*)0xa0000000,/*0xa0000000*/
(void*)0xa0000000,
0x00100000,/*0x00100000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
/* MPC8266 PCI Interrupt Controller */
(void *) 0x4730000,/* 0x4730000*/
(void *) 0x4730000,
0x10000,/*0x10000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
/* MPC8260 Internal Memory Map */
(void *) 0x4800000, /*0x4800000*/
(void *) 0x4800000,
0x10000,/*0x10000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
#endif
#ifdef INCLUDE_SECURITY_ENGINE
{
(void *) 0xf0040000,/*0xf0040000*/
(void *) 0xf0040000,
0x20000,/*0x20000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
#endif INCLUDE_SECURITY_ENGINE
#if 1 /*CTDB_MPC8280*/
{
/* BIOS */
(void *) 0xfff00000,/*0xfff00000*/
(void *) 0xfff00000,
0x100000,/*0x100000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
{
/* Flash */
(void *) 0xf8000000,/*0xf8000000 */
(void *) 0xf8000000,
0x4000000,/*0x4000000*/
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
#endif
};