diff options
| author | 2015-07-17 21:55:48 -0300 | |
|---|---|---|
| committer | 2015-08-16 01:03:43 -0300 | |
| commit | b9a9ad9742d3d47375526949d5ddb48280e6c952 (patch) | |
| tree | 7fa10d9ebae362e81c89d325687e6be92b6363dd /src | |
| parent | VMManager: Change block offsets to size_t (diff) | |
| download | yuzu-b9a9ad9742d3d47375526949d5ddb48280e6c952.tar.gz yuzu-b9a9ad9742d3d47375526949d5ddb48280e6c952.tar.xz yuzu-b9a9ad9742d3d47375526949d5ddb48280e6c952.zip | |
VMManager: Make LogLayout log level configurable as a parameter
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/logging/log.h | 15 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/kernel/vm_manager.h | 2 |
4 files changed, 22 insertions, 13 deletions
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index e16dde7fc..5fd3bd7f5 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -91,17 +91,16 @@ void LogMessage(Class log_class, Level log_level, | |||
| 91 | } // namespace Log | 91 | } // namespace Log |
| 92 | 92 | ||
| 93 | #define LOG_GENERIC(log_class, log_level, ...) \ | 93 | #define LOG_GENERIC(log_class, log_level, ...) \ |
| 94 | ::Log::LogMessage(::Log::Class::log_class, ::Log::Level::log_level, \ | 94 | ::Log::LogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__) |
| 95 | __FILE__, __LINE__, __func__, __VA_ARGS__) | ||
| 96 | 95 | ||
| 97 | #ifdef _DEBUG | 96 | #ifdef _DEBUG |
| 98 | #define LOG_TRACE( log_class, ...) LOG_GENERIC(log_class, Trace, __VA_ARGS__) | 97 | #define LOG_TRACE( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Trace, __VA_ARGS__) |
| 99 | #else | 98 | #else |
| 100 | #define LOG_TRACE( log_class, ...) (void(0)) | 99 | #define LOG_TRACE( log_class, ...) (void(0)) |
| 101 | #endif | 100 | #endif |
| 102 | 101 | ||
| 103 | #define LOG_DEBUG( log_class, ...) LOG_GENERIC(log_class, Debug, __VA_ARGS__) | 102 | #define LOG_DEBUG( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Debug, __VA_ARGS__) |
| 104 | #define LOG_INFO( log_class, ...) LOG_GENERIC(log_class, Info, __VA_ARGS__) | 103 | #define LOG_INFO( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Info, __VA_ARGS__) |
| 105 | #define LOG_WARNING( log_class, ...) LOG_GENERIC(log_class, Warning, __VA_ARGS__) | 104 | #define LOG_WARNING( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Warning, __VA_ARGS__) |
| 106 | #define LOG_ERROR( log_class, ...) LOG_GENERIC(log_class, Error, __VA_ARGS__) | 105 | #define LOG_ERROR( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__) |
| 107 | #define LOG_CRITICAL(log_class, ...) LOG_GENERIC(log_class, Critical, __VA_ARGS__) | 106 | #define LOG_CRITICAL(log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__) |
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index a7892c652..ad953cdbf 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -113,7 +113,7 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) { | |||
| 113 | MapSegment(codeset->rodata, VMAPermission::Read, MemoryState::Code); | 113 | MapSegment(codeset->rodata, VMAPermission::Read, MemoryState::Code); |
| 114 | MapSegment(codeset->data, VMAPermission::ReadWrite, MemoryState::Private); | 114 | MapSegment(codeset->data, VMAPermission::ReadWrite, MemoryState::Private); |
| 115 | 115 | ||
| 116 | address_space->LogLayout(); | 116 | address_space->LogLayout(Log::Level::Debug); |
| 117 | Kernel::SetupMainThread(codeset->entrypoint, main_thread_priority); | 117 | Kernel::SetupMainThread(codeset->entrypoint, main_thread_priority); |
| 118 | } | 118 | } |
| 119 | 119 | ||
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index e5e567de1..adce9a1ee 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp | |||
| @@ -11,6 +11,15 @@ | |||
| 11 | 11 | ||
| 12 | namespace Kernel { | 12 | namespace Kernel { |
| 13 | 13 | ||
| 14 | static const char* GetMemoryStateName(MemoryState state) { | ||
| 15 | static const char* names[] = { | ||
| 16 | "Free", "Reserved", "IO", "Static", "Code", "Private", "Shared", "Continuous", "Aliased", | ||
| 17 | "Alias", "AliasCode", "Locked", | ||
| 18 | }; | ||
| 19 | |||
| 20 | return names[(int)state]; | ||
| 21 | } | ||
| 22 | |||
| 14 | bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const { | 23 | bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const { |
| 15 | ASSERT(base + size == next.base); | 24 | ASSERT(base + size == next.base); |
| 16 | if (permissions != next.permissions || | 25 | if (permissions != next.permissions || |
| @@ -134,13 +143,14 @@ void VMManager::Reprotect(VMAHandle vma_handle, VMAPermission new_perms) { | |||
| 134 | MergeAdjacent(iter); | 143 | MergeAdjacent(iter); |
| 135 | } | 144 | } |
| 136 | 145 | ||
| 137 | void VMManager::LogLayout() const { | 146 | void VMManager::LogLayout(Log::Level log_level) const { |
| 138 | for (const auto& p : vma_map) { | 147 | for (const auto& p : vma_map) { |
| 139 | const VirtualMemoryArea& vma = p.second; | 148 | const VirtualMemoryArea& vma = p.second; |
| 140 | LOG_DEBUG(Kernel, "%08X - %08X size: %8X %c%c%c", vma.base, vma.base + vma.size, vma.size, | 149 | LOG_GENERIC(Log::Class::Kernel, log_level, "%08X - %08X size: %8X %c%c%c %s", |
| 150 | vma.base, vma.base + vma.size, vma.size, | ||
| 141 | (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', | 151 | (u8)vma.permissions & (u8)VMAPermission::Read ? 'R' : '-', |
| 142 | (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', | 152 | (u8)vma.permissions & (u8)VMAPermission::Write ? 'W' : '-', |
| 143 | (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-'); | 153 | (u8)vma.permissions & (u8)VMAPermission::Execute ? 'X' : '-', GetMemoryStateName(vma.meminfo_state)); |
| 144 | } | 154 | } |
| 145 | } | 155 | } |
| 146 | 156 | ||
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index a8cf0d0d4..99cc28689 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h | |||
| @@ -170,7 +170,7 @@ public: | |||
| 170 | void Reprotect(VMAHandle vma, VMAPermission new_perms); | 170 | void Reprotect(VMAHandle vma, VMAPermission new_perms); |
| 171 | 171 | ||
| 172 | /// Dumps the address space layout to the log, for debugging | 172 | /// Dumps the address space layout to the log, for debugging |
| 173 | void LogLayout() const; | 173 | void LogLayout(Log::Level log_level) const; |
| 174 | 174 | ||
| 175 | private: | 175 | private: |
| 176 | using VMAIter = decltype(vma_map)::iterator; | 176 | using VMAIter = decltype(vma_map)::iterator; |