114 lines
3.5 KiB
C
114 lines
3.5 KiB
C
/* aimMmuBaseLib.c - MMU Architecture Independent Manager */
|
|
|
|
/* Copyright 2004, 2005, 2012 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify or otherwise make use
|
|
* of this software may be licensed only pursuant to the terms
|
|
* of an applicable Wind River license agreement.
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
--------------------
|
|
01e,06sep12,mpc Removed build warnings. (WIND00358280)
|
|
01d,22aug05,mil Added comments about usage of aimMmuBaseLibInit.
|
|
01c,19oct04,zl fixed pageSize and blockSize initialization (SPR #102620).
|
|
01b,30sep04,mdo Documentation fixes for apigen
|
|
01a,03jun04,sru written
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
|
|
This library contains the basic Architecture Independent Manager (AIM)
|
|
initializer for architecture dependent MMU subsystem that does not
|
|
use the full AIM implementation, which can be found in aimMmuLib.c.
|
|
|
|
All MMU subsystems have to export two properties into the 'sysctl'
|
|
subsystem: pageSize and blockSize. To accomplish this, aimMmuSysctl.c
|
|
passes two pointers-to-integer into the 'sysctl' subsystem. The
|
|
pointers refer to two structure elements:
|
|
|
|
mmuArchLibAttrs.blockSize
|
|
mmuArchLibAttrs.pageSize
|
|
|
|
This means that, regardless of how the MMU subsystem is managed, these
|
|
two structure members must be available so they can be used by 'sysctl'.
|
|
|
|
The 'mmuArchLibAttrs' data structure is shared between the MMU AIM and
|
|
the AD-MMU. If an AD-MMU makes full use of the AIM, it is _not_
|
|
required to initialize either the .pageSize or .blockSize structure
|
|
members. Instead, it initializes the .pageSizeMask and
|
|
.pageTblNumEntries members, and the AIM uses those members to initialize
|
|
.pageSize and .blockSize.
|
|
|
|
1) AD-MMU uses the full AIM, so it initializes .pageSizeMask and
|
|
.pageTblNumEntries, and calls aimMmuLibInit() to do the remainder of the
|
|
work.
|
|
|
|
2) AD-MMU doesn't use the full AIM, so it doesn't do _any_
|
|
initialization of the structure members in mmuArchLibAttrs. Instead, it
|
|
calls aimMmuBaseLibInit(). This function takes care of initializing
|
|
.pageSize and .blockSize so that they can be used by 'sysctl'.
|
|
|
|
|
|
INCLUDE FILES: vmLib.h, aimMmuLib.h
|
|
|
|
*/
|
|
|
|
/*
|
|
DOCUMENTATION
|
|
|
|
This library contains the basic Architecture Independent Manager (AIM)
|
|
initializer for architecture dependent MMU subsystem that does not
|
|
use the full AIM implementation, which can be found in aimMmuLib.c.
|
|
*/
|
|
|
|
/* Includes */
|
|
|
|
#include "vxWorks.h"
|
|
#include "private/vmLibP.h"
|
|
#include "aimMmuLib.h"
|
|
|
|
/* Externs */
|
|
|
|
IMPORT MMU_LIB_FUNCS mmuLibFuncs;
|
|
|
|
/* Globals */
|
|
|
|
MMU_ARCH_LIB_ATTRS mmuArchLibAttrs;
|
|
MMU_ARCH_LIB_FUNCS mmuArchLibFuncs;
|
|
|
|
|
|
/***************************************************************************
|
|
*
|
|
* aimMmuBaseLibInit - Initialize the base portion of the MMU AIM.
|
|
*
|
|
* aimMmuBaseLibInit is called by all architecture-specific MMU
|
|
* implementations. Those that utilize the MMU AIM call this function
|
|
* indirectly (via aimMmuLibInit); those that do not utilize the software
|
|
* abstractions of the AIM call this function directly. At present, the
|
|
* base library does not implement any value-added services. This
|
|
* library exists to give a standard AIM-centric interface to all
|
|
* MMU implementations.
|
|
*
|
|
* RETURNS: OK.
|
|
*
|
|
* ERRNO
|
|
*/
|
|
|
|
STATUS aimMmuBaseLibInit (void)
|
|
{
|
|
/* initialize region size if it isn't already configured */
|
|
|
|
if (mmuArchLibAttrs.blockSize == 0)
|
|
mmuArchLibAttrs.blockSize = (UINT)mmuLibFuncs.mmuBlockSizeGet();
|
|
|
|
/* initialize page size if it isn't already configured */
|
|
|
|
if (mmuArchLibAttrs.pageSize == 0)
|
|
mmuArchLibAttrs.pageSize = (UINT)mmuLibFuncs.mmuPageSizeGet();
|
|
|
|
return OK;
|
|
}
|