diff --git a/Kernel/Devices/EBRPartitionTable.cpp b/Kernel/Devices/EBRPartitionTable.cpp index d10d3bfa85d..095fc78ecd9 100644 --- a/Kernel/Devices/EBRPartitionTable.cpp +++ b/Kernel/Devices/EBRPartitionTable.cpp @@ -27,7 +27,9 @@ #include #include -#define EBR_DEBUG +#ifndef EBR_DEBUG +# define EBR_DEBUG +#endif namespace Kernel { diff --git a/Kernel/Devices/GPTPartitionTable.cpp b/Kernel/Devices/GPTPartitionTable.cpp index f0701701edc..e5413a03369 100644 --- a/Kernel/Devices/GPTPartitionTable.cpp +++ b/Kernel/Devices/GPTPartitionTable.cpp @@ -27,7 +27,9 @@ #include #include -#define GPT_DEBUG +#ifndef GPT_DEBUG +# define GPT_DEBUG +#endif namespace Kernel { diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp index cc6e9e261fc..e5880e0897d 100644 --- a/Kernel/FileSystem/BlockBasedFileSystem.cpp +++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp @@ -124,7 +124,7 @@ bool BlockBasedFS::write_block(unsigned index, const u8* data, size_t count, siz ASSERT(m_logical_block_size); ASSERT(offset + count <= block_size()); #ifdef BBFS_DEBUG - klog() << "BlockBasedFileSystem::write_block " << index << ", size=" << data.size(); + klog() << "BlockBasedFileSystem::write_block " << index << ", size=" << count; #endif if (!allow_cache) { diff --git a/Kernel/Interrupts/IOAPIC.cpp b/Kernel/Interrupts/IOAPIC.cpp index c2a5a5c86a6..577e7969ffe 100644 --- a/Kernel/Interrupts/IOAPIC.cpp +++ b/Kernel/Interrupts/IOAPIC.cpp @@ -34,6 +34,8 @@ #include #include +//#define IOAPIC_DEBUG + #define IOAPIC_REDIRECTION_ENTRY_OFFSET 0x10 namespace Kernel { enum DeliveryMode { @@ -319,7 +321,7 @@ void IOAPIC::write_register(u32 index, u32 value) const regs->select = index; regs->window = value; #ifdef IOAPIC_DEBUG - dbg() << "IOAPIC Writing, Value 0x" << String::format("%x", regs.window) << " @ offset 0x" << String::format("%x", regs.select); + dbg() << "IOAPIC Writing, Value 0x" << String::format("%x", regs->window) << " @ offset 0x" << String::format("%x", regs->select); #endif } u32 IOAPIC::read_register(u32 index) const @@ -328,7 +330,7 @@ u32 IOAPIC::read_register(u32 index) const auto regs = map_typed_writable(m_address); regs->select = index; #ifdef IOAPIC_DEBUG - dbg() << "IOAPIC Reading, Value 0x" << String::format("%x", regs.window) << " @ offset 0x" << String::format("%x", regs.select); + dbg() << "IOAPIC Reading, Value 0x" << String::format("%x", regs->window) << " @ offset 0x" << String::format("%x", regs->select); #endif return regs->window; } diff --git a/Kernel/Interrupts/SharedIRQHandler.cpp b/Kernel/Interrupts/SharedIRQHandler.cpp index 32ff6cf0447..59334012cde 100644 --- a/Kernel/Interrupts/SharedIRQHandler.cpp +++ b/Kernel/Interrupts/SharedIRQHandler.cpp @@ -42,7 +42,7 @@ void SharedIRQHandler::initialize(u8 interrupt_number) void SharedIRQHandler::register_handler(GenericInterruptHandler& handler) { #ifdef INTERRUPT_DEBUG - klog() << "Interrupt Handler registered @ Shared Interrupt Handler " << m_interrupt_number; + klog() << "Interrupt Handler registered @ Shared Interrupt Handler " << interrupt_number(); #endif m_handlers.set(&handler); enable_interrupt_vector(); @@ -50,7 +50,7 @@ void SharedIRQHandler::register_handler(GenericInterruptHandler& handler) void SharedIRQHandler::unregister_handler(GenericInterruptHandler& handler) { #ifdef INTERRUPT_DEBUG - klog() << "Interrupt Handler unregistered @ Shared Interrupt Handler " << m_interrupt_number; + klog() << "Interrupt Handler unregistered @ Shared Interrupt Handler " << interrupt_number(); #endif m_handlers.remove(&handler); if (m_handlers.is_empty()) @@ -71,7 +71,7 @@ SharedIRQHandler::SharedIRQHandler(u8 irq) , m_responsible_irq_controller(InterruptManagement::the().get_responsible_irq_controller(irq)) { #ifdef INTERRUPT_DEBUG - klog() << "Shared Interrupt Handler registered @ " << m_interrupt_number; + klog() << "Shared Interrupt Handler registered @ " << interrupt_number(); #endif disable_interrupt_vector(); } diff --git a/Kernel/Net/E1000NetworkAdapter.cpp b/Kernel/Net/E1000NetworkAdapter.cpp index 048027f5858..787138b12da 100644 --- a/Kernel/Net/E1000NetworkAdapter.cpp +++ b/Kernel/Net/E1000NetworkAdapter.cpp @@ -24,9 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include -#include //#define E1000_DEBUG @@ -394,7 +394,7 @@ void E1000NetworkAdapter::send_raw(ReadonlyBytes payload) disable_irq(); size_t tx_current = in32(REG_TXDESCTAIL) % number_of_tx_descriptors; #ifdef E1000_DEBUG - klog() << "E1000: Sending packet (" << length << " bytes)"; + klog() << "E1000: Sending packet (" << payload.size() << " bytes)"; #endif auto* tx_descriptors = (e1000_tx_desc*)m_tx_descriptors_region->vaddr().as_ptr(); auto& descriptor = tx_descriptors[tx_current]; diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index ca7863bd9c9..a401af1e9f0 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -106,7 +106,7 @@ KResult LocalSocket::bind(Userspace user_address, socklen_t add auto path = String(address.sun_path, strnlen(address.sun_path, sizeof(address.sun_path))); #ifdef DEBUG_LOCAL_SOCKET - dbg() << "LocalSocket{" << this << "} bind(" << safe_address << ")"; + dbg() << "LocalSocket{" << this << "} bind(" << path << ")"; #endif mode_t mode = S_IFSOCK | (m_prebind_mode & 04777); @@ -349,7 +349,6 @@ KResult LocalSocket::getsockopt(FileDescription& description, int level, int opt if (level != SOL_SOCKET) return Socket::getsockopt(description, level, option, value, value_size); - socklen_t size; if (!Process::current()->validate_read_and_copy_typed(&size, value_size)) return KResult(-EFAULT); diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp index fa34a369618..82a774b75ba 100644 --- a/Kernel/Syscalls/read.cpp +++ b/Kernel/Syscalls/read.cpp @@ -27,6 +27,8 @@ #include #include +//#define DEBUG_IO + namespace Kernel { ssize_t Process::sys$read(int fd, Userspace buffer, ssize_t size) @@ -39,7 +41,7 @@ ssize_t Process::sys$read(int fd, Userspace buffer, ssize_t size) if (!validate_write(buffer, size)) return -EFAULT; #ifdef DEBUG_IO - dbg() << "sys$read(" << fd << ", " << (const void*)buffer << ", " << size << ")"; + dbg() << "sys$read(" << fd << ", " << (const void*)buffer.ptr() << ", " << size << ")"; #endif auto description = file_description(fd); if (!description) diff --git a/Kernel/Syscalls/select.cpp b/Kernel/Syscalls/select.cpp index fc742210f40..ea2bbca314f 100644 --- a/Kernel/Syscalls/select.cpp +++ b/Kernel/Syscalls/select.cpp @@ -29,6 +29,9 @@ #include #include +//#define DEBUG_IO +//#define DEBUG_POLL_SELECT + namespace Kernel { int Process::sys$select(const Syscall::SC_select_params* params) @@ -189,7 +192,7 @@ int Process::sys$poll(Userspace user_params) current_thread->m_signal_mask = sigmask; #if defined(DEBUG_IO) || defined(DEBUG_POLL_SELECT) - dbg() << "polling on (read:" << rfds.size() << ", write:" << wfds.size() << "), timeout=" << timeout; + dbg() << "polling on (read:" << rfds.size() << ", write:" << wfds.size() << "), timeout=" << timeout.tv_sec << "s" << timeout.tv_nsec << "ns"; #endif if (!params.timeout || has_timeout) {