Kernel: Unbreak building with extra debug macros, part 1

This commit is contained in:
Ben Wiederhake 2020-08-27 00:32:56 +02:00 committed by Andreas Kling
parent 8c1888811f
commit eac3bbdcee
Notes: sideshowbarker 2024-07-19 03:02:31 +09:00
9 changed files with 24 additions and 14 deletions

View file

@ -27,7 +27,9 @@
#include <AK/ByteBuffer.h>
#include <Kernel/Devices/EBRPartitionTable.h>
#define EBR_DEBUG
#ifndef EBR_DEBUG
# define EBR_DEBUG
#endif
namespace Kernel {

View file

@ -27,7 +27,9 @@
#include <AK/ByteBuffer.h>
#include <Kernel/Devices/GPTPartitionTable.h>
#define GPT_DEBUG
#ifndef GPT_DEBUG
# define GPT_DEBUG
#endif
namespace Kernel {

View file

@ -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) {

View file

@ -34,6 +34,8 @@
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/TypedMapping.h>
//#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<ioapic_mmio_regs>(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;
}

View file

@ -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();
}

View file

@ -24,9 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <Kernel/IO.h>
#include <Kernel/Net/E1000NetworkAdapter.h>
#include <Kernel/Thread.h>
#include <Kernel/IO.h>
//#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];

View file

@ -106,7 +106,7 @@ KResult LocalSocket::bind(Userspace<const sockaddr*> 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);

View file

@ -27,6 +27,8 @@
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
//#define DEBUG_IO
namespace Kernel {
ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size)
@ -39,7 +41,7 @@ ssize_t Process::sys$read(int fd, Userspace<u8*> 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)

View file

@ -29,6 +29,9 @@
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
//#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<const Syscall::SC_poll_params*> 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) {