1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:57:35 +00:00

Kernel: Convert klog() => dmesgln() in MemoryManager

This commit is contained in:
Andreas Kling 2021-03-09 22:44:04 +01:00
parent 232738fb7a
commit b007bc07b7
2 changed files with 4 additions and 13 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -66,11 +66,6 @@ namespace Kernel {
static MemoryManager* s_the; static MemoryManager* s_the;
RecursiveSpinLock s_mm_lock; RecursiveSpinLock s_mm_lock;
const LogStream& operator<<(const LogStream& stream, const UsedMemoryRange& value)
{
return stream << UserMemoryRangeTypeNames[static_cast<int>(value.type)] << " range @ " << value.start << " - " << value.end;
}
MemoryManager& MM MemoryManager& MM
{ {
return *s_the; return *s_the;
@ -217,7 +212,7 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
auto* mmap_end = reinterpret_cast<multiboot_memory_map_t*>(low_physical_to_virtual(multiboot_info_ptr->mmap_addr) + multiboot_info_ptr->mmap_length); auto* mmap_end = reinterpret_cast<multiboot_memory_map_t*>(low_physical_to_virtual(multiboot_info_ptr->mmap_addr) + multiboot_info_ptr->mmap_length);
for (auto& used_range : m_used_memory_ranges) { for (auto& used_range : m_used_memory_ranges) {
klog() << "MM: " << used_range; dmesgln("MM: {} range @ {} - {}", UserMemoryRangeTypeNames[static_cast<int>(used_range.type)], used_range.start, used_range.end);
} }
for (auto* mmap = mmap_begin; mmap < mmap_end; mmap++) { for (auto* mmap = mmap_begin; mmap < mmap_end; mmap++) {
@ -239,7 +234,7 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::ACPI_NVS, start_address, length }); m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::ACPI_NVS, start_address, length });
break; break;
case (MULTIBOOT_MEMORY_BADRAM): case (MULTIBOOT_MEMORY_BADRAM):
klog() << "MM: Warning, detected bad memory range!"; dmesgln("MM: Warning, detected bad memory range!");
m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::BadMemory, start_address, length }); m_physical_memory_ranges.append(PhysicalMemoryRange { PhysicalMemoryRangeType::BadMemory, start_address, length });
break; break;
default: default:
@ -477,9 +472,7 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault)
dump_kernel_regions(); dump_kernel_regions();
return PageFaultResponse::ShouldCrash; return PageFaultResponse::ShouldCrash;
} }
#if PAGE_FAULT_DEBUG dbgln_if(PAGE_FAULT_DEBUG, "MM: CPU[{}] handle_page_fault({:#04x}) at {}", Processor::id(), fault.code(), fault.vaddr());
dbgln("MM: CPU[{}] handle_page_fault({:#04x}) at {}", Processor::id(), fault.code(), fault.vaddr());
#endif
auto* region = find_region_from_vaddr(fault.vaddr()); auto* region = find_region_from_vaddr(fault.vaddr());
if (!region) { if (!region) {
dmesgln("CPU[{}] NP(error) fault at invalid address {}", Processor::id(), fault.vaddr()); dmesgln("CPU[{}] NP(error) fault at invalid address {}", Processor::id(), fault.vaddr());

View file

@ -105,8 +105,6 @@ struct PhysicalMemoryRange {
size_t length {}; size_t length {};
}; };
const LogStream& operator<<(const LogStream& stream, const UsedMemoryRange& value);
#define MM Kernel::MemoryManager::the() #define MM Kernel::MemoryManager::the()
struct MemoryManagerData { struct MemoryManagerData {