/*---------------------------------------------------------------------------* Project: CtrBrom - OS File: os_protectionUnit.c Copyright 2009 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Date:: $ $Rev$ $Author$ *---------------------------------------------------------------------------*/ #include #include //====================================================================== // protection unit //====================================================================== /*---------------------------------------------------------------------------* Name: osEnableProtectionUnit Description: enable protection unit Arguments: None Returns: None *---------------------------------------------------------------------------*/ asm void osEnableProtectionUnit( void ) { mrc p15, 0, r0, c1, c0, 0 orr r0, r0, #HW_C1_PROTECT_UNIT_ENABLE mcr p15, 0, r0, c1, c0, 0 bx lr } /*---------------------------------------------------------------------------* Name: osDisableProtectionUnit Description: disable protection unit Arguments: None Returns: None *---------------------------------------------------------------------------*/ asm void osDisableProtectionUnit( void ) { mrc p15, 0, r0, c1, c0, 0 bic r0, r0, #HW_C1_PROTECT_UNIT_ENABLE mcr p15, 0, r0, c1, c0, 0 bx lr } /*---------------------------------------------------------------------------* Name: i_osFinalizeProtectionUnit Description: finalize protection unit Arguments: None Returns: None *---------------------------------------------------------------------------*/ asm void i_osFinalizeProtectionUnit( void ) { // プロテクションユニット&キャッシュ無効。ITCM & DTCMは有効 ldr r0, = HW_C1_ITCM_ENABLE | HW_C1_DTCM_ENABLE | HW_C1_EXCEPT_VEC_UPPER | HW_C1_SB1_BITSET mcr p15, 0, r0, c1, c0, 0 // ITCMの割り当てを解除 // mov r0, #0 // mcr p15, 0, r0, c6, c5, 0 // DTCMの割り当てを解除 // mov r0,#0 // mcr p15, 0, r0, c9, c1, 0 // キャッシュ無効化 mov r0, #0 mcr p15, 0, r0, c7, c5, 0 // 命令キャッシュ mcr p15, 0, r0, c7, c6, 0 // データキャッシュ // ライトバッファ エンプティ待ち mcr p15, 0, r0, c7, c10, 4 bx lr }