📄 map.c
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
//------------------------------------------------------------------------------
//
// File: map.c
//
#include <eboot.h>
extern OAL_ADDRESS_TABLE g_oalAddressTable[];
//------------------------------------------------------------------------------
VOID* OALPAtoVA(UINT32 pa, BOOL cached)
{
return (VOID*)pa;
}
//------------------------------------------------------------------------------
UINT32 OALVAtoPA(VOID *va)
{
return (UINT32)va;
}
VOID* BLVAtoPA( UINT32 address)
{
VOID *pAddress = INVALID_HANDLE_VALUE;
OAL_ADDRESS_TABLE *pTable = g_oalAddressTable;
if (address < 0x80000000 || address >= 0xC0000000) goto cleanUp;
// Address must be cached, as entries in OEMAddressTable are cached
address = address & ~OAL_MEMORY_CACHE_BIT;
// Search the table for address range
while (pTable->size != 0)
{
if ((address >= pTable->CA) &&
(address <= (pTable->CA + (pTable->size << 20) - 1)))
{
break;
}
pTable++;
}
// If address table entry is valid compute the PA
if (pTable->size == 0)
goto cleanUp;
// Get final address
pAddress = (UINT8*)(pTable->PA + address - pTable->CA);
cleanUp:
return pAddress;
}
VOID* NKCreateStaticMapping(DWORD phBase, DWORD size)
{
return OALPAtoUA(phBase << 8);
}
//------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -