summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-07-21 19:53:38 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-22 08:57:01 +0200
commit31f30e732a947cabdefcd3a7d3758fa5ff3601fa (patch)
tree9d492dc3592ab739a92c9e396e64e2ae1dc08f9c /Kernel
parent7bfd319652052c04999ed722d70ede7568e1907a (diff)
downloadserenity-31f30e732a947cabdefcd3a7d3758fa5ff3601fa.zip
Everywhere: Prefix hexadecimal numbers with 0x
Depending on the values it might be difficult to figure out whether a value is decimal or hexadecimal. So let's make this more obvious. Also this allows copying and pasting those numbers into GNOME calculator and probably also other apps which auto-detect the base.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Arch/x86/common/Interrupts.cpp26
-rw-r--r--Kernel/Bus/USB/USBPipe.cpp2
-rw-r--r--Kernel/Scheduler.cpp7
-rw-r--r--Kernel/Syscall.cpp2
-rw-r--r--Kernel/Syscalls/fork.cpp4
-rw-r--r--Kernel/Thread.cpp6
-rw-r--r--Kernel/VM/MemoryManager.cpp4
-rw-r--r--Kernel/VM/Range.h2
-rw-r--r--Kernel/VM/Space.cpp4
9 files changed, 24 insertions, 33 deletions
diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp
index f83570a97b..ab54d9c588 100644
--- a/Kernel/Arch/x86/common/Interrupts.cpp
+++ b/Kernel/Arch/x86/common/Interrupts.cpp
@@ -192,21 +192,21 @@ static void dump(const RegisterState& regs)
dbgln("Exception code: {:04x} (isr: {:04x})", regs.exception_code, regs.isr_number);
#if ARCH(I386)
- dbgln(" pc={:04x}:{:08x} eflags={:08x}", (u16)regs.cs, regs.eip, regs.eflags);
- dbgln(" stack={:04x}:{:08x}", ss, esp);
- dbgln(" ds={:04x} es={:04x} fs={:04x} gs={:04x}", (u16)regs.ds, (u16)regs.es, (u16)regs.fs, (u16)regs.gs);
- dbgln(" eax={:08x} ebx={:08x} ecx={:08x} edx={:08x}", regs.eax, regs.ebx, regs.ecx, regs.edx);
- dbgln(" ebp={:08x} esp={:08x} esi={:08x} edi={:08x}", regs.ebp, regs.esp, regs.esi, regs.edi);
- dbgln(" cr0={:08x} cr2={:08x} cr3={:08x} cr4={:08x}", read_cr0(), read_cr2(), read_cr3(), read_cr4());
+ dbgln(" pc={:#04x}:{:p} eflags={:p}", (u16)regs.cs, regs.eip, regs.eflags);
+ dbgln(" stack={:#04x}:{:p}", ss, esp);
+ dbgln(" ds={:#04x} es={:#04x} fs={:#04x} gs={:#04x}", (u16)regs.ds, (u16)regs.es, (u16)regs.fs, (u16)regs.gs);
+ dbgln(" eax={:p} ebx={:p} ecx={:p} edx={:p}", regs.eax, regs.ebx, regs.ecx, regs.edx);
+ dbgln(" ebp={:p} esp={:p} esi={:p} edi={:p}", regs.ebp, regs.esp, regs.esi, regs.edi);
+ dbgln(" cr0={:p} cr2={:p} cr3={:p} cr4={:p}", read_cr0(), read_cr2(), read_cr3(), read_cr4());
#else
- dbgln(" pc={:04x}:{:16x} rflags={:16x}", (u16)regs.cs, regs.rip, regs.rflags);
- dbgln(" stack={:16x}", rsp);
+ dbgln(" pc={:#04x}:{:p} rflags={:p}", (u16)regs.cs, regs.rip, regs.rflags);
+ dbgln(" stack={:p}", rsp);
// FIXME: Add fs_base and gs_base here
- dbgln(" rax={:16x} rbx={:16x} rcx={:16x} rdx={:16x}", regs.rax, regs.rbx, regs.rcx, regs.rdx);
- dbgln(" rbp={:16x} rsp={:16x} rsi={:16x} rdi={:16x}", regs.rbp, regs.rsp, regs.rsi, regs.rdi);
- dbgln(" r8={:16x} r9={:16x} r10={:16x} r11={:16x}", regs.r8, regs.r9, regs.r10, regs.r11);
- dbgln(" r12={:16x} r13={:16x} r14={:16x} r15={:16x}", regs.r12, regs.r13, regs.r14, regs.r15);
- dbgln(" cr0={:16x} cr2={:16x} cr3={:16x} cr4={:16x}", read_cr0(), read_cr2(), read_cr3(), read_cr4());
+ dbgln(" rax={:p} rbx={:p} rcx={:p} rdx={:p}", regs.rax, regs.rbx, regs.rcx, regs.rdx);
+ dbgln(" rbp={:p} rsp={:p} rsi={:p} rdi={:p}", regs.rbp, regs.rsp, regs.rsi, regs.rdi);
+ dbgln(" r8={:p} r9={:p} r10={:p} r11={:p}", regs.r8, regs.r9, regs.r10, regs.r11);
+ dbgln(" r12={:p} r13={:p} r14={:p} r15={:p}", regs.r12, regs.r13, regs.r14, regs.r15);
+ dbgln(" cr0={:p} cr2={:p} cr3={:p} cr4={:p}", read_cr0(), read_cr2(), read_cr3(), read_cr4());
#endif
}
diff --git a/Kernel/Bus/USB/USBPipe.cpp b/Kernel/Bus/USB/USBPipe.cpp
index 6e3b302fb0..29bf198742 100644
--- a/Kernel/Bus/USB/USBPipe.cpp
+++ b/Kernel/Bus/USB/USBPipe.cpp
@@ -65,7 +65,7 @@ KResultOr<size_t> Pipe::control_transfer(u8 request_type, u8 request, u16 value,
transfer->set_setup_packet(usb_request);
- dbgln_if(USB_DEBUG, "Pipe: Transfer allocated @ {:08x}", transfer->buffer_physical());
+ dbgln_if(USB_DEBUG, "Pipe: Transfer allocated @ {}", transfer->buffer_physical());
auto transfer_len_or_error = UHCIController::the().submit_control_transfer(*transfer);
if (transfer_len_or_error.is_error())
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp
index b5f19c2990..4d9de3d506 100644
--- a/Kernel/Scheduler.cpp
+++ b/Kernel/Scheduler.cpp
@@ -295,12 +295,7 @@ bool Scheduler::context_switch(Thread* thread)
from_thread->set_state(Thread::Runnable);
#ifdef LOG_EVERY_CONTEXT_SWITCH
- const auto msg =
-# if ARCH(I386)
- "Scheduler[{}]: {} -> {} [prio={}] {:04x}:{:08x}";
-# else
- "Scheduler[{}]: {} -> {} [prio={}] {:04x}:{:16x}";
-# endif
+ const auto msg = "Scheduler[{}]: {} -> {} [prio={}] {:#04x}:{:p}";
dbgln(msg,
Processor::id(), from_thread->tid().value(),
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index 4e6b1db122..91b6ceb8c1 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -109,7 +109,7 @@ KResultOr<FlatPtr> handle(RegisterState& regs, FlatPtr function, FlatPtr arg1, F
current_thread->did_syscall();
if (function >= Function::__Count) {
- dbgln("Unknown syscall {} requested ({:08x}, {:08x}, {:08x})", function, arg1, arg2, arg3);
+ dbgln("Unknown syscall {} requested ({:p}, {:p}, {:p})", function, arg1, arg2, arg3);
return ENOSYS;
}
diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp
index ac7ee055ef..7ae623c039 100644
--- a/Kernel/Syscalls/fork.cpp
+++ b/Kernel/Syscalls/fork.cpp
@@ -64,7 +64,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
child_regs.gs = regs.gs;
child_regs.ss = regs.userspace_ss;
- dbgln_if(FORK_DEBUG, "fork: child will begin executing at {:04x}:{:08x} with stack {:04x}:{:08x}, kstack {:04x}:{:08x}",
+ dbgln_if(FORK_DEBUG, "fork: child will begin executing at {:#04x}:{:p} with stack {:#04x}:{:p}, kstack {:#04x}:{:p}",
child_regs.cs, child_regs.eip, child_regs.ss, child_regs.esp, child_regs.ss0, child_regs.esp0);
#else
auto& child_regs = child_first_thread->m_regs;
@@ -88,7 +88,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
child_regs.rip = regs.rip;
child_regs.cs = regs.cs;
- dbgln_if(FORK_DEBUG, "fork: child will begin executing at {:04x}:{:16x} with stack {:08x}, kstack {:08x}",
+ dbgln_if(FORK_DEBUG, "fork: child will begin executing at {:#04x}:{:p} with stack {:p}, kstack {:p}",
child_regs.cs, child_regs.rip, child_regs.rsp, child_regs.rsp0);
#endif
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 78f5c8fb4f..82f9622bc2 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -1030,11 +1030,7 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
auto signal_trampoline_addr = process.signal_trampoline().get();
regs.set_ip_reg(signal_trampoline_addr);
-#if ARCH(I386)
- dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:04x}:{:08x} to deliver {}", state_string(), m_regs.cs, m_regs.ip(), signal);
-#else
- dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:04x}:{:16x} to deliver {}", state_string(), m_regs.cs, m_regs.ip(), signal);
-#endif
+ dbgln_if(SIGNAL_DEBUG, "Thread in state '{}' has been primed with signal handler {:#04x}:{:p} to deliver {}", state_string(), m_regs.cs, m_regs.ip(), signal);
return DispatchSignalResult::Continue;
}
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index fd178a84cd..49a3d2d131 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -1121,10 +1121,10 @@ void MemoryManager::unregister_region(Region& region)
void MemoryManager::dump_kernel_regions()
{
dbgln("Kernel regions:");
- dbgln("BEGIN END SIZE ACCESS NAME");
+ dbgln("BEGIN END SIZE ACCESS NAME");
ScopedSpinLock lock(s_mm_lock);
for (auto& region : m_kernel_regions) {
- dbgln("{:08x} -- {:08x} {:08x} {:c}{:c}{:c}{:c}{:c}{:c} {}",
+ dbgln("{:p} -- {:p} {:p} {:c}{:c}{:c}{:c}{:c}{:c} {}",
region.vaddr().get(),
region.vaddr().offset(region.size() - 1).get(),
region.size(),
diff --git a/Kernel/VM/Range.h b/Kernel/VM/Range.h
index 2cad9b71d9..e9693a44dd 100644
--- a/Kernel/VM/Range.h
+++ b/Kernel/VM/Range.h
@@ -63,6 +63,6 @@ template<>
struct AK::Formatter<Kernel::Range> : Formatter<FormatString> {
void format(FormatBuilder& builder, Kernel::Range value)
{
- return Formatter<FormatString>::format(builder, "{} - {} (size 0x{:08x})", value.base().as_ptr(), value.base().offset(value.size() - 1).as_ptr(), value.size());
+ return Formatter<FormatString>::format(builder, "{} - {} (size {:p})", value.base().as_ptr(), value.base().offset(value.size() - 1).as_ptr(), value.size());
}
};
diff --git a/Kernel/VM/Space.cpp b/Kernel/VM/Space.cpp
index 25df2a2093..db3f3c8e76 100644
--- a/Kernel/VM/Space.cpp
+++ b/Kernel/VM/Space.cpp
@@ -316,13 +316,13 @@ KResultOr<Vector<Region*, 2>> Space::try_split_region_around_range(const Region&
void Space::dump_regions()
{
dbgln("Process regions:");
- dbgln("BEGIN END SIZE ACCESS NAME");
+ dbgln("BEGIN END SIZE ACCESS NAME");
ScopedSpinLock lock(m_lock);
for (auto& sorted_region : m_regions) {
auto& region = *sorted_region;
- dbgln("{:08x} -- {:08x} {:08x} {:c}{:c}{:c}{:c}{:c}{:c} {}", region.vaddr().get(), region.vaddr().offset(region.size() - 1).get(), region.size(),
+ dbgln("{:p} -- {:p} {:p} {:c}{:c}{:c}{:c}{:c}{:c} {}", region.vaddr().get(), region.vaddr().offset(region.size() - 1).get(), region.size(),
region.is_readable() ? 'R' : ' ',
region.is_writable() ? 'W' : ' ',
region.is_executable() ? 'X' : ' ',