<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 26, 2013 at 4:54 PM, Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sun, Aug 25, 2013 at 8:14 PM, Hesham AL-Matary<br>
<<a href="mailto:heshamelmatary@gmail.com">heshamelmatary@gmail.com</a>> wrote:<br>
> ---<br>
>  cpukit/score/Makefile.am                  |  2 +<br>
>  cpukit/score/include/rtems/score/mm.h     | 52 ++++++++++++++++++++<br>
>  cpukit/score/include/rtems/score/mmimpl.h | 80 +++++++++++++++++++++++++++++++<br>
>  cpukit/score/<a href="http://preinstall.am" target="_blank">preinstall.am</a>                |  8 ++++<br>
>  4 files changed, 142 insertions(+)<br>
>  create mode 100644 cpukit/score/include/rtems/score/mm.h<br>
>  create mode 100644 cpukit/score/include/rtems/score/mmimpl.h<br>
><br>
> diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am<br>
> index c9d2d47..b94af80 100644<br>
> --- a/cpukit/score/Makefile.am<br>
> +++ b/cpukit/score/Makefile.am<br>
> @@ -37,6 +37,8 @@ include_rtems_score_HEADERS += include/rtems/score/interr.h<br>
>  include_rtems_score_HEADERS += include/rtems/score/isr.h<br>
>  include_rtems_score_HEADERS += include/rtems/score/isrlevel.h<br>
>  include_rtems_score_HEADERS += include/rtems/score/isrlock.h<br>
> +include_rtems_score_HEADERS += include/rtems/score/mm.h<br>
> +include_rtems_score_HEADERS += include/rtems/score/mmimpl.h<br>
>  include_rtems_score_HEADERS += include/rtems/score/freechain.h<br>
>  include_rtems_score_HEADERS += include/rtems/score/object.h<br>
>  include_rtems_score_HEADERS += include/rtems/score/objectimpl.h<br>
> diff --git a/cpukit/score/include/rtems/score/mm.h b/cpukit/score/include/rtems/score/mm.h<br>
> new file mode 100644<br>
> index 0000000..43f6fc9<br>
> --- /dev/null<br>
> +++ b/cpukit/score/include/rtems/score/mm.h<br>
> @@ -0,0 +1,52 @@<br>
> +/**<br>
> + * @file<br>
> + *<br>
> + * @brief Manages use of MPU/MMU units to provide memory management.<br>
> + */<br>
> +<br>
> +/*<br>
> + * Copyright (c) 2013 Hesham Al-Matary.<br>
> + * Copyright (c) 2013 Gedare Bloom.<br>
> + *<br>
> + * The license and distribution terms for this file may be<br>
> + * found in the file LICENSE in this distribution or at<br>
> + * <a href="http://www.rtems.com/license/LICENSE" target="_blank">http://www.rtems.com/license/LICENSE</a>.<br>
> + */<br>
> +<br>
> +#ifndef _RTEMS_SCORE_MM_H<br>
> +#define _RTEMS_SCORE_MM_H<br>
> +<br>
> +/* @defgroup SuperCoreMM Memory Management Support<br>
> + *<br>
> + * @ingroup Score<br>
> + */<br>
> +/**@{*/<br>
> +<br>
> +#ifdef __cplusplus<br>
> +extern "C" {<br>
> +#endif<br>
> +<br>
> +/**<br>
> + * @brief _Memory_management_Region Flags defs<br>
> + */<br>
> +#define RTEMS_MM_REGION_NO_PROTECTION           0x0<br>
> +#define RTEMS_MM_REGION_PROTECTION_READ_ONLY    0x1<br>
> +#define RTEMS_MM_REGION_PROTECTION_WRITE        0x2<br>
> +#define RTEMS_MM_REGION_NO_ACCESS               0x3<br>
> +//#define RTEMS_MM_REGION_PROTECTION_EXEC   0x4<br>
> +<br>
</div></div>Is there a reason to have "no protection"? Does it make sense to<br>
define "No access" as 0x0?<br></blockquote><div>I just give the option for applying no access attribute. In Sebastian's </div><div>realview BSP code, all page tables entries are set to no access at </div><div>
startup and then re-set entries according to config_table and sections.</div><div>Do you think we should remove it ? </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div class="h5"><br>
> +void _Memory_management_Initialize( void );<br>
> +<br>
> +void _Memory_management_Set_attributes(<br>
> +  uintptr_t base,<br>
> +  size_t size,<br>
> +  uint32_t attr<br>
> +);<br>
> +<br>
> +#ifdef __cplusplus<br>
> +}<br>
> +#endif<br>
> +<br>
> +/**@}*/<br>
> +<br>
> +#endif<br>
> diff --git a/cpukit/score/include/rtems/score/mmimpl.h b/cpukit/score/include/rtems/score/mmimpl.h<br>
> new file mode 100644<br>
> index 0000000..7eecef0<br>
> --- /dev/null<br>
> +++ b/cpukit/score/include/rtems/score/mmimpl.h<br>
> @@ -0,0 +1,80 @@<br>
> +/**<br>
> + * @file<br>
> + *<br>
> + * @brief Inlined Routines from the Memory Management Manager<br>
> + */<br>
> +<br>
> +/*<br>
> + * Copyright (c) 2013 Hesham AL-Matary<br>
> + * Copyright (c) 2013 Gedare Bloom.<br>
> + *<br>
> + * The license and distribution terms for this file may be<br>
> + * found in the file LICENSE in this distribution or at<br>
> + * <a href="http://www.rtems.com/license/LICENSE" target="_blank">http://www.rtems.com/license/LICENSE</a>.<br>
> + */<br>
> +<br>
> +#ifndef _RTEMS_SCORE_MMIMPL_H<br>
> +#define _RTEMS_SCORE_MMIMPL_H<br>
> +<br>
> +#ifdef RTEMS_SMP<br>
> +#include <rtems/score/smplock.h><br>
> +#endif<br>
> +<br>
> +#include <stdint.h><br>
> +#include <stdlib.h><br>
> +#include <rtems/score/mm.h><br>
> +#include <libcpu/mm.h><br>
> +<br>
> +#ifdef __cplusplus<br>
> +extern "C" {<br>
> +#endif<br>
> +<br>
> +/**<br>
> + * @addtogroup SuperCoreMM<br>
> + */<br>
> +/**@{**/<br>
> +<br>
> +#ifdef RTEMS_SMP<br>
> +SMP_lock_Control mm_lock;<br>
> +#endif<br>
> +<br>
> +/**<br>
> + * @brief Calls _CPU_Memory_management_Initialize.<br>
> + */<br>
> +void _Memory_management_Initialize( void )<br>
> +{<br>
> +#ifdef RTEMS_SMP<br>
> +  _SMP_lock_Initialize( &mm_lock );<br>
> +#endif<br>
> +<br>
> +  _CPU_Memory_management_Initialize();<br>
> +}<br>
> +<br>
> +/**<br>
> + * @brief Calls _CPU_Memory_management_Set_attributes.<br>
> + */<br>
> +void _Memory_management_Set_attributes(<br>
> +  uintptr_t base,<br>
> +  size_t size,<br>
> +  uint32_t attr<br>
> +)<br>
> +{<br>
> +#ifdef RTEMS_SMP<br>
> +  _SMP_lock_Acquire( &mm_lock );<br>
> +#endif<br>
> +<br>
> +  _CPU_Memory_management_Set_attributes(base, size, attr);<br>
> +<br>
> +#ifdef RTEMS_SMP<br>
> +  _SMP_lock_Release( &mm_lock );<br>
> +#endif<br>
> +}<br>
> +<br>
> +/** @}*/<br>
> +<br>
> +#ifdef __cplusplus<br>
> +}<br>
> +#endif<br>
> +<br>
> +#endif<br>
> +/* end of include file */<br>
> diff --git a/cpukit/score/<a href="http://preinstall.am" target="_blank">preinstall.am</a> b/cpukit/score/<a href="http://preinstall.am" target="_blank">preinstall.am</a><br>
> index 79a18b5..4b3bfcf 100644<br>
> --- a/cpukit/score/<a href="http://preinstall.am" target="_blank">preinstall.am</a><br>
> +++ b/cpukit/score/<a href="http://preinstall.am" target="_blank">preinstall.am</a><br>
> @@ -131,6 +131,14 @@ $(PROJECT_INCLUDE)/rtems/score/isrlock.h: include/rtems/score/isrlock.h $(PROJEC<br>
>         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/isrlock.h<br>
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/isrlock.h<br>
><br>
> +$(PROJECT_INCLUDE)/rtems/score/mm.h: include/rtems/score/mm.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)<br>
> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/mm.h<br>
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/mm.h<br>
> +<br>
> +$(PROJECT_INCLUDE)/rtems/score/mmimpl.h: include/rtems/score/mmimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)<br>
> +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/mmimpl.h<br>
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/mmimpl.h<br>
> +<br>
>  $(PROJECT_INCLUDE)/rtems/score/freechain.h: include/rtems/score/freechain.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)<br>
>         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/freechain.h<br>
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/freechain.h<br>
> --<br>
> 1.8.3.1<br>
><br>
</div></div>> _______________________________________________<br>
> rtems-devel mailing list<br>
> <a href="mailto:rtems-devel@rtems.org">rtems-devel@rtems.org</a><br>
> <a href="http://www.rtems.org/mailman/listinfo/rtems-devel" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br>
</blockquote></div><br></div></div>