mirror of
https://github.com/rvtr/ctr_firmware.git
synced 2025-10-31 07:51:08 -04:00
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@182 b871894f-2f95-9b40-918c-086798483c85
294 lines
10 KiB
C
294 lines
10 KiB
C
/*---------------------------------------------------------------------------*
|
|
Project: CtrBrom - OS - include
|
|
File: mmu.h
|
|
|
|
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$
|
|
*---------------------------------------------------------------------------*/
|
|
#ifndef BROM_OS_MMU_H_
|
|
#define BROM_OS_MMU_H_
|
|
|
|
#include <ctr/types.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
//======================================================================
|
|
// MMU
|
|
//======================================================================
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osEnableMMU
|
|
|
|
Description: enable mmu
|
|
|
|
Arguments: None
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osEnableMMU( void );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osDisableMMU
|
|
|
|
Description: disable mmu
|
|
|
|
Arguments: None
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osDisableMMU( void );
|
|
|
|
//===========================================================================
|
|
// VA TO PA
|
|
//===========================================================================
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osGetPhysicalAddr
|
|
|
|
Description: Get physical address
|
|
|
|
Arguments: Virtual address
|
|
|
|
Returns: Physical address
|
|
*---------------------------------------------------------------------------*/
|
|
void* osGetPhysicalAddr( void* vaddr );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osGetMemRegionType
|
|
|
|
Description: Get memory region type
|
|
|
|
Arguments: Virtual address
|
|
|
|
Returns: Region type
|
|
*---------------------------------------------------------------------------*/
|
|
u8 osGetMemRegionType( void* vaddr );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osGetMemRegionCacheAttr
|
|
|
|
Description: Get memory region cache attribute
|
|
|
|
Arguments: Virtual address
|
|
|
|
Returns: Region cache attribute
|
|
*---------------------------------------------------------------------------*/
|
|
u8 osGetMemRegionCacheAttr( void* vaddr );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osIsMemRegionShareable
|
|
|
|
Description: Whether memory region is shareable or not
|
|
|
|
Arguments: Virtual address
|
|
|
|
Returns: Whether region is shareable or not
|
|
*---------------------------------------------------------------------------*/
|
|
BOOL osIsMemRegionShareable( void* vaddr );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osIsMemRegionAbort
|
|
|
|
Description: Whether memory region is abort or not
|
|
|
|
Arguments: Virtual address
|
|
|
|
Returns: Whether region is shareable or not
|
|
*---------------------------------------------------------------------------*/
|
|
BOOL osIsMemRegionAbort( void* vaddr );
|
|
|
|
//===========================================================================
|
|
// INVALIDATE ALL TLB
|
|
//===========================================================================
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateTLBAll
|
|
|
|
Description: Invalidate all main/instruction/data TLBs
|
|
|
|
Arguments: None
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateTLBAll( void );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateITLBAll
|
|
|
|
Description: Invalidate all instruction TLB
|
|
|
|
Arguments: None
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateITLBAll( void );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateDTLBAll
|
|
|
|
Description: Invalidate all data TLB
|
|
|
|
Arguments: None
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateDTLBAll( void );
|
|
|
|
//===========================================================================
|
|
// INVALIDATE RANGE OF TLB
|
|
//===========================================================================
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateTLBRange
|
|
|
|
Description: Invalidate main/instruction/data TLBs in specified range
|
|
|
|
Arguments: startAddr start address
|
|
nBytes size (in byte)
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateTLBRange( void* startAddr, u32 nBytes );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateITLBRange
|
|
|
|
Description: Invalidate instruction TLB in specified range
|
|
|
|
Arguments: startAddr start address
|
|
nBytes size (in byte)
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateITLBRange( void* startAddr, u32 nBytes );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateDTLBRange
|
|
|
|
Description: Invalidate TLBs in specified range
|
|
|
|
Arguments: startAddr start address
|
|
nBytes size (in byte)
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateDTLBRange( void* startAddr, u32 nBytes );
|
|
|
|
//===========================================================================
|
|
// INVALIDATE ALL TLB With ASID
|
|
//===========================================================================
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateTLBAllWithASID
|
|
|
|
Description: Invalidate all main/instruction/data TLBs with ASID
|
|
|
|
Arguments: Application Space ID
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateTLBAllWithASID( u32 asID );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateITLBAllWithASID
|
|
|
|
Description: Invalidate all instruction TLB with ASID
|
|
|
|
Arguments: Application Space ID
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateITLBAllWithASID( u32 asID );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateDTLBAllWithASID
|
|
|
|
Description: Invalidate all data TLB with ASID
|
|
|
|
Arguments: Application Space ID
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateDTLBAllWithASID( u32 asID );
|
|
|
|
//===========================================================================
|
|
// INVALIDATE RANGE OF TLB WITH ASID
|
|
//===========================================================================
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateTLBRangeWithASID
|
|
|
|
Description: Invalidate TLBs in specified rang with ASIDe
|
|
|
|
Arguments: startAddr start address
|
|
nBytes size (in byte)
|
|
asID Application Space ID
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateTLBRangeWithASID( void* startAddr, u32 nBytes, u32 asID );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateITLBRangeWithASID
|
|
|
|
Description: Invalidate instruction TLB in specified range with ASID
|
|
|
|
Arguments: startAddr start address
|
|
nBytes size (in byte)
|
|
asID Application Space ID
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateITLBRangeWithASID( void* startAddr, u32 nBytes, u32 asID );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osInvalidateDTLBRangeWithASID
|
|
|
|
Description: Invalidate TLBs in specified range with ASID
|
|
|
|
Arguments: startAddr start address
|
|
nBytes size (in byte)
|
|
asID Application Space ID
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osInvalidateDTLBRangeWithASID( void* startAddr, u32 nBytes, u32 asID );
|
|
|
|
//===========================================================================
|
|
// LOCKDOWN TLB
|
|
//===========================================================================
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osStartTLBLockDown
|
|
|
|
Description: Start TLB Lockdown
|
|
|
|
Arguments: TLB ID (0-7)
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osStartTLBLockDown( u32 tlbID );
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
Name: osEndTLBLockDown
|
|
|
|
Description: End TLB Lockdown
|
|
|
|
Arguments: None
|
|
|
|
Returns: None
|
|
*---------------------------------------------------------------------------*/
|
|
void osEndTLBLockDown( void );
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
#endif
|
|
|
|
#endif // BROM_OS_MMU_H_
|