mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-04 06:06:00 +00:00
libs: Reduce logging
This commit is contained in:
parent
c9773c5c0a
commit
f96a21551a
|
@ -103,7 +103,7 @@ struct AddressSpace::Impl {
|
||||||
const uintptr_t system_reserved_addr = reinterpret_cast<uintptr_t>(system_reserved_base);
|
const uintptr_t system_reserved_addr = reinterpret_cast<uintptr_t>(system_reserved_base);
|
||||||
const uintptr_t user_addr = reinterpret_cast<uintptr_t>(user_base);
|
const uintptr_t user_addr = reinterpret_cast<uintptr_t>(user_base);
|
||||||
regions.emplace(system_managed_addr,
|
regions.emplace(system_managed_addr,
|
||||||
MemoryRegion{system_managed_addr, virtual_size - reduction, false});
|
MemoryRegion{system_managed_addr, virtual_size - reduction, false});
|
||||||
|
|
||||||
// Allocate backing file that represents the total physical memory.
|
// Allocate backing file that represents the total physical memory.
|
||||||
backing_handle =
|
backing_handle =
|
||||||
|
@ -157,8 +157,7 @@ struct AddressSpace::Impl {
|
||||||
ASSERT_MSG(ret, "VirtualProtect failed. {}", Common::GetLastErrorMsg());
|
ASSERT_MSG(ret, "VirtualProtect failed. {}", Common::GetLastErrorMsg());
|
||||||
} else {
|
} else {
|
||||||
ptr = MapViewOfFile3(backing, process, reinterpret_cast<PVOID>(virtual_addr),
|
ptr = MapViewOfFile3(backing, process, reinterpret_cast<PVOID>(virtual_addr),
|
||||||
phys_addr, size, MEM_REPLACE_PLACEHOLDER, prot,
|
phys_addr, size, MEM_REPLACE_PLACEHOLDER, prot, nullptr, 0);
|
||||||
nullptr, 0);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ptr =
|
ptr =
|
||||||
|
@ -211,7 +210,8 @@ struct AddressSpace::Impl {
|
||||||
region_size, size);
|
region_size, size);
|
||||||
|
|
||||||
// Split the placeholder.
|
// Split the placeholder.
|
||||||
if (!VirtualFreeEx(process, LPVOID(address), size, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)) {
|
if (!VirtualFreeEx(process, LPVOID(address), size,
|
||||||
|
MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)) {
|
||||||
UNREACHABLE_MSG("Region splitting failed: {}", Common::GetLastErrorMsg());
|
UNREACHABLE_MSG("Region splitting failed: {}", Common::GetLastErrorMsg());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ struct AddressSpace::Impl {
|
||||||
region.size = size;
|
region.size = size;
|
||||||
const VAddr new_mapping_start = address + size;
|
const VAddr new_mapping_start = address + size;
|
||||||
regions.emplace_hint(std::next(it), new_mapping_start,
|
regions.emplace_hint(std::next(it), new_mapping_start,
|
||||||
MemoryRegion(new_mapping_start, region_size - size, false));
|
MemoryRegion(new_mapping_start, region_size - size, false));
|
||||||
return ®ion;
|
return ®ion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,8 @@ struct AddressSpace::Impl {
|
||||||
ASSERT(region_size >= minimum_size);
|
ASSERT(region_size >= minimum_size);
|
||||||
|
|
||||||
// Split the placeholder.
|
// Split the placeholder.
|
||||||
if (!VirtualFreeEx(process, LPVOID(address), size, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)) {
|
if (!VirtualFreeEx(process, LPVOID(address), size,
|
||||||
|
MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER)) {
|
||||||
UNREACHABLE_MSG("Region splitting failed: {}", Common::GetLastErrorMsg());
|
UNREACHABLE_MSG("Region splitting failed: {}", Common::GetLastErrorMsg());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -241,8 +242,7 @@ struct AddressSpace::Impl {
|
||||||
if (region_size == minimum_size) {
|
if (region_size == minimum_size) {
|
||||||
// Split into two; update tracked mappings and return the second one
|
// Split into two; update tracked mappings and return the second one
|
||||||
region.size = offset_in_region;
|
region.size = offset_in_region;
|
||||||
it = regions.emplace_hint(std::next(it), address,
|
it = regions.emplace_hint(std::next(it), address, MemoryRegion(address, size, false));
|
||||||
MemoryRegion(address, size, false));
|
|
||||||
return &it->second;
|
return &it->second;
|
||||||
} else {
|
} else {
|
||||||
// Split into three; update tracked mappings and return the middle one
|
// Split into three; update tracked mappings and return the middle one
|
||||||
|
@ -251,10 +251,11 @@ struct AddressSpace::Impl {
|
||||||
const size_t middle_mapping_size = size;
|
const size_t middle_mapping_size = size;
|
||||||
const VAddr after_mapping_start = address + size;
|
const VAddr after_mapping_start = address + size;
|
||||||
const size_t after_mapping_size = region_size - minimum_size;
|
const size_t after_mapping_size = region_size - minimum_size;
|
||||||
it = regions.emplace_hint(std::next(it),
|
it = regions.emplace_hint(std::next(it), after_mapping_start,
|
||||||
after_mapping_start, MemoryRegion(after_mapping_start, after_mapping_size, false));
|
MemoryRegion(after_mapping_start, after_mapping_size, false));
|
||||||
it = regions.emplace_hint(it, middle_mapping_start,
|
it = regions.emplace_hint(
|
||||||
MemoryRegion(middle_mapping_start, middle_mapping_size, false));
|
it, middle_mapping_start,
|
||||||
|
MemoryRegion(middle_mapping_start, middle_mapping_size, false));
|
||||||
return &it->second;
|
return &it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,7 +273,7 @@ struct AddressSpace::Impl {
|
||||||
if (it_prev != regions.end() && !it_prev->second.is_mapped) {
|
if (it_prev != regions.end() && !it_prev->second.is_mapped) {
|
||||||
const size_t total_size = it_prev->second.size + size;
|
const size_t total_size = it_prev->second.size + size;
|
||||||
if (!VirtualFreeEx(process, LPVOID(it_prev->first), total_size,
|
if (!VirtualFreeEx(process, LPVOID(it_prev->first), total_size,
|
||||||
MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
|
MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
|
||||||
UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
|
UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +286,8 @@ struct AddressSpace::Impl {
|
||||||
auto it_next = std::next(it);
|
auto it_next = std::next(it);
|
||||||
if (it_next != regions.end() && !it_next->second.is_mapped) {
|
if (it_next != regions.end() && !it_next->second.is_mapped) {
|
||||||
const size_t total_size = it->second.size + it_next->second.size;
|
const size_t total_size = it->second.size + it_next->second.size;
|
||||||
if (!VirtualFreeEx(process, LPVOID(it->first), total_size, MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
|
if (!VirtualFreeEx(process, LPVOID(it->first), total_size,
|
||||||
|
MEM_RELEASE | MEM_COALESCE_PLACEHOLDERS)) {
|
||||||
UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
|
UNREACHABLE_MSG("Region coalescing failed: {}", Common::GetLastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,8 +327,9 @@ struct AddressSpace::Impl {
|
||||||
const size_t range_size = std::min(region.base + region.size, virtual_end) - range_addr;
|
const size_t range_size = std::min(region.base + region.size, virtual_end) - range_addr;
|
||||||
DWORD old_flags{};
|
DWORD old_flags{};
|
||||||
if (!VirtualProtectEx(process, LPVOID(range_addr), range_size, new_flags, &old_flags)) {
|
if (!VirtualProtectEx(process, LPVOID(range_addr), range_size, new_flags, &old_flags)) {
|
||||||
UNREACHABLE_MSG("Failed to change virtual memory protection for address {:#x}, size {}",
|
UNREACHABLE_MSG(
|
||||||
range_addr, range_size);
|
"Failed to change virtual memory protection for address {:#x}, size {}",
|
||||||
|
range_addr, range_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
#include "core/file_sys/file.h"
|
#include "core/file_sys/file.h"
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#include "common/ntapi.h"
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <share.h>
|
#include <share.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include "common/ntapi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Core::FileSys {
|
namespace Core::FileSys {
|
||||||
|
@ -27,7 +27,8 @@ int File::Open(const std::filesystem::path& path, Common::FS::FileAccessMode f_a
|
||||||
} else {
|
} else {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
handle = CreateFileW(path.native().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
handle = CreateFileW(path.native().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (handle == INVALID_HANDLE_VALUE) {
|
if (handle == INVALID_HANDLE_VALUE) {
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/scope_exit.h"
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
#include "common/scope_exit.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "core/file_sys/fs.h"
|
#include "core/file_sys/fs.h"
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
|
@ -166,7 +166,8 @@ int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, i
|
||||||
const auto map_flags = static_cast<Core::MemoryMapFlags>(flags);
|
const auto map_flags = static_cast<Core::MemoryMapFlags>(flags);
|
||||||
SCOPE_EXIT {
|
SCOPE_EXIT {
|
||||||
LOG_INFO(Kernel_Vmm,
|
LOG_INFO(Kernel_Vmm,
|
||||||
"in_addr = {:#x}, out_addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, directMemoryStart = {:#x}, "
|
"in_addr = {:#x}, out_addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}, "
|
||||||
|
"directMemoryStart = {:#x}, "
|
||||||
"alignment = {:#x}",
|
"alignment = {:#x}",
|
||||||
in_addr, fmt::ptr(*addr), len, prot, flags, directMemoryStart, alignment);
|
in_addr, fmt::ptr(*addr), len, prot, flags, directMemoryStart, alignment);
|
||||||
};
|
};
|
||||||
|
@ -205,7 +206,8 @@ s32 PS4_SYSV_ABI sceKernelMapNamedFlexibleMemory(void** addr_in_out, std::size_t
|
||||||
const auto mem_prot = static_cast<Core::MemoryProt>(prot);
|
const auto mem_prot = static_cast<Core::MemoryProt>(prot);
|
||||||
const auto map_flags = static_cast<Core::MemoryMapFlags>(flags);
|
const auto map_flags = static_cast<Core::MemoryMapFlags>(flags);
|
||||||
SCOPE_EXIT {
|
SCOPE_EXIT {
|
||||||
LOG_INFO(Kernel_Vmm, "in_addr = {:#x}, out_addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}",
|
LOG_INFO(Kernel_Vmm,
|
||||||
|
"in_addr = {:#x}, out_addr = {}, len = {:#x}, prot = {:#x}, flags = {:#x}",
|
||||||
in_addr, fmt::ptr(*addr_in_out), len, prot, flags);
|
in_addr, fmt::ptr(*addr_in_out), len, prot, flags);
|
||||||
};
|
};
|
||||||
auto* memory = Core::Memory::Instance();
|
auto* memory = Core::Memory::Instance();
|
||||||
|
|
|
@ -9,46 +9,9 @@
|
||||||
#include "core/loader/elf.h"
|
#include "core/loader/elf.h"
|
||||||
#include "core/loader/symbols_resolver.h"
|
#include "core/loader/symbols_resolver.h"
|
||||||
|
|
||||||
template <size_t N>
|
|
||||||
struct StringLiteral {
|
|
||||||
constexpr StringLiteral(const char (&str)[N]) {
|
|
||||||
std::copy_n(str, N, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
char value[N];
|
|
||||||
};
|
|
||||||
|
|
||||||
template <StringLiteral name, class F, F f>
|
|
||||||
struct wrapper_impl;
|
|
||||||
|
|
||||||
template <StringLiteral name, class R, class... Args, PS4_SYSV_ABI R (*f)(Args...)>
|
|
||||||
struct wrapper_impl<name, PS4_SYSV_ABI R (*)(Args...), f> {
|
|
||||||
static R PS4_SYSV_ABI wrap(Args... args) {
|
|
||||||
if (std::string_view(name.value) != "scePthreadEqual" &&
|
|
||||||
std::string_view(name.value) != "sceUserServiceGetEvent" &&
|
|
||||||
!std::string_view(name.value).contains("scePthreadMutex") &&
|
|
||||||
!std::string_view(name.value).contains("pthread_mutex")) {
|
|
||||||
// LOG_WARNING(Core_Linker, "Function {} called", name.value);
|
|
||||||
}
|
|
||||||
if constexpr (std::is_same_v<R, s32> || std::is_same_v<R, u32>) {
|
|
||||||
const u32 ret = f(args...);
|
|
||||||
if (ret != 0 && !std::string_view(name.value).contains("pthread_equal")) {
|
|
||||||
LOG_WARNING(Core_Linker, "Function {} returned {:#x}", name.value, ret);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
// stuff
|
|
||||||
return f(args...);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <StringLiteral name, class F, F f>
|
|
||||||
constexpr auto wrapper = wrapper_impl<name, F, f>::wrap;
|
|
||||||
|
|
||||||
// #define W(foo) wrapper<#foo, decltype(&foo), foo>
|
|
||||||
#define W(foo) foo
|
#define W(foo) foo
|
||||||
|
|
||||||
#define LIB_FUNCTION(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, f) \
|
#define LIB_FUNCTION(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, function) \
|
||||||
{ \
|
{ \
|
||||||
Core::Loader::SymbolResolver sr{}; \
|
Core::Loader::SymbolResolver sr{}; \
|
||||||
sr.name = nid; \
|
sr.name = nid; \
|
||||||
|
@ -58,10 +21,8 @@ constexpr auto wrapper = wrapper_impl<name, F, f>::wrap;
|
||||||
sr.module_version_major = moduleVersionMajor; \
|
sr.module_version_major = moduleVersionMajor; \
|
||||||
sr.module_version_minor = moduleVersionMinor; \
|
sr.module_version_minor = moduleVersionMinor; \
|
||||||
sr.type = Core::Loader::SymbolType::Function; \
|
sr.type = Core::Loader::SymbolType::Function; \
|
||||||
{ \
|
auto func = reinterpret_cast<u64>(function); \
|
||||||
auto func = reinterpret_cast<u64>(wrapper<#f, decltype(&f), f>); \
|
sym->AddSymbol(sr, func); \
|
||||||
sym->AddSymbol(sr, func); \
|
|
||||||
} \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LIB_OBJ(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, function) \
|
#define LIB_OBJ(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, function) \
|
||||||
|
|
|
@ -570,7 +570,7 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
|
||||||
sizeof(u32), false);
|
sizeof(u32), false);
|
||||||
} else if (dma_data->src_sel == DmaDataSrc::Gds &&
|
} else if (dma_data->src_sel == DmaDataSrc::Gds &&
|
||||||
dma_data->dst_sel == DmaDataDst::Memory) {
|
dma_data->dst_sel == DmaDataDst::Memory) {
|
||||||
//LOG_WARNING(Render_Vulkan, "GDS memory read");
|
// LOG_WARNING(Render_Vulkan, "GDS memory read");
|
||||||
} else if (dma_data->src_sel == DmaDataSrc::Memory &&
|
} else if (dma_data->src_sel == DmaDataSrc::Memory &&
|
||||||
dma_data->dst_sel == DmaDataDst::Memory) {
|
dma_data->dst_sel == DmaDataDst::Memory) {
|
||||||
rasterizer->InlineData(dma_data->DstAddress<VAddr>(),
|
rasterizer->InlineData(dma_data->DstAddress<VAddr>(),
|
||||||
|
|
Loading…
Reference in a new issue