Damn, also update these ones
This commit is contained in:
parent
c66426b6b3
commit
47f79d29d7
|
@ -55,7 +55,25 @@ const char* g_EnumModules2String[static_cast<unsigned int>(_CXBXR_MODULE::MAX)]
|
|||
"XAPI",
|
||||
"XACT",
|
||||
"XGRP",
|
||||
"XONLINE",
|
||||
"XBDM",
|
||||
"PSHB",
|
||||
"DINP",
|
||||
"XINP",
|
||||
"FILE",
|
||||
"FS",
|
||||
"X86",
|
||||
"HLE",
|
||||
"NET",
|
||||
"MCPX",
|
||||
"NV2A",
|
||||
"OHCI",
|
||||
"USB",
|
||||
"HUB",
|
||||
"XIDCTRL",
|
||||
"KRNL",
|
||||
"LOG",
|
||||
"XBOX",
|
||||
"XBDM",
|
||||
"AV",
|
||||
"DBG",
|
||||
|
@ -66,6 +84,7 @@ const char* g_EnumModules2String[static_cast<unsigned int>(_CXBXR_MODULE::MAX)]
|
|||
"KD",
|
||||
"KE",
|
||||
"KI",
|
||||
"KD",
|
||||
"MM",
|
||||
"NT",
|
||||
"OB",
|
||||
|
|
|
@ -65,8 +65,25 @@ typedef enum class _CXBXR_MODULE {
|
|||
XACT,
|
||||
XGRP,
|
||||
XONLINE,
|
||||
XBDM,
|
||||
PSHB,
|
||||
DINP,
|
||||
XINP,
|
||||
FILE,
|
||||
FS,
|
||||
X86,
|
||||
HLE,
|
||||
NET,
|
||||
MCPX,
|
||||
NV2A,
|
||||
OHCI,
|
||||
USB,
|
||||
HUB,
|
||||
XIDCTRL,
|
||||
// kernel
|
||||
KRNL,
|
||||
LOG,
|
||||
XBOX,
|
||||
XBDM,
|
||||
AV,
|
||||
DBG,
|
||||
|
@ -77,6 +94,7 @@ typedef enum class _CXBXR_MODULE {
|
|||
KD,
|
||||
KE,
|
||||
KI,
|
||||
KD,
|
||||
MM,
|
||||
NT,
|
||||
OB,
|
||||
|
@ -264,10 +282,10 @@ extern thread_local std::string _logThreadPrefix;
|
|||
std::stringstream msg; \
|
||||
msg << _logThreadPrefix << _logFuncPrefix << "(";
|
||||
|
||||
#define LOG_FUNC_BEGIN(cxbxr_module) \
|
||||
LOG_CHECK_ENABLED(cxbxr_module, LOG_LEVEL::DEBUG) { \
|
||||
LOG_INIT \
|
||||
LOG_FUNC_BEGIN_NO_INIT(cxbxr_module)
|
||||
#define LOG_FUNC_BEGIN(cxbxr_module) \
|
||||
LOG_INIT \
|
||||
LOG_CHECK_ENABLED(cxbxr_module, LOG_LEVEL::DEBUG) { \
|
||||
LOG_FUNC_BEGIN_NO_INIT(cxbxr_module)
|
||||
|
||||
// LOG_FUNC_ARG writes output via all available ostream << operator overloads, sanitizing and adding detail where possible
|
||||
#define LOG_FUNC_ARG(arg) \
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "XBPM"
|
||||
#define LOG_PREFIX CXBXR_MODULE::XBPM
|
||||
|
||||
#undef FIELD_OFFSET // prevent macro redefinition warnings
|
||||
/* prevent name collisions */
|
||||
|
@ -46,7 +46,8 @@ namespace xboxkrnl
|
|||
|
||||
#include <Shlwapi.h>
|
||||
#include "CxbxKrnl/EmuShared.h"
|
||||
#include "Common/Settings.hpp"
|
||||
#include "Common/Settings.hpp"
|
||||
#include "Logging.h"
|
||||
|
||||
static Settings::s_controller_port g_ControllerPortMap;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "PSHB"
|
||||
#define LOG_PREFIX CXBXR_MODULE::PSHB
|
||||
|
||||
#include <assert.h> // For assert()
|
||||
|
||||
|
|
|
@ -35,12 +35,13 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "DINP"
|
||||
#define LOG_PREFIX CXBXR_MODULE::DINP
|
||||
|
||||
#include "Emu.h"
|
||||
#include "EmuXTL.h"
|
||||
#include "EmuShared.h"
|
||||
#include "Common/Win32/DInputController.h"
|
||||
#include "Common/Win32/DInputController.h"
|
||||
#include "Logging.h"
|
||||
|
||||
// ******************************************************************
|
||||
// * Static Variable(s)
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "KRNL"
|
||||
#define LOG_PREFIX CXBXR_MODULE::FS
|
||||
|
||||
// prevent name collisions
|
||||
namespace xboxkrnl
|
||||
|
@ -46,7 +46,8 @@ namespace xboxkrnl
|
|||
#include "EmuKrnl.h" // For InitializeListHead(), etc.
|
||||
#include "EmuFS.h"
|
||||
#include "CxbxKrnl.h"
|
||||
#include "VMManager.h"
|
||||
#include "VMManager.h"
|
||||
#include "Logging.h"
|
||||
|
||||
#undef FIELD_OFFSET // prevent macro redefinition warnings
|
||||
#include <windows.h>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "FILE"
|
||||
#define LOG_PREFIX CXBXR_MODULE::FILE
|
||||
|
||||
#include "EmuFile.h"
|
||||
#include <vector>
|
||||
|
@ -49,6 +49,7 @@
|
|||
#pragma warning(default:4005)
|
||||
#include "CxbxKrnl.h"
|
||||
#include "VMManager.h"
|
||||
#include "Logging.h"
|
||||
|
||||
#include <experimental/filesystem>
|
||||
|
||||
|
|
|
@ -36,13 +36,15 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "KRNL"
|
||||
#define LOG_PREFIX CXBXR_MODULE::KD
|
||||
|
||||
// prevent name collisions
|
||||
namespace xboxkrnl
|
||||
{
|
||||
#include <xboxkrnl/xboxkrnl.h> // For KdDebuggerEnabled, etc.
|
||||
};
|
||||
};
|
||||
|
||||
#include "Logging.h"
|
||||
|
||||
// ******************************************************************
|
||||
// * 0x0058 - KdDebuggerEnabled
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "KRNL"
|
||||
#define LOG_PREFIX CXBXR_MODULE::LOG
|
||||
|
||||
#ifdef _DEBUG
|
||||
// prevent name collisions
|
||||
|
@ -454,4 +454,4 @@ LOGRENDER(UNICODE_STRING)
|
|||
}
|
||||
|
||||
}; // end of namespace xboxkrnl;
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -36,13 +36,15 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "KRNL"
|
||||
#define LOG_PREFIX CXBXR_MODULE::XBOX
|
||||
|
||||
// prevent name collisions
|
||||
namespace xboxkrnl
|
||||
{
|
||||
#include <xboxkrnl/xboxkrnl.h> // For XboxEEPROMKey, etc.
|
||||
};
|
||||
};
|
||||
|
||||
#include "Logging.h"
|
||||
|
||||
// Certificate Key
|
||||
// Not exported but used to generate per-title keys
|
||||
|
@ -102,4 +104,3 @@ XBSYSAPI EXPORTNUM(353) xboxkrnl::XBOX_KEY_DATA xboxkrnl::XboxLANKey = { 0 };
|
|||
// ******************************************************************
|
||||
XBSYSAPI EXPORTNUM(354) xboxkrnl::XBOX_KEY_DATA xboxkrnl::XboxAlternateSignatureKeys[ALTERNATE_SIGNATURE_COUNT] = { 0 };
|
||||
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "X86 " // Intentional extra space to align on 4 characters
|
||||
#define LOG_PREFIX CXBXR_MODULE::X86
|
||||
|
||||
// Link the library into our project.
|
||||
#pragma comment(lib, "distorm.lib")
|
||||
|
@ -53,7 +53,8 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include "devices\Xbox.h" // For g_PCIBus
|
||||
#include <atomic>
|
||||
#include <atomic>
|
||||
#include "Logging.h"
|
||||
|
||||
extern uint32_t GetAPUTime();
|
||||
extern std::atomic_bool g_bEnableAllInterrupts;
|
||||
|
|
|
@ -35,14 +35,15 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "XINP"
|
||||
#define LOG_PREFIX CXBXR_MODULE::XINP
|
||||
|
||||
#include "Emu.h"
|
||||
#include "EmuXTL.h"
|
||||
#include "EmuShared.h"
|
||||
#include "EmuXInput.h"
|
||||
|
||||
#include <xinput.h>
|
||||
#include <xinput.h>
|
||||
#include "Logging.h"
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
// *
|
||||
// ******************************************************************
|
||||
|
||||
#define LOG_PREFIX "HLE " // Intentional extra space to align on 4 characters
|
||||
#define LOG_PREFIX CXBXR_MODULE::HLE
|
||||
|
||||
#include <cmath>
|
||||
#include <iomanip> // For std::setfill and std::setw
|
||||
|
@ -43,7 +43,8 @@
|
|||
#include "EmuFS.h"
|
||||
#include "EmuXTL.h"
|
||||
#include "EmuShared.h"
|
||||
#include "CxbxDebugger.h"
|
||||
#include "CxbxDebugger.h"
|
||||
#include "Logging.h"
|
||||
#pragma comment(lib, "XbSymbolDatabase.lib")
|
||||
#include "../../import/XbSymbolDatabase/XbSymbolDatabase.h"
|
||||
#include "HLEIntercept.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
// Citra website: https://citra-emu.org/
|
||||
|
||||
|
||||
#define LOG_PREFIX "VMEM"
|
||||
#define LOG_PREFIX CXBXR_MODULE::VMEM
|
||||
|
||||
#include "PoolManager.h"
|
||||
#include "Logging.h"
|
||||
|
@ -465,7 +465,7 @@ void VMManager::ConstructVMA(VAddr Start, size_t Size, MemoryRegionType Type, VM
|
|||
|
||||
VAddr VMManager::DbgTestPte(VAddr addr, PMMPTE Pte, bool bWriteCheck)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_ARG(*(PULONG)Pte)
|
||||
LOG_FUNC_ARG(bWriteCheck)
|
||||
|
@ -478,7 +478,7 @@ VAddr VMManager::DbgTestPte(VAddr addr, PMMPTE Pte, bool bWriteCheck)
|
|||
|
||||
if (bWriteCheck)
|
||||
{
|
||||
if (!IsValidVirtualAddress(addr)) { Unlock(); RETURN(ret); }
|
||||
if (!IsValidVirtualAddress(addr)) { Unlock(); RETURN(LOG_PREFIX, ret); }
|
||||
|
||||
Pte->Default = 0;
|
||||
PointerPte = GetPdeAddress(addr);
|
||||
|
@ -505,7 +505,7 @@ VAddr VMManager::DbgTestPte(VAddr addr, PMMPTE Pte, bool bWriteCheck)
|
|||
|
||||
Unlock();
|
||||
|
||||
RETURN(ret);
|
||||
RETURN(LOG_PREFIX, ret);
|
||||
}
|
||||
|
||||
PFN_COUNT VMManager::QueryNumberOfFreeDebuggerPages()
|
||||
|
@ -533,7 +533,7 @@ void VMManager::MemoryStatistics(xboxkrnl::PMM_STATISTICS memory_statistics)
|
|||
|
||||
VAddr VMManager::ClaimGpuMemory(size_t Size, size_t* BytesToSkip)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(Size)
|
||||
LOG_FUNC_ARG(*BytesToSkip)
|
||||
LOG_FUNC_END;
|
||||
|
@ -598,12 +598,12 @@ VAddr VMManager::ClaimGpuMemory(size_t Size, size_t* BytesToSkip)
|
|||
Unlock();
|
||||
}
|
||||
|
||||
RETURN((VAddr)CONVERT_PFN_TO_CONTIGUOUS_PHYSICAL(m_HighestPage + 1) - *BytesToSkip);
|
||||
RETURN(LOG_PREFIX, (VAddr)CONVERT_PFN_TO_CONTIGUOUS_PHYSICAL(m_HighestPage + 1) - *BytesToSkip);
|
||||
}
|
||||
|
||||
void VMManager::PersistMemory(VAddr addr, size_t Size, bool bPersist)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_ARG(Size)
|
||||
LOG_FUNC_ARG(bPersist)
|
||||
|
@ -743,7 +743,7 @@ void VMManager::RestorePersistentMemory()
|
|||
|
||||
VAddr VMManager::Allocate(size_t Size)
|
||||
{
|
||||
LOG_FUNC_ONE_ARG(Size);
|
||||
LOG_FUNC_ONE_ARG(LOG_PREFIX, Size);
|
||||
|
||||
MMPTE TempPte;
|
||||
PMMPTE PointerPte;
|
||||
|
@ -759,7 +759,7 @@ VAddr VMManager::Allocate(size_t Size)
|
|||
// widespread in the D3D patches. I think that most of those functions should use the Nt or the heap functions instead,
|
||||
// but, until those are properly implemented, this routine is here to stay
|
||||
|
||||
if (!Size) { RETURN(NULL); }
|
||||
if (!Size) { RETURN(LOG_PREFIX, NULL); }
|
||||
|
||||
Lock();
|
||||
|
||||
|
@ -839,11 +839,11 @@ VAddr VMManager::Allocate(size_t Size)
|
|||
UpdateMemoryPermissions(addr, PteNumber << PAGE_SHIFT, XBOX_PAGE_EXECUTE_READWRITE);
|
||||
|
||||
Unlock();
|
||||
RETURN(addr);
|
||||
RETURN(LOG_PREFIX, addr);
|
||||
|
||||
Fail:
|
||||
Unlock();
|
||||
RETURN(NULL);
|
||||
RETURN(LOG_PREFIX, NULL);
|
||||
}
|
||||
|
||||
VAddr VMManager::AllocateZeroed(size_t Size)
|
||||
|
@ -853,12 +853,12 @@ VAddr VMManager::AllocateZeroed(size_t Size)
|
|||
VAddr addr = Allocate(Size);
|
||||
if (addr) { xboxkrnl::RtlFillMemoryUlong((void*)addr, ROUND_UP_4K(Size), 0); }
|
||||
|
||||
RETURN(addr);
|
||||
RETURN(LOG_PREFIX, addr);
|
||||
}
|
||||
|
||||
VAddr VMManager::AllocateSystemMemory(PageType BusyType, DWORD Perms, size_t Size, bool bAddGuardPage)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(BusyType)
|
||||
LOG_FUNC_ARG(Perms)
|
||||
LOG_FUNC_ARG(Size)
|
||||
|
@ -882,7 +882,7 @@ VAddr VMManager::AllocateSystemMemory(PageType BusyType, DWORD Perms, size_t Siz
|
|||
// NOTE: AllocateSystemMemory won't allocate a physical page for the guard page (if requested) and just adds an extra
|
||||
// unallocated virtual page in front of the mapped allocation. For this reason we will decommmit later the extra guard page allocated
|
||||
|
||||
if (!Size || !ConvertXboxToSystemPteProtection(Perms, &TempPte)) { RETURN(NULL); }
|
||||
if (!Size || !ConvertXboxToSystemPteProtection(Perms, &TempPte)) { RETURN(LOG_PREFIX, NULL); }
|
||||
|
||||
Lock();
|
||||
|
||||
|
@ -987,16 +987,16 @@ VAddr VMManager::AllocateSystemMemory(PageType BusyType, DWORD Perms, size_t Siz
|
|||
ConstructVMA(addr, PteNumber << PAGE_SHIFT, MemoryType, AllocatedVma, bVAlloc);
|
||||
|
||||
Unlock();
|
||||
RETURN(addr);
|
||||
RETURN(LOG_PREFIX, addr);
|
||||
|
||||
Fail:
|
||||
Unlock();
|
||||
RETURN(NULL);
|
||||
RETURN(LOG_PREFIX, NULL);
|
||||
}
|
||||
|
||||
VAddr VMManager::AllocateContiguous(size_t Size, PAddr LowestAddress, PAddr HighestAddress, ULONG Alignment, DWORD Perms)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(Size)
|
||||
LOG_FUNC_ARG(LowestAddress)
|
||||
LOG_FUNC_ARG(HighestAddress)
|
||||
|
@ -1015,7 +1015,7 @@ VAddr VMManager::AllocateContiguous(size_t Size, PAddr LowestAddress, PAddr High
|
|||
PFN_COUNT PteNumber;
|
||||
VAddr addr;
|
||||
|
||||
if (!Size || !ConvertXboxToSystemPteProtection(Perms, &TempPte)) { RETURN(NULL); }
|
||||
if (!Size || !ConvertXboxToSystemPteProtection(Perms, &TempPte)) { RETURN(LOG_PREFIX, NULL); }
|
||||
|
||||
PteNumber = ROUND_UP_4K(Size) >> PAGE_SHIFT;
|
||||
LowerPfn = LowestAddress >> PAGE_SHIFT;
|
||||
|
@ -1055,16 +1055,16 @@ VAddr VMManager::AllocateContiguous(size_t Size, PAddr LowestAddress, PAddr High
|
|||
UpdateMemoryPermissions(addr, PteNumber << PAGE_SHIFT, Perms);
|
||||
|
||||
Unlock();
|
||||
RETURN(addr);
|
||||
RETURN(LOG_PREFIX, addr);
|
||||
|
||||
Fail:
|
||||
Unlock();
|
||||
RETURN(NULL);
|
||||
RETURN(LOG_PREFIX, NULL);
|
||||
}
|
||||
|
||||
VAddr VMManager::MapDeviceMemory(PAddr Paddr, size_t Size, DWORD Perms)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(Paddr)
|
||||
LOG_FUNC_ARG(Size)
|
||||
LOG_FUNC_ARG(Perms)
|
||||
|
@ -1078,14 +1078,14 @@ VAddr VMManager::MapDeviceMemory(PAddr Paddr, size_t Size, DWORD Perms)
|
|||
VAddr addr;
|
||||
MappingFn MappingRoutine;
|
||||
|
||||
if (!Size || !ConvertXboxToSystemPteProtection(Perms, &TempPte)) { RETURN(NULL); }
|
||||
if (!Size || !ConvertXboxToSystemPteProtection(Perms, &TempPte)) { RETURN(LOG_PREFIX, NULL); }
|
||||
|
||||
// Is it a physical address for hardware devices (flash, NV2A, etc) ?
|
||||
if (Paddr >= XBOX_WRITE_COMBINED_BASE /*&& Paddr + Size <= XBOX_UNCACHED_END*/)
|
||||
{
|
||||
// Return physical address as virtual (accesses will go through EmuException)
|
||||
|
||||
RETURN(Paddr);
|
||||
RETURN(LOG_PREFIX, Paddr);
|
||||
}
|
||||
|
||||
// The requested address is not a known device address so we have to create a mapping for it. Even though this won't
|
||||
|
@ -1117,16 +1117,16 @@ VAddr VMManager::MapDeviceMemory(PAddr Paddr, size_t Size, DWORD Perms)
|
|||
ConstructVMA(addr, PteNumber << PAGE_SHIFT, SystemRegion, ReservedVma, true);
|
||||
|
||||
Unlock();
|
||||
RETURN(addr + BYTE_OFFSET(Paddr));
|
||||
RETURN(LOG_PREFIX, addr + BYTE_OFFSET(Paddr));
|
||||
|
||||
Fail:
|
||||
Unlock();
|
||||
RETURN(NULL);
|
||||
RETURN(LOG_PREFIX, NULL);
|
||||
}
|
||||
|
||||
void VMManager::Deallocate(VAddr addr)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_END;
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ void VMManager::Deallocate(VAddr addr)
|
|||
|
||||
void VMManager::DeallocateContiguous(VAddr addr)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_END;
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ void VMManager::DeallocateContiguous(VAddr addr)
|
|||
|
||||
PFN_COUNT VMManager::DeallocateSystemMemory(PageType BusyType, VAddr addr, size_t Size)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_ARG(Size)
|
||||
LOG_FUNC_END;
|
||||
|
@ -1257,7 +1257,7 @@ PFN_COUNT VMManager::DeallocateSystemMemory(PageType BusyType, VAddr addr, size_
|
|||
if (it == m_MemoryRegionArray[MemoryType].RegionMap.end() || it->second.type == FreeVma)
|
||||
{
|
||||
Unlock();
|
||||
RETURN(NULL);
|
||||
RETURN(LOG_PREFIX, NULL);
|
||||
}
|
||||
|
||||
// Calculate the size of the original allocation
|
||||
|
@ -1301,12 +1301,12 @@ PFN_COUNT VMManager::DeallocateSystemMemory(PageType BusyType, VAddr addr, size_
|
|||
DeallocatePT(bGuardPageAdded ? Size + PAGE_SIZE : Size, addr);
|
||||
|
||||
Unlock();
|
||||
RETURN(bGuardPageAdded ? ++PteNumber : PteNumber);
|
||||
RETURN(LOG_PREFIX, bGuardPageAdded ? ++PteNumber : PteNumber);
|
||||
}
|
||||
|
||||
void VMManager::UnmapDeviceMemory(VAddr addr, size_t Size)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_ARG(Size)
|
||||
LOG_FUNC_END;
|
||||
|
@ -1349,7 +1349,7 @@ void VMManager::UnmapDeviceMemory(VAddr addr, size_t Size)
|
|||
|
||||
void VMManager::Protect(VAddr addr, size_t Size, DWORD NewPerms)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_ARG(Size)
|
||||
LOG_FUNC_ARG(NewPerms)
|
||||
|
@ -1401,7 +1401,7 @@ void VMManager::Protect(VAddr addr, size_t Size, DWORD NewPerms)
|
|||
|
||||
DWORD VMManager::QueryProtection(VAddr addr)
|
||||
{
|
||||
LOG_FUNC_ONE_ARG(addr);
|
||||
LOG_FUNC_ONE_ARG(LOG_PREFIX, addr);
|
||||
|
||||
PMMPTE PointerPte;
|
||||
MMPTE TempPte;
|
||||
|
@ -1442,12 +1442,12 @@ DWORD VMManager::QueryProtection(VAddr addr)
|
|||
|
||||
Unlock();
|
||||
|
||||
RETURN(Protect);
|
||||
RETURN(LOG_PREFIX, Protect);
|
||||
}
|
||||
|
||||
size_t VMManager::QuerySize(VAddr addr, bool bCxbxCaller)
|
||||
{
|
||||
LOG_FUNC_ONE_ARG(addr);
|
||||
LOG_FUNC_ONE_ARG(LOG_PREFIX, addr);
|
||||
|
||||
PMMPTE PointerPte;
|
||||
PFN_COUNT PagesNumber;
|
||||
|
@ -1469,7 +1469,7 @@ size_t VMManager::QuerySize(VAddr addr, bool bCxbxCaller)
|
|||
{
|
||||
DbgPrintf("VMEM: QuerySize: Unknown memory region queried.\n");
|
||||
Unlock();
|
||||
RETURN(Size);
|
||||
RETURN(LOG_PREFIX, Size);
|
||||
}
|
||||
|
||||
VMAIter it = GetVMAIterator(addr, Type);
|
||||
|
@ -1500,12 +1500,12 @@ size_t VMManager::QuerySize(VAddr addr, bool bCxbxCaller)
|
|||
|
||||
Unlock();
|
||||
|
||||
RETURN(Size);
|
||||
RETURN(LOG_PREFIX, Size);
|
||||
}
|
||||
|
||||
void VMManager::LockBufferOrSinglePage(PAddr paddr, VAddr addr, size_t Size, bool bUnLock)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(paddr)
|
||||
LOG_FUNC_ARG(addr)
|
||||
LOG_FUNC_ARG(Size)
|
||||
|
@ -1573,7 +1573,7 @@ void VMManager::LockBufferOrSinglePage(PAddr paddr, VAddr addr, size_t Size, boo
|
|||
|
||||
xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBits, size_t* Size, DWORD AllocationType, DWORD Protect)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(*addr)
|
||||
LOG_FUNC_ARG(ZeroBits)
|
||||
LOG_FUNC_ARG(*Size)
|
||||
|
@ -1601,28 +1601,28 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
|
|||
bool bOverflow;
|
||||
|
||||
// Invalid base address
|
||||
if (CapturedBase > HIGHEST_VMA_ADDRESS) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if (CapturedBase > HIGHEST_VMA_ADDRESS) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// Invalid region size
|
||||
if (((HIGHEST_VMA_ADDRESS + 1) - CapturedBase) < CapturedSize) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if (((HIGHEST_VMA_ADDRESS + 1) - CapturedBase) < CapturedSize) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// Size cannot be zero
|
||||
if (CapturedSize == 0) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if (CapturedSize == 0) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// Limit number of zero bits upto 21
|
||||
if (ZeroBits > MAXIMUM_ZERO_BITS) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if (ZeroBits > MAXIMUM_ZERO_BITS) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// Check for unknown MEM flags
|
||||
if(AllocationType & ~(XBOX_MEM_COMMIT | XBOX_MEM_RESERVE | XBOX_MEM_TOP_DOWN | XBOX_MEM_RESET
|
||||
| XBOX_MEM_NOZERO)) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
| XBOX_MEM_NOZERO)) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// No other flags allowed in combination with MEM_RESET
|
||||
if ((AllocationType & XBOX_MEM_RESET) && (AllocationType != XBOX_MEM_RESET)) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if ((AllocationType & XBOX_MEM_RESET) && (AllocationType != XBOX_MEM_RESET)) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// At least MEM_RESET, MEM_COMMIT or MEM_RESERVE must be set
|
||||
if ((AllocationType & (XBOX_MEM_COMMIT | XBOX_MEM_RESERVE | XBOX_MEM_RESET)) == 0) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if ((AllocationType & (XBOX_MEM_COMMIT | XBOX_MEM_RESERVE | XBOX_MEM_RESET)) == 0) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
if (!ConvertXboxToPteProtection(Protect, &TempPte)) { RETURN(STATUS_INVALID_PAGE_PROTECTION); }
|
||||
if (!ConvertXboxToPteProtection(Protect, &TempPte)) { RETURN(LOG_PREFIX, STATUS_INVALID_PAGE_PROTECTION); }
|
||||
|
||||
DbgPrintf("VMEM: XbAllocateVirtualMemory requested range : 0x%.8X - 0x%.8X\n", CapturedBase, CapturedBase + CapturedSize);
|
||||
|
||||
|
@ -1739,7 +1739,7 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
|
|||
*Size = AlignedCapturedSize;
|
||||
|
||||
Unlock();
|
||||
RETURN(STATUS_SUCCESS);
|
||||
RETURN(LOG_PREFIX, STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
// Figure out the number of physical pages we need to allocate. Note that NtAllocateVirtualMemory can do overlapped allocations so we
|
||||
|
@ -1819,7 +1819,7 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
|
|||
*addr = AlignedCapturedBase;
|
||||
*Size = AlignedCapturedSize;
|
||||
Unlock();
|
||||
RETURN(STATUS_SUCCESS);
|
||||
RETURN(LOG_PREFIX, STATUS_SUCCESS);
|
||||
|
||||
Exit:
|
||||
if (bDestructVmaOnFailure)
|
||||
|
@ -1828,12 +1828,12 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
|
|||
DestructVMA(AlignedCapturedBase, UserRegion, AlignedCapturedSize);
|
||||
}
|
||||
Unlock();
|
||||
RETURN(status);
|
||||
RETURN(LOG_PREFIX, status);
|
||||
}
|
||||
|
||||
xboxkrnl::NTSTATUS VMManager::XbFreeVirtualMemory(VAddr* addr, size_t* Size, DWORD FreeType)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(*addr)
|
||||
LOG_FUNC_ARG(*Size)
|
||||
LOG_FUNC_ARG(FreeType)
|
||||
|
@ -1854,19 +1854,19 @@ xboxkrnl::NTSTATUS VMManager::XbFreeVirtualMemory(VAddr* addr, size_t* Size, DWO
|
|||
|
||||
|
||||
// Only MEM_DECOMMIT and MEM_RELEASE are valid
|
||||
if ((FreeType & ~(XBOX_MEM_DECOMMIT | XBOX_MEM_RELEASE)) != 0) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if ((FreeType & ~(XBOX_MEM_DECOMMIT | XBOX_MEM_RELEASE)) != 0) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// MEM_DECOMMIT and MEM_RELEASE must not be specified together
|
||||
if (((FreeType & (XBOX_MEM_DECOMMIT | XBOX_MEM_RELEASE)) == 0) ||
|
||||
((FreeType & (XBOX_MEM_DECOMMIT | XBOX_MEM_RELEASE)) == (XBOX_MEM_DECOMMIT | XBOX_MEM_RELEASE))) {
|
||||
RETURN(STATUS_INVALID_PARAMETER);
|
||||
RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
// Invalid base address
|
||||
if (CapturedBase > HIGHEST_USER_ADDRESS) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if (CapturedBase > HIGHEST_USER_ADDRESS) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// Invalid region size
|
||||
if ((HIGHEST_USER_ADDRESS - CapturedBase) < CapturedSize) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if ((HIGHEST_USER_ADDRESS - CapturedBase) < CapturedSize) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
AlignedCapturedBase = ROUND_DOWN_4K(CapturedBase);
|
||||
AlignedCapturedSize = (PAGES_SPANNED(CapturedBase, CapturedSize)) << PAGE_SHIFT;
|
||||
|
@ -1983,12 +1983,12 @@ xboxkrnl::NTSTATUS VMManager::XbFreeVirtualMemory(VAddr* addr, size_t* Size, DWO
|
|||
|
||||
Exit:
|
||||
Unlock();
|
||||
RETURN(status);
|
||||
RETURN(LOG_PREFIX, status);
|
||||
}
|
||||
|
||||
xboxkrnl::NTSTATUS VMManager::XbVirtualProtect(VAddr* addr, size_t* Size, DWORD* Protect)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_BEGIN(LOG_PREFIX)
|
||||
LOG_FUNC_ARG(*addr)
|
||||
LOG_FUNC_ARG(*Size)
|
||||
LOG_FUNC_ARG(*Protect)
|
||||
|
@ -2012,15 +2012,15 @@ xboxkrnl::NTSTATUS VMManager::XbVirtualProtect(VAddr* addr, size_t* Size, DWORD*
|
|||
|
||||
|
||||
// Invalid base address
|
||||
if (CapturedBase > HIGHEST_USER_ADDRESS) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if (CapturedBase > HIGHEST_USER_ADDRESS) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// Invalid region size
|
||||
if ((HIGHEST_USER_ADDRESS - CapturedBase) < CapturedSize) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if ((HIGHEST_USER_ADDRESS - CapturedBase) < CapturedSize) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
// Size cannot be zero
|
||||
if (CapturedSize == 0) { RETURN(STATUS_INVALID_PARAMETER); }
|
||||
if (CapturedSize == 0) { RETURN(LOG_PREFIX, STATUS_INVALID_PARAMETER); }
|
||||
|
||||
if (!ConvertXboxToPteProtection(NewPerms, &NewPermsPte)) { RETURN(STATUS_INVALID_PAGE_PROTECTION); }
|
||||
if (!ConvertXboxToPteProtection(NewPerms, &NewPermsPte)) { RETURN(LOG_PREFIX, STATUS_INVALID_PAGE_PROTECTION); }
|
||||
|
||||
AlignedCapturedBase = ROUND_DOWN_4K(CapturedBase);
|
||||
AlignedCapturedSize = (PAGES_SPANNED(CapturedBase, CapturedSize)) << PAGE_SHIFT;
|
||||
|
@ -2109,7 +2109,7 @@ xboxkrnl::NTSTATUS VMManager::XbVirtualProtect(VAddr* addr, size_t* Size, DWORD*
|
|||
|
||||
Exit:
|
||||
Unlock();
|
||||
RETURN(status);
|
||||
RETURN(LOG_PREFIX, status);
|
||||
}
|
||||
|
||||
xboxkrnl::NTSTATUS VMManager::XbVirtualMemoryStatistics(VAddr addr, xboxkrnl::PMEMORY_BASIC_INFORMATION memory_statistics)
|
||||
|
@ -2406,7 +2406,7 @@ VAddr VMManager::ReserveBlockWithVirtualAlloc(VAddr StartingAddr, size_t Size, s
|
|||
|
||||
bool VMManager::IsValidVirtualAddress(const VAddr addr)
|
||||
{
|
||||
LOG_FUNC_ONE_ARG(addr);
|
||||
LOG_FUNC_ONE_ARG(LOG_PREFIX, addr);
|
||||
|
||||
PMMPTE PointerPte;
|
||||
|
||||
|
@ -2436,16 +2436,16 @@ bool VMManager::IsValidVirtualAddress(const VAddr addr)
|
|||
|
||||
ValidAddress:
|
||||
Unlock();
|
||||
RETURN(true);
|
||||
RETURN(LOG_PREFIX, true);
|
||||
|
||||
InvalidAddress:
|
||||
Unlock();
|
||||
RETURN(false);
|
||||
RETURN(LOG_PREFIX, false);
|
||||
}
|
||||
|
||||
PAddr VMManager::TranslateVAddrToPAddr(const VAddr addr)
|
||||
{
|
||||
LOG_FUNC_ONE_ARG(addr);
|
||||
LOG_FUNC_ONE_ARG(LOG_PREFIX, addr);
|
||||
|
||||
PAddr PAddr;
|
||||
PMMPTE PointerPte;
|
||||
|
@ -2466,13 +2466,13 @@ PAddr VMManager::TranslateVAddrToPAddr(const VAddr addr)
|
|||
if (Type == UserRegion) {
|
||||
EmuWarning("Applying identity mapping hack to allocation at address 0x%X", addr);
|
||||
Unlock();
|
||||
RETURN(addr); // committed pages in the user region always use VirtualAlloc
|
||||
RETURN(LOG_PREFIX, addr); // committed pages in the user region always use VirtualAlloc
|
||||
}
|
||||
VMAIter it = GetVMAIterator(addr, Type);
|
||||
if (it != m_MemoryRegionArray[Type].RegionMap.end() && it->second.type != FreeVma && it->second.bFragmented) {
|
||||
EmuWarning("Applying identity mapping hack to allocation at address 0x%X", addr);
|
||||
Unlock();
|
||||
RETURN(addr); // committed pages in the system-devkit regions can use VirtualAlloc because of fragmentation
|
||||
RETURN(LOG_PREFIX, addr); // committed pages in the system-devkit regions can use VirtualAlloc because of fragmentation
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -2501,11 +2501,11 @@ PAddr VMManager::TranslateVAddrToPAddr(const VAddr addr)
|
|||
PAddr += (PointerPte->Hardware.PFN << PAGE_SHIFT);
|
||||
|
||||
Unlock();
|
||||
RETURN(PAddr);
|
||||
RETURN(LOG_PREFIX, PAddr);
|
||||
|
||||
InvalidAddress:
|
||||
Unlock();
|
||||
RETURN(NULL);
|
||||
RETURN(LOG_PREFIX, NULL);
|
||||
}
|
||||
|
||||
void VMManager::Lock()
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "NET " // Intentional extra space to align on 4 characters
|
||||
#define LOG_PREFIX CXBXR_MODULE::NET
|
||||
|
||||
// prevent name collisions
|
||||
|
||||
|
@ -53,7 +53,8 @@ namespace xboxkrnl
|
|||
#include "CxbxKrnl\Emu.h"
|
||||
#include "CxbxKrnl\EmuKrnl.h"
|
||||
|
||||
#include "EmuNVNet.h"
|
||||
#include "EmuNVNet.h"
|
||||
#include "Logging.h"
|
||||
|
||||
// NVNET Register Definitions
|
||||
// Taken from XQEMU
|
||||
|
|
|
@ -35,10 +35,11 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "MCPX"
|
||||
#define LOG_PREFIX CXBXR_MODULE::MCPX
|
||||
|
||||
|
||||
#include "MCPXDevice.h"
|
||||
#include "MCPXDevice.h"
|
||||
#include "Logging.h"
|
||||
|
||||
/* MCPXDevice */
|
||||
|
||||
|
|
|
@ -45,8 +45,9 @@ namespace xboxkrnl
|
|||
#include "OHCI.h"
|
||||
#include "Hub.h"
|
||||
#include "CxbxKrnl\EmuKrnl.h" // For EmuWarning
|
||||
#include "Logging.h"
|
||||
|
||||
#define LOG_STR_HUB "Hub:"
|
||||
#define LOG_PREFIX CXBXR_MODULE::HUB
|
||||
|
||||
#define NUM_PORTS 8
|
||||
|
||||
|
|
|
@ -44,9 +44,10 @@ namespace xboxkrnl
|
|||
|
||||
#include "OHCI.h"
|
||||
#include "CxbxKrnl\EmuKrnl.h" // For HalSystemInterrupt
|
||||
#include "CxbxCommon.h"
|
||||
#include "CxbxCommon.h"
|
||||
#include "Logging.h"
|
||||
|
||||
#define LOG_STR_OHCI "Ohci:"
|
||||
#define LOG_PREFIX CXBXR_MODULE::OHCI
|
||||
|
||||
/* Define these two if you want to dump usb packets */
|
||||
//#define DEBUG_ISOCH
|
||||
|
|
|
@ -45,9 +45,10 @@ namespace xboxkrnl
|
|||
#include "USBDevice.h"
|
||||
#include "OHCI.h"
|
||||
#include "CxbxKrnl\EmuKrnl.h" // For EmuWarning
|
||||
#include "CxbxCommon.h"
|
||||
#include "CxbxCommon.h"
|
||||
#include "Logging.h"
|
||||
|
||||
#define LOG_STR_USB "Usb"
|
||||
#define LOG_PREFIX CXBXR_MODULE::USB
|
||||
|
||||
#define SETUP_STATE_IDLE 0
|
||||
#define SETUP_STATE_SETUP 1
|
||||
|
|
|
@ -48,8 +48,9 @@ namespace xboxkrnl
|
|||
#include "Common/Input/SDL2_Device.h"
|
||||
#include "OHCI.h"
|
||||
#include "CxbxKrnl\EmuKrnl.h" // For EmuWarning
|
||||
#include "Logging.h"
|
||||
|
||||
#define LOG_STR_GAMEPAD "Gamepad:"
|
||||
#define LOG_PREFIX CXBXR_MODULE::XIDCTRL
|
||||
|
||||
#define USB_CLASS_XID 0x58
|
||||
#define USB_DT_XID 0x42
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
// ******************************************************************
|
||||
#define _XBOXKRNL_DEFEXTRN_
|
||||
|
||||
#define LOG_PREFIX "NV2A"
|
||||
#define LOG_PREFIX CXBXR_MODULE::NV2A
|
||||
|
||||
// prevent name collisions
|
||||
namespace xboxkrnl
|
||||
|
@ -66,6 +66,7 @@ namespace xboxkrnl
|
|||
#include "CxbxKrnl\EmuFS.h"
|
||||
#include "CxbxKrnl\EmuKrnl.h"
|
||||
#include "CxbxKrnl\HLEIntercept.h"
|
||||
#include "Logging.h"
|
||||
|
||||
#include "vga.h"
|
||||
#include "nv2a.h" // For NV2AState
|
||||
|
|
Loading…
Reference in New Issue