📄 sysphysmemdescshow.c
字号:
/* sysPhysMemDesc.c - a program to display current contents of sysPhysMemDesc */
/* Copyright 1984-2000 Wind River Systems, Inc. */
/*
modification history
--------------------
01b,03mar00,cmf added display for flags and ppc and x86 arch specifics
and comments/coding conventions
01a,02mar00,spn written
*/
/*
DESCRIPTION:
This library is provided by Wind River Systems Customer
Support strictly as an educational example.
This provides the functionality to display the contents of the
sysPhysMemDesc array. This can be useful in debugging windowing
problems and problems adding devices using sysMmuMapAdd
Architecture specific macro defines have only been added for
PowerPc and X86. If using this on another architecture, customer
should check /target/h/vmLib.h for additional flags for their
architecture
*/
/*includes*/
#include <vxWorks.h>
#include <stdio.h>
#include <vmLib.h>
/*globals*/
IMPORT PHYS_MEM_DESC sysPhysMemDesc[];
IMPORT int sysPhysMemDescNumEnt;
/*forward declarations*/
void sysPhysMemDescShow (void);
/****************************************************************************
* sysPhysMemDescShow
*
* dump contents of sysPhysMemDesc array
****************************************************************************/
void sysPhysMemDescShow (void)
{
UINT32 i;
UINT32 virtualAddr;
UINT32 physicalAddr;
UINT32 len;
UINT32 initialStateMask;
UINT32 initialState;
UINT32 checkState;
for (i = 0; i < sysPhysMemDescNumEnt; i++)
{
virtualAddr = (UINT32) sysPhysMemDesc[i].virtualAddr;
physicalAddr = (UINT32) sysPhysMemDesc[i].physicalAddr;
len = (UINT32) sysPhysMemDesc[i].len;
initialStateMask = (UINT32) sysPhysMemDesc[i].initialStateMask;
initialState = (UINT32) sysPhysMemDesc[i].initialState;
printf ("sysPhysMemDesc[%d].virtualAddr = 0x%x\n", i, virtualAddr);
printf ("sysPhysMemDesc[%d].physicalAddr = 0x%x\n", i, physicalAddr);
printf ("sysPhysMemDesc[%d].len = 0x%x\n", i, len);
printf ("sysPhysMemDesc[%d].initialStateMask = 0x%x\n", i, initialStateMask);
printf ("sysPhysMemDesc[%d].initialState = 0x%x\n", i, initialState);
((initialState & VM_STATE_VALID) == 0x1)
? printf ("\t\tVM_STATE_VALID") : printf ("\t\tVM_STATE_VALID_NOT");
((initialState & VM_STATE_WRITABLE) == 0x4)
? printf (" | VM_STATE_WRITABLE") : printf ("VM_STATE_WRITABLE_NOT");
((initialState & VM_STATE_CACHEABLE) == 0x10)
? printf (" | VM_STATE_CACHEABLE\n") : printf (" | VM_STATE_CACHEABLE_NOT\n");
#if (CPU_FAMILY==I80X86)
((initialState & VM_STATE_WBACK) == 0x40)
? printf ("\t\t\t | VM_STATE_WBACK") : printf ("\t\t\t | VM_STATE_WBACK_NOT");
((initialState & VM_STATE_GLOBAL) == 0x80)
? printf (" | VM_STATE_GLOBAL") : printf (" | VM_STATE_GLOBAL_NOT");
checkState = initialState & ~(0xD5);
if (checkState != 0x00) printf ("Bad Flags in initial state - %x\n", checkState);
#endif /*CPU_FAMILY==80X86*/
#if (CPU_FAMILY==PPC)
((initialState & VM_STATE_MEM_COHERENCY) == 0x40)
? printf ("\t\t\t | VM_STATE_MEM_COHERENCY") : printf ("\t\t\t | VM_STATE_MEM_COHERENCY_NOT");
((initialState & VM_STATE_GUARDED) == 0x80)
? printf (" | VM_STATE_GUARDED") : printf (" | VM_STATE_GUARDED");
((initialState & VM_STATE_ACCESS_NOT) == 0x8)
? printf (" | VM_STATE_ACCESS_NOT") : printf ("");
checkState = initialState & ~(0xDD);
if (checkState != 0x00) printf ("Bad Flags in initial state - %x\n", checkState);
#endif /* (CPU_FAMILY==PPC) */
printf ("\n\n");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -