mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +00:00
Everywhere: Hook up remaining debug macros to Debug.h.
This commit is contained in:
parent
da69de1f1b
commit
eea72b9b5c
63 changed files with 458 additions and 287 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Types.h>
|
||||
|
@ -293,7 +294,7 @@ void KeyboardDevice::irq_handle_byte_read(u8 byte)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef KEYBOARD_DEBUG
|
||||
#if KEYBOARD_DEBUG
|
||||
dbgln("Keyboard::irq_handle_byte_read: {:#02x} {}", ch, (pressed ? "down" : "up"));
|
||||
#endif
|
||||
switch (ch) {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/StringView.h>
|
||||
|
@ -241,7 +242,7 @@ KResultOr<size_t> SB16::write(FileDescription&, size_t, const UserOrKernelBuffer
|
|||
return ENOMEM;
|
||||
}
|
||||
|
||||
#ifdef SB16_DEBUG
|
||||
#if SB16_DEBUG
|
||||
klog() << "SB16: Writing buffer of " << length << " bytes";
|
||||
#endif
|
||||
ASSERT(length <= PAGE_SIZE);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/Devices/USB/UHCIController.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
|
@ -194,7 +195,7 @@ void UHCIController::create_structures()
|
|||
transfer_descriptor->set_isochronous();
|
||||
transfer_descriptor->link_queue_head(m_interrupt_transfer_queue->paddr());
|
||||
|
||||
#ifdef UHCI_VERBOSE_DEBUG
|
||||
#if UHCI_VERBOSE_DEBUG
|
||||
transfer_descriptor->print();
|
||||
#endif
|
||||
}
|
||||
|
@ -212,13 +213,13 @@ void UHCIController::create_structures()
|
|||
// access the raw descriptor (that we later send to the controller)
|
||||
m_free_td_pool.at(i) = new (placement_addr) Kernel::USB::TransferDescriptor(paddr);
|
||||
|
||||
#ifdef UHCI_VERBOSE_DEBUG
|
||||
#if UHCI_VERBOSE_DEBUG
|
||||
auto transfer_descriptor = m_free_td_pool.at(i);
|
||||
transfer_descriptor->print();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef UHCI_DEBUG
|
||||
#if UHCI_DEBUG
|
||||
klog() << "UHCI: Pool information:";
|
||||
klog() << "\tqh_pool: " << PhysicalAddress(m_qh_pool->physical_page(0)->paddr()) << ", length: " << m_qh_pool->range().size();
|
||||
klog() << "\ttd_pool: " << PhysicalAddress(m_td_pool->physical_page(0)->paddr()) << ", length: " << m_td_pool->range().size();
|
||||
|
@ -290,7 +291,7 @@ QueueHead* UHCIController::allocate_queue_head() const
|
|||
for (QueueHead* queue_head : m_free_qh_pool) {
|
||||
if (!queue_head->in_use()) {
|
||||
queue_head->set_in_use(true);
|
||||
#ifdef UHCI_DEBUG
|
||||
#if UHCI_DEBUG
|
||||
klog() << "UHCI: Allocated a new Queue Head! Located @ " << VirtualAddress(queue_head) << "(" << PhysicalAddress(queue_head->paddr()) << ")";
|
||||
#endif
|
||||
return queue_head;
|
||||
|
@ -306,7 +307,7 @@ TransferDescriptor* UHCIController::allocate_transfer_descriptor() const
|
|||
for (TransferDescriptor* transfer_descriptor : m_free_td_pool) {
|
||||
if (!transfer_descriptor->in_use()) {
|
||||
transfer_descriptor->set_in_use(true);
|
||||
#ifdef UHCI_DEBUG
|
||||
#if UHCI_DEBUG
|
||||
klog() << "UHCI: Allocated a new Transfer Descriptor! Located @ " << VirtualAddress(transfer_descriptor) << "(" << PhysicalAddress(transfer_descriptor->paddr()) << ")";
|
||||
#endif
|
||||
return transfer_descriptor;
|
||||
|
@ -460,7 +461,7 @@ void UHCIController::handle_irq(const RegisterState&)
|
|||
if (!read_usbsts())
|
||||
return;
|
||||
|
||||
#ifdef UHCI_DEBUG
|
||||
#if UHCI_DEBUG
|
||||
klog() << "UHCI: Interrupt happened!";
|
||||
klog() << "Value of USBSTS: " << read_usbsts();
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/IntrusiveList.h>
|
||||
#include <Kernel/FileSystem/BlockBasedFileSystem.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
@ -144,7 +145,7 @@ KResult BlockBasedFS::write_block(unsigned index, const UserOrKernelBuffer& data
|
|||
{
|
||||
ASSERT(m_logical_block_size);
|
||||
ASSERT(offset + count <= block_size());
|
||||
#ifdef BBFS_DEBUG
|
||||
#if BBFS_DEBUG
|
||||
klog() << "BlockBasedFileSystem::write_block " << index << ", size=" << count;
|
||||
#endif
|
||||
|
||||
|
@ -217,7 +218,7 @@ bool BlockBasedFS::raw_write_blocks(unsigned index, size_t count, const UserOrKe
|
|||
KResult BlockBasedFS::write_blocks(unsigned index, unsigned count, const UserOrKernelBuffer& data, bool allow_cache)
|
||||
{
|
||||
ASSERT(m_logical_block_size);
|
||||
#ifdef BBFS_DEBUG
|
||||
#if BBFS_DEBUG
|
||||
klog() << "BlockBasedFileSystem::write_blocks " << index << " x" << count;
|
||||
#endif
|
||||
for (unsigned i = 0; i < count; ++i) {
|
||||
|
@ -232,7 +233,7 @@ KResult BlockBasedFS::read_block(unsigned index, UserOrKernelBuffer* buffer, siz
|
|||
{
|
||||
ASSERT(m_logical_block_size);
|
||||
ASSERT(offset + count <= block_size());
|
||||
#ifdef BBFS_DEBUG
|
||||
#if BBFS_DEBUG
|
||||
klog() << "BlockBasedFileSystem::read_block " << index;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Bitmap.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
@ -108,13 +109,13 @@ bool Ext2FS::initialize()
|
|||
ASSERT(success);
|
||||
|
||||
auto& super_block = this->super_block();
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
klog() << "ext2fs: super block magic: " << String::format("%x", super_block.s_magic) << " (super block size: " << sizeof(ext2_super_block) << ")";
|
||||
#endif
|
||||
if (super_block.s_magic != EXT2_SUPER_MAGIC)
|
||||
return false;
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
klog() << "ext2fs: " << super_block.s_inodes_count << " inodes, " << super_block.s_blocks_count << " blocks";
|
||||
klog() << "ext2fs: block size = " << EXT2_BLOCK_SIZE(&super_block);
|
||||
klog() << "ext2fs: first data block = " << super_block.s_first_data_block;
|
||||
|
@ -151,7 +152,7 @@ bool Ext2FS::initialize()
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
for (unsigned i = 1; i <= m_block_group_count; ++i) {
|
||||
auto& group = group_descriptor(i);
|
||||
klog() << "ext2fs: group[" << i << "] { block_bitmap: " << group.bg_block_bitmap << ", inode_bitmap: " << group.bg_inode_bitmap << ", inode_table: " << group.bg_inode_table << " }";
|
||||
|
@ -266,7 +267,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e
|
|||
--remaining_blocks;
|
||||
}
|
||||
if (inode_dirty) {
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: Writing {} direct block(s) to i_block array of inode {}", min((size_t)EXT2_NDIR_BLOCKS, blocks.size()), inode_index);
|
||||
for (size_t i = 0; i < min((size_t)EXT2_NDIR_BLOCKS, blocks.size()); ++i)
|
||||
dbgln(" + {}", blocks[i]);
|
||||
|
@ -287,7 +288,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e
|
|||
inode_dirty = true;
|
||||
e2inode.i_block[EXT2_IND_BLOCK] = new_indirect_block;
|
||||
if (inode_dirty) {
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: Adding the indirect block to i_block array of inode {}", inode_index);
|
||||
#endif
|
||||
write_ext2_inode(inode_index, e2inode);
|
||||
|
@ -329,7 +330,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e
|
|||
inode_dirty = true;
|
||||
e2inode.i_block[EXT2_DIND_BLOCK] = new_dindirect_block;
|
||||
if (inode_dirty) {
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: Adding the doubly-indirect block to i_block array of inode {}", inode_index);
|
||||
#endif
|
||||
write_ext2_inode(inode_index, e2inode);
|
||||
|
@ -458,7 +459,7 @@ Vector<Ext2FS::BlockIndex> Ext2FS::block_list_for_inode_impl(const ext2_inode& e
|
|||
if (is_symlink(e2inode.i_mode) && e2inode.i_blocks == 0)
|
||||
block_count = 0;
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS::block_list_for_inode(): i_size={}, i_blocks={}, block_count={}", e2inode.i_size, e2inode.i_blocks, block_count);
|
||||
#endif
|
||||
|
||||
|
@ -542,7 +543,7 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
|
|||
{
|
||||
LOCKER(m_lock);
|
||||
ASSERT(inode.m_raw_inode.i_links_count == 0);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: Inode {} has no more links, time to delete!", inode.index());
|
||||
#endif
|
||||
|
||||
|
@ -601,7 +602,7 @@ void Ext2FS::flush_writes()
|
|||
dbgln("Ext2FS: flush_writes() had error {}", result.error());
|
||||
}
|
||||
cached_bitmap->dirty = false;
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Flushed bitmap block {}", cached_bitmap->bitmap_block_index);
|
||||
#endif
|
||||
}
|
||||
|
@ -668,7 +669,7 @@ InodeMetadata Ext2FSInode::metadata() const
|
|||
void Ext2FSInode::flush_metadata()
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: flush_metadata for inode {}", index());
|
||||
#endif
|
||||
fs().write_ext2_inode(index(), m_raw_inode);
|
||||
|
@ -755,7 +756,7 @@ ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer&
|
|||
ssize_t nread = 0;
|
||||
size_t remaining_count = min((off_t)count, (off_t)size() - offset);
|
||||
|
||||
#ifdef EXT2_VERY_DEBUG
|
||||
#if EXT2_VERY_DEBUG
|
||||
dbgln("Ext2FS: Reading up to {} bytes, {} bytes into inode {} to {}", count, offset, index(), buffer.user_or_kernel_ptr());
|
||||
#endif
|
||||
|
||||
|
@ -787,7 +788,7 @@ KResult Ext2FSInode::resize(u64 new_size)
|
|||
size_t blocks_needed_before = ceil_div(old_size, block_size);
|
||||
size_t blocks_needed_after = ceil_div(new_size, block_size);
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FSInode::resize(): blocks needed before (size was {}): {}", old_size, blocks_needed_before);
|
||||
dbgln("Ext2FSInode::resize(): blocks needed after (size is {}): {}", new_size, blocks_needed_after);
|
||||
#endif
|
||||
|
@ -808,7 +809,7 @@ KResult Ext2FSInode::resize(u64 new_size)
|
|||
auto new_blocks = fs().allocate_blocks(fs().group_index_from_inode(index()), blocks_needed_after - blocks_needed_before);
|
||||
block_list.append(move(new_blocks));
|
||||
} else if (blocks_needed_after < blocks_needed_before) {
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: Shrinking inode {}. Old block list is {} entries:", index(), block_list.size());
|
||||
for (auto block_index : block_list) {
|
||||
dbgln(" # {}", block_index);
|
||||
|
@ -865,7 +866,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel
|
|||
if (is_symlink()) {
|
||||
ASSERT(offset == 0);
|
||||
if (max((size_t)(offset + count), (size_t)m_raw_inode.i_size) < max_inline_symlink_length) {
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: write_bytes poking into i_block array for inline symlink '{}' ({} bytes)", data.copy_into_string(count), count);
|
||||
#endif
|
||||
if (!data.read(((u8*)m_raw_inode.i_block) + offset, (size_t)count))
|
||||
|
@ -905,14 +906,14 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel
|
|||
ssize_t nwritten = 0;
|
||||
size_t remaining_count = min((off_t)count, (off_t)new_size - offset);
|
||||
|
||||
#ifdef EXT2_VERY_DEBUG
|
||||
#if EXT2_VERY_DEBUG
|
||||
dbgln("Ext2FS: Writing {} bytes, {} bytes into inode {} from {}", count, offset, index(), data.user_or_kernel_ptr());
|
||||
#endif
|
||||
|
||||
for (size_t bi = first_block_logical_index; remaining_count && bi <= last_block_logical_index; ++bi) {
|
||||
size_t offset_into_block = (bi == first_block_logical_index) ? offset_into_first_block : 0;
|
||||
size_t num_bytes_to_copy = min(block_size - offset_into_block, remaining_count);
|
||||
#ifdef EXT2_VERY_DEBUG
|
||||
#if EXT2_VERY_DEBUG
|
||||
dbgln("Ext2FS: Writing block {} (offset_into_block: {})", m_block_list[bi], offset_into_block);
|
||||
#endif
|
||||
auto result = fs().write_block(m_block_list[bi], data.offset(nwritten), num_bytes_to_copy, offset_into_block, allow_cache);
|
||||
|
@ -924,7 +925,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel
|
|||
nwritten += num_bytes_to_copy;
|
||||
}
|
||||
|
||||
#ifdef EXT2_VERY_DEBUG
|
||||
#if EXT2_VERY_DEBUG
|
||||
dbgln("Ext2FS: After write, i_size={}, i_blocks={} ({} blocks in list)", m_raw_inode.i_size, m_raw_inode.i_blocks, m_block_list.size());
|
||||
#endif
|
||||
|
||||
|
@ -961,7 +962,7 @@ KResult Ext2FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntr
|
|||
LOCKER(m_lock);
|
||||
ASSERT(is_directory());
|
||||
|
||||
#ifdef EXT2_VERY_DEBUG
|
||||
#if EXT2_VERY_DEBUG
|
||||
dbgln("Ext2FS: Traversing as directory: {}", index());
|
||||
#endif
|
||||
|
||||
|
@ -974,7 +975,7 @@ KResult Ext2FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntr
|
|||
|
||||
while (entry < buffer.end_pointer()) {
|
||||
if (entry->inode != 0) {
|
||||
#ifdef EXT2_VERY_DEBUG
|
||||
#if EXT2_VERY_DEBUG
|
||||
dbgln("Ext2Inode::traverse_as_directory: {}, name_len: {}, rec_len: {}, file_type: {}, name: {}", entry->inode, entry->name_len, entry->rec_len, entry->file_type, StringView(entry->name, entry->name_len));
|
||||
#endif
|
||||
if (!callback({ { entry->name, entry->name_len }, { fsid(), entry->inode }, entry->file_type }))
|
||||
|
@ -999,7 +1000,7 @@ bool Ext2FSInode::write_directory(const Vector<Ext2FSDirectoryEntry>& entries)
|
|||
int blocks_needed = ceil_div(static_cast<size_t>(directory_size), block_size);
|
||||
int occupied_size = blocks_needed * block_size;
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: New directory inode {} contents to write (size {}, occupied {}):", index(), directory_size, occupied_size);
|
||||
#endif
|
||||
|
||||
|
@ -1013,7 +1014,7 @@ bool Ext2FSInode::write_directory(const Vector<Ext2FSDirectoryEntry>& entries)
|
|||
if (i == entries.size() - 1)
|
||||
record_length += occupied_size - directory_size;
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("* Inode: {}, name_len: {}, rec_len: {}, file_type: {}, name: {}", entry.inode.index(), u16(entry.name.length()), u16(record_length), u8(entry.file_type), entry.name);
|
||||
#endif
|
||||
|
||||
|
@ -1053,7 +1054,7 @@ KResult Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode
|
|||
if (name.length() > EXT2_NAME_LEN)
|
||||
return ENAMETOOLONG;
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FSInode::add_child: Adding inode {} with name '{}' and mode {:o} to directory {}", child.index(), name, mode, index());
|
||||
#endif
|
||||
|
||||
|
@ -1092,7 +1093,7 @@ KResult Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode
|
|||
KResult Ext2FSInode::remove_child(const StringView& name)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FSInode::remove_child('{}') in inode {}", name, index());
|
||||
#endif
|
||||
ASSERT(is_directory());
|
||||
|
@ -1104,7 +1105,7 @@ KResult Ext2FSInode::remove_child(const StringView& name)
|
|||
|
||||
InodeIdentifier child_id { fsid(), child_inode_index };
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FSInode::remove_child(): Removing '{}' in directory {}", name, index());
|
||||
#endif
|
||||
|
||||
|
@ -1167,14 +1168,14 @@ bool Ext2FS::write_ext2_inode(unsigned inode, const ext2_inode& e2inode)
|
|||
Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: allocate_blocks(preferred group: {}, count {})", preferred_group_index, count);
|
||||
#endif
|
||||
if (count == 0)
|
||||
return {};
|
||||
|
||||
Vector<BlockIndex> blocks;
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: allocate_blocks:");
|
||||
#endif
|
||||
blocks.ensure_capacity(count);
|
||||
|
@ -1212,14 +1213,14 @@ Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_in
|
|||
size_t free_region_size = 0;
|
||||
auto first_unset_bit_index = block_bitmap.find_longest_range_of_unset_bits(count - blocks.size(), free_region_size);
|
||||
ASSERT(first_unset_bit_index.has_value());
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: allocating free region of size: {} [{}]", free_region_size, group_index);
|
||||
#endif
|
||||
for (size_t i = 0; i < free_region_size; ++i) {
|
||||
BlockIndex block_index = (first_unset_bit_index.value() + i) + first_block_in_group;
|
||||
set_block_allocation_state(block_index, true);
|
||||
blocks.unchecked_append(block_index);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln(" allocated > {}", block_index);
|
||||
#endif
|
||||
}
|
||||
|
@ -1234,13 +1235,13 @@ unsigned Ext2FS::find_a_free_inode(GroupIndex preferred_group, off_t expected_si
|
|||
ASSERT(expected_size >= 0);
|
||||
|
||||
LOCKER(m_lock);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: find_a_free_inode(preferred_group: {}, expected_size: {})", preferred_group, expected_size);
|
||||
#endif
|
||||
|
||||
unsigned needed_blocks = ceil_div(static_cast<size_t>(expected_size), block_size());
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: minimum needed blocks: {}", needed_blocks);
|
||||
#endif
|
||||
|
||||
|
@ -1267,7 +1268,7 @@ unsigned Ext2FS::find_a_free_inode(GroupIndex preferred_group, off_t expected_si
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: find_a_free_inode: found suitable group [{}] for new inode with {} blocks needed :^)", group_index, needed_blocks);
|
||||
#endif
|
||||
|
||||
|
@ -1292,7 +1293,7 @@ unsigned Ext2FS::find_a_free_inode(GroupIndex preferred_group, off_t expected_si
|
|||
}
|
||||
|
||||
unsigned inode = first_free_inode_in_group;
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: found suitable inode {}", inode);
|
||||
#endif
|
||||
|
||||
|
@ -1339,7 +1340,7 @@ bool Ext2FS::set_inode_allocation_state(InodeIndex inode_index, bool new_state)
|
|||
auto& cached_bitmap = get_bitmap_block(bgd.bg_inode_bitmap);
|
||||
|
||||
bool current_state = cached_bitmap.bitmap(inodes_per_group()).get(bit_index);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: set_inode_allocation_state({}) {} -> {}", inode_index, current_state, new_state);
|
||||
#endif
|
||||
|
||||
|
@ -1402,7 +1403,7 @@ bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state)
|
|||
auto& cached_bitmap = get_bitmap_block(bgd.bg_block_bitmap);
|
||||
|
||||
bool current_state = cached_bitmap.bitmap(blocks_per_group()).get(bit_index);
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: block {} state: {} -> {} (in bitmap block {})", block_index, current_state, new_state, bgd.bg_block_bitmap);
|
||||
#endif
|
||||
|
||||
|
@ -1446,7 +1447,7 @@ KResult Ext2FS::create_directory(InodeIdentifier parent_id, const String& name,
|
|||
|
||||
auto& inode = inode_or_error.value();
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: create_directory: created new directory named '{} with inode {}", name, inode->index());
|
||||
#endif
|
||||
|
||||
|
@ -1483,7 +1484,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(InodeIdentifier parent_id,
|
|||
if (name.length() > EXT2_NAME_LEN)
|
||||
return ENAMETOOLONG;
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: Adding inode '{}' (mode {:o}) to parent directory {}", name, mode, parent_inode->index());
|
||||
#endif
|
||||
|
||||
|
@ -1532,7 +1533,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(InodeIdentifier parent_id,
|
|||
if (result.is_error())
|
||||
return result;
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
#if EXT2_DEBUG
|
||||
dbgln("Ext2FS: writing initial metadata for inode {}", inode_id);
|
||||
#endif
|
||||
e2inode.i_flags = 0;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
@ -114,12 +115,12 @@ void FIFO::attach(Direction direction)
|
|||
{
|
||||
if (direction == Direction::Reader) {
|
||||
++m_readers;
|
||||
#ifdef FIFO_DEBUG
|
||||
#if FIFO_DEBUG
|
||||
klog() << "open reader (" << m_readers << ")";
|
||||
#endif
|
||||
} else if (direction == Direction::Writer) {
|
||||
++m_writers;
|
||||
#ifdef FIFO_DEBUG
|
||||
#if FIFO_DEBUG
|
||||
klog() << "open writer (" << m_writers << ")";
|
||||
#endif
|
||||
}
|
||||
|
@ -130,13 +131,13 @@ void FIFO::attach(Direction direction)
|
|||
void FIFO::detach(Direction direction)
|
||||
{
|
||||
if (direction == Direction::Reader) {
|
||||
#ifdef FIFO_DEBUG
|
||||
#if FIFO_DEBUG
|
||||
klog() << "close reader (" << m_readers << " - 1)";
|
||||
#endif
|
||||
ASSERT(m_readers);
|
||||
--m_readers;
|
||||
} else if (direction == Direction::Writer) {
|
||||
#ifdef FIFO_DEBUG
|
||||
#if FIFO_DEBUG
|
||||
klog() << "close writer (" << m_writers << " - 1)";
|
||||
#endif
|
||||
ASSERT(m_writers);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
#define KMALLOC_SCRUB_BYTE 0xbb
|
||||
|
@ -54,7 +55,7 @@ inline void* operator new[](size_t, void* p) { return p; }
|
|||
|
||||
[[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] ALWAYS_INLINE void* kmalloc(size_t size)
|
||||
{
|
||||
#ifdef KMALLOC_DEBUG_LARGE_ALLOCATIONS
|
||||
#if KMALLOC_DEBUG_LARGE_ALLOCATIONS
|
||||
// Any kernel allocation >= 1M is 99.9% a bug.
|
||||
if (size >= 1048576)
|
||||
asm volatile("cli;hlt");
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/StringView.h>
|
||||
|
@ -244,7 +245,7 @@ bool APIC::init_bsp()
|
|||
return false;
|
||||
|
||||
PhysicalAddress apic_base = get_base();
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "Initializing APIC, base: " << apic_base;
|
||||
#endif
|
||||
set_base(apic_base);
|
||||
|
@ -274,7 +275,7 @@ bool APIC::init_bsp()
|
|||
size_t entry_length = madt_entry->length;
|
||||
if (madt_entry->type == (u8)ACPI::Structures::MADTEntryType::LocalAPIC) {
|
||||
auto* plapic_entry = (const ACPI::Structures::MADTEntries::ProcessorLocalAPIC*)madt_entry;
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: AP found @ MADT entry " << entry_index << ", Processor Id: " << String::format("%02x", plapic_entry->acpi_processor_id)
|
||||
<< " APIC Id: " << String::format("%02x", plapic_entry->apic_id) << " Flags: " << String::format("%08x", plapic_entry->flags);
|
||||
#endif
|
||||
|
@ -327,7 +328,7 @@ void APIC::do_boot_aps()
|
|||
ASSERT(aps_to_enable == apic_ap_stacks.size());
|
||||
for (size_t i = 0; i < aps_to_enable; i++) {
|
||||
ap_stack_array[i] = apic_ap_stacks[i]->vaddr().get() + Thread::default_kernel_stack_size;
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: CPU[" << (i + 1) << "] stack at " << VirtualAddress(ap_stack_array[i]);
|
||||
#endif
|
||||
}
|
||||
|
@ -339,7 +340,7 @@ void APIC::do_boot_aps()
|
|||
auto ap_processor_info_array = &ap_stack_array[aps_to_enable];
|
||||
for (size_t i = 0; i < aps_to_enable; i++) {
|
||||
ap_processor_info_array[i] = FlatPtr(m_ap_processor_info[i].ptr());
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: CPU[" << (i + 1) << "] Processor at " << VirtualAddress(ap_processor_info_array[i]);
|
||||
#endif
|
||||
}
|
||||
|
@ -366,7 +367,7 @@ void APIC::do_boot_aps()
|
|||
for (u32 i = 0; i < aps_to_enable; i++)
|
||||
m_ap_idle_threads[i] = Scheduler::create_ap_idle_thread(i + 1);
|
||||
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: Starting " << aps_to_enable << " AP(s)";
|
||||
#endif
|
||||
|
||||
|
@ -384,7 +385,7 @@ void APIC::do_boot_aps()
|
|||
|
||||
// Now wait until the ap_cpu_init_pending variable dropped to 0, which means all APs are initialized and no longer need these special mappings
|
||||
if (m_apic_ap_count.load(AK::MemoryOrder::memory_order_consume) != aps_to_enable) {
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: Waiting for " << aps_to_enable << " AP(s) to finish initialization...";
|
||||
#endif
|
||||
do {
|
||||
|
@ -393,7 +394,7 @@ void APIC::do_boot_aps()
|
|||
} while (m_apic_ap_count.load(AK::MemoryOrder::memory_order_consume) != aps_to_enable);
|
||||
}
|
||||
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: " << m_processor_enabled_cnt << " processors are initialized and running";
|
||||
#endif
|
||||
}
|
||||
|
@ -410,7 +411,7 @@ void APIC::boot_aps()
|
|||
// Enable SMP, which means IPIs may now be sent
|
||||
Processor::smp_enable();
|
||||
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
dbgln("All processors initialized and waiting, trigger all to continue");
|
||||
#endif
|
||||
|
||||
|
@ -435,7 +436,7 @@ void APIC::enable(u32 cpu)
|
|||
apic_id = read_register(APIC_REG_LD) >> 24;
|
||||
Processor::current().info().set_apic_id(apic_id);
|
||||
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "Enabling local APIC for cpu #" << cpu << " apic id: " << apic_id;
|
||||
#endif
|
||||
|
||||
|
@ -482,7 +483,7 @@ void APIC::init_finished(u32 cpu)
|
|||
|
||||
// Notify the BSP that we are done initializing. It will unmap the startup data at P8000
|
||||
m_apic_ap_count.fetch_add(1, AK::MemoryOrder::memory_order_acq_rel);
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: cpu #" << cpu << " initialized, waiting for all others";
|
||||
#endif
|
||||
|
||||
|
@ -493,7 +494,7 @@ void APIC::init_finished(u32 cpu)
|
|||
IO::delay(200);
|
||||
}
|
||||
|
||||
#ifdef APIC_DEBUG
|
||||
#if APIC_DEBUG
|
||||
klog() << "APIC: cpu #" << cpu << " continues, all others are initialized";
|
||||
#endif
|
||||
|
||||
|
@ -506,7 +507,7 @@ void APIC::init_finished(u32 cpu)
|
|||
|
||||
void APIC::broadcast_ipi()
|
||||
{
|
||||
#ifdef APIC_SMP_DEBUG
|
||||
#if APIC_SMP_DEBUG
|
||||
klog() << "SMP: Broadcast IPI from cpu #" << Processor::current().id();
|
||||
#endif
|
||||
wait_for_pending_icr();
|
||||
|
@ -516,7 +517,7 @@ void APIC::broadcast_ipi()
|
|||
void APIC::send_ipi(u32 cpu)
|
||||
{
|
||||
auto& proc = Processor::current();
|
||||
#ifdef APIC_SMP_DEBUG
|
||||
#if APIC_SMP_DEBUG
|
||||
klog() << "SMP: Send IPI from cpu #" << proc.id() << " to cpu #" << cpu;
|
||||
#endif
|
||||
ASSERT(cpu != proc.id());
|
||||
|
@ -603,14 +604,14 @@ u32 APIC::get_timer_divisor()
|
|||
|
||||
void APICIPIInterruptHandler::handle_interrupt(const RegisterState&)
|
||||
{
|
||||
#ifdef APIC_SMP_DEBUG
|
||||
#if APIC_SMP_DEBUG
|
||||
klog() << "APIC IPI on cpu #" << Processor::current().id();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool APICIPIInterruptHandler::eoi()
|
||||
{
|
||||
#ifdef APIC_SMP_DEBUG
|
||||
#if APIC_SMP_DEBUG
|
||||
klog() << "SMP: IPI eoi";
|
||||
#endif
|
||||
APIC::the().eoi();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Net/ARP.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
|
@ -89,7 +90,7 @@ void NetworkTask_main(void*)
|
|||
return;
|
||||
packet_size = adapter.dequeue_packet(buffer, buffer_size, packet_timestamp);
|
||||
pending_packets--;
|
||||
#ifdef NETWORK_TASK_DEBUG
|
||||
#if NETWORK_TASK_DEBUG
|
||||
klog() << "NetworkTask: Dequeued packet from " << adapter.name().characters() << " (" << packet_size << " bytes)";
|
||||
#endif
|
||||
});
|
||||
|
@ -113,11 +114,11 @@ void NetworkTask_main(void*)
|
|||
continue;
|
||||
}
|
||||
auto& eth = *(const EthernetFrameHeader*)buffer;
|
||||
#ifdef ETHERNET_DEBUG
|
||||
#if ETHERNET_DEBUG
|
||||
dbgln("NetworkTask: From {} to {}, ether_type={:#04x}, packet_size={}", eth.source().to_string(), eth.destination().to_string(), eth.ether_type(), packet_size);
|
||||
#endif
|
||||
|
||||
#ifdef ETHERNET_VERY_DEBUG
|
||||
#if ETHERNET_VERY_DEBUG
|
||||
for (size_t i = 0; i < packet_size; i++) {
|
||||
klog() << String::format("%#02x", buffer[i]);
|
||||
|
||||
|
@ -170,7 +171,7 @@ void handle_arp(const EthernetFrameHeader& eth, size_t frame_size)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef ARP_DEBUG
|
||||
#if ARP_DEBUG
|
||||
dbgln("handle_arp: operation={:#04x}, sender={}/{}, target={}/{}",
|
||||
packet.operation(),
|
||||
packet.sender_hardware_address().to_string(),
|
||||
|
@ -224,7 +225,7 @@ void handle_ipv4(const EthernetFrameHeader& eth, size_t frame_size, const timeva
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef IPV4_DEBUG
|
||||
#if IPV4_DEBUG
|
||||
klog() << "handle_ipv4: source=" << packet.source().to_string().characters() << ", target=" << packet.destination().to_string().characters();
|
||||
#endif
|
||||
|
||||
|
@ -244,7 +245,7 @@ void handle_ipv4(const EthernetFrameHeader& eth, size_t frame_size, const timeva
|
|||
void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
||||
{
|
||||
auto& icmp_header = *static_cast<const ICMPHeader*>(ipv4_packet.payload());
|
||||
#ifdef ICMP_DEBUG
|
||||
#if ICMP_DEBUG
|
||||
dbgln("handle_icmp: source={}, destination={}, type={:#02x}, code={:#02x}", ipv4_packet.source().to_string(), ipv4_packet.destination().to_string(), icmp_header.type(), icmp_header.code());
|
||||
#endif
|
||||
|
||||
|
@ -299,7 +300,7 @@ void handle_udp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
|||
}
|
||||
|
||||
auto& udp_packet = *static_cast<const UDPPacket*>(ipv4_packet.payload());
|
||||
#ifdef UDP_DEBUG
|
||||
#if UDP_DEBUG
|
||||
klog() << "handle_udp: source=" << ipv4_packet.source().to_string().characters() << ":" << udp_packet.source_port() << ", destination=" << ipv4_packet.destination().to_string().characters() << ":" << udp_packet.destination_port() << " length=" << udp_packet.length();
|
||||
#endif
|
||||
|
||||
|
@ -336,7 +337,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
|||
|
||||
size_t payload_size = ipv4_packet.payload_size() - tcp_packet.header_size();
|
||||
|
||||
#ifdef TCP_DEBUG
|
||||
#if TCP_DEBUG
|
||||
dbgln("handle_tcp: source={}:{}, destination={}:{}, seq_no={}, ack_no={}, flags={:#04x} ({}{}{}{}), window_size={}, payload_size={}",
|
||||
ipv4_packet.source().to_string(),
|
||||
tcp_packet.source_port(),
|
||||
|
@ -361,7 +362,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
|||
|
||||
IPv4SocketTuple tuple(ipv4_packet.destination(), tcp_packet.destination_port(), ipv4_packet.source(), tcp_packet.source_port());
|
||||
|
||||
#ifdef TCP_DEBUG
|
||||
#if TCP_DEBUG
|
||||
klog() << "handle_tcp: looking for socket; tuple=" << tuple.to_string().characters();
|
||||
#endif
|
||||
|
||||
|
@ -389,7 +390,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
|||
ASSERT(socket->type() == SOCK_STREAM);
|
||||
ASSERT(socket->local_port() == tcp_packet.destination_port());
|
||||
|
||||
#ifdef TCP_DEBUG
|
||||
#if TCP_DEBUG
|
||||
klog() << "handle_tcp: got socket; state=" << socket->tuple().to_string().characters() << " " << TCPSocket::to_string(socket->state());
|
||||
#endif
|
||||
|
||||
|
@ -409,7 +410,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
|||
case TCPSocket::State::Listen:
|
||||
switch (tcp_packet.flags()) {
|
||||
case TCPFlags::SYN: {
|
||||
#ifdef TCP_DEBUG
|
||||
#if TCP_DEBUG
|
||||
klog() << "handle_tcp: incoming connection";
|
||||
#endif
|
||||
auto& local_address = ipv4_packet.destination();
|
||||
|
@ -420,7 +421,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
|||
return;
|
||||
}
|
||||
LOCKER(client->lock());
|
||||
#ifdef TCP_DEBUG
|
||||
#if TCP_DEBUG
|
||||
klog() << "handle_tcp: created new client socket with tuple " << client->tuple().to_string().characters();
|
||||
#endif
|
||||
client->set_sequence_number(1000);
|
||||
|
@ -584,7 +585,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
|
|||
|
||||
socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
|
||||
|
||||
#ifdef TCP_DEBUG
|
||||
#if TCP_DEBUG
|
||||
klog() << "Got packet with ack_no=" << tcp_packet.ack_number() << ", seq_no=" << tcp_packet.sequence_number() << ", payload_size=" << payload_size << ", acking it with new ack_no=" << socket->ack_number() << ", seq_no=" << socket->sequence_number();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/MACAddress.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Net/RTL8139NetworkAdapter.h>
|
||||
|
@ -185,7 +186,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
|
|||
|
||||
m_entropy_source.add_random_event(status);
|
||||
|
||||
#ifdef RTL8139_DEBUG
|
||||
#if RTL8139_DEBUG
|
||||
klog() << "RTL8139NetworkAdapter::handle_irq status=0x" << String::format("%x", status);
|
||||
#endif
|
||||
|
||||
|
@ -193,7 +194,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
|
|||
break;
|
||||
|
||||
if (status & INT_RXOK) {
|
||||
#ifdef RTL8139_DEBUG
|
||||
#if RTL8139_DEBUG
|
||||
klog() << "RTL8139NetworkAdapter: rx ready";
|
||||
#endif
|
||||
receive();
|
||||
|
@ -203,7 +204,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
|
|||
reset();
|
||||
}
|
||||
if (status & INT_TXOK) {
|
||||
#ifdef RTL8139_DEBUG
|
||||
#if RTL8139_DEBUG
|
||||
klog() << "RTL8139NetworkAdapter: tx complete";
|
||||
#endif
|
||||
}
|
||||
|
@ -291,7 +292,7 @@ void RTL8139NetworkAdapter::read_mac_address()
|
|||
|
||||
void RTL8139NetworkAdapter::send_raw(ReadonlyBytes payload)
|
||||
{
|
||||
#ifdef RTL8139_DEBUG
|
||||
#if RTL8139_DEBUG
|
||||
klog() << "RTL8139NetworkAdapter::send_raw length=" << payload.size();
|
||||
#endif
|
||||
|
||||
|
@ -315,7 +316,7 @@ void RTL8139NetworkAdapter::send_raw(ReadonlyBytes payload)
|
|||
klog() << "RTL8139NetworkAdapter: hardware buffers full; discarding packet";
|
||||
return;
|
||||
} else {
|
||||
#ifdef RTL8139_DEBUG
|
||||
#if RTL8139_DEBUG
|
||||
klog() << "RTL8139NetworkAdapter: chose buffer " << hw_buffer << " @ " << PhysicalAddress(m_tx_buffers[hw_buffer]);
|
||||
#endif
|
||||
m_tx_next_buffer = (hw_buffer + 1) % 4;
|
||||
|
@ -330,7 +331,7 @@ void RTL8139NetworkAdapter::send_raw(ReadonlyBytes payload)
|
|||
// 60 bytes if necessary to make sure the whole thing is large enough.
|
||||
auto length = payload.size();
|
||||
if (length < 60) {
|
||||
#ifdef RTL8139_DEBUG
|
||||
#if RTL8139_DEBUG
|
||||
klog() << "RTL8139NetworkAdapter: adjusting payload size from " << length << " to 60";
|
||||
#endif
|
||||
length = 60;
|
||||
|
@ -346,7 +347,7 @@ void RTL8139NetworkAdapter::receive()
|
|||
u16 status = *(const u16*)(start_of_packet + 0);
|
||||
u16 length = *(const u16*)(start_of_packet + 2);
|
||||
|
||||
#ifdef RTL8139_DEBUG
|
||||
#if RTL8139_DEBUG
|
||||
klog() << "RTL8139NetworkAdapter::receive status=0x" << String::format("%x", status) << " length=" << length << " offset=" << m_rx_buffer_offset;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <Kernel/Net/LoopbackAdapter.h>
|
||||
|
@ -179,7 +180,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
|
|||
return { local_adapter, local_adapter->mac_address() };
|
||||
|
||||
if (!local_adapter && !gateway_adapter) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
#if ROUTING_DEBUG
|
||||
klog() << "Routing: Couldn't find a suitable adapter for route to " << target.to_string().characters();
|
||||
#endif
|
||||
return { nullptr, {} };
|
||||
|
@ -189,13 +190,13 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
|
|||
IPv4Address next_hop_ip;
|
||||
|
||||
if (local_adapter) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
#if ROUTING_DEBUG
|
||||
klog() << "Routing: Got adapter for route (direct): " << local_adapter->name().characters() << " (" << local_adapter->ipv4_address().to_string().characters() << "/" << local_adapter->ipv4_netmask().to_string().characters() << ") for " << target.to_string().characters();
|
||||
#endif
|
||||
adapter = local_adapter;
|
||||
next_hop_ip = target;
|
||||
} else if (gateway_adapter) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
#if ROUTING_DEBUG
|
||||
klog() << "Routing: Got adapter for route (using gateway " << gateway_adapter->ipv4_gateway().to_string().characters() << "): " << gateway_adapter->name().characters() << " (" << gateway_adapter->ipv4_address().to_string().characters() << "/" << gateway_adapter->ipv4_netmask().to_string().characters() << ") for " << target.to_string().characters();
|
||||
#endif
|
||||
adapter = gateway_adapter;
|
||||
|
@ -208,14 +209,14 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
|
|||
LOCKER(arp_table().lock());
|
||||
auto addr = arp_table().resource().get(next_hop_ip);
|
||||
if (addr.has_value()) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
#if ROUTING_DEBUG
|
||||
klog() << "Routing: Using cached ARP entry for " << next_hop_ip.to_string().characters() << " (" << addr.value().to_string().characters() << ")";
|
||||
#endif
|
||||
return { adapter, addr.value() };
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ROUTING_DEBUG
|
||||
#if ROUTING_DEBUG
|
||||
klog() << "Routing: Sending ARP request via adapter " << adapter->name().characters() << " for IPv4 address " << next_hop_ip.to_string().characters();
|
||||
#endif
|
||||
|
||||
|
@ -230,14 +231,14 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
|
|||
Optional<MACAddress> addr;
|
||||
if (!Thread::current()->block<ARPTableBlocker>({}, next_hop_ip, addr).was_interrupted()) {
|
||||
if (addr.has_value()) {
|
||||
#ifdef ROUTING_DEBUG
|
||||
#if ROUTING_DEBUG
|
||||
klog() << "Routing: Got ARP response using adapter " << adapter->name().characters() << " for " << next_hop_ip.to_string().characters() << " (" << addr.value().to_string().characters() << ")";
|
||||
#endif
|
||||
return { adapter, addr.value() };
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ROUTING_DEBUG
|
||||
#if ROUTING_DEBUG
|
||||
klog() << "Routing: Couldn't find route using adapter " << adapter->name().characters() << " for " << target.to_string().characters();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Storage/Partition/DiskPartition.h>
|
||||
|
||||
|
@ -60,7 +61,7 @@ KResultOr<size_t> DiskPartition::read(FileDescription& fd, size_t offset, UserOr
|
|||
{
|
||||
unsigned adjust = m_metadata.start_block() * block_size();
|
||||
|
||||
#ifdef OFFD_DEBUG
|
||||
#if OFFD_DEBUG
|
||||
klog() << "DiskPartition::read offset=" << fd.offset() << " adjust=" << adjust << " len=" << len;
|
||||
#endif
|
||||
|
||||
|
@ -71,7 +72,7 @@ bool DiskPartition::can_read(const FileDescription& fd, size_t offset) const
|
|||
{
|
||||
unsigned adjust = m_metadata.start_block() * block_size();
|
||||
|
||||
#ifdef OFFD_DEBUG
|
||||
#if OFFD_DEBUG
|
||||
klog() << "DiskPartition::can_read offset=" << offset << " adjust=" << adjust;
|
||||
#endif
|
||||
|
||||
|
@ -82,7 +83,7 @@ KResultOr<size_t> DiskPartition::write(FileDescription& fd, size_t offset, const
|
|||
{
|
||||
unsigned adjust = m_metadata.start_block() * block_size();
|
||||
|
||||
#ifdef OFFD_DEBUG
|
||||
#if OFFD_DEBUG
|
||||
klog() << "DiskPartition::write offset=" << offset << " adjust=" << adjust << " len=" << len;
|
||||
#endif
|
||||
|
||||
|
@ -93,7 +94,7 @@ bool DiskPartition::can_write(const FileDescription& fd, size_t offset) const
|
|||
{
|
||||
unsigned adjust = m_metadata.start_block() * block_size();
|
||||
|
||||
#ifdef OFFD_DEBUG
|
||||
#if OFFD_DEBUG
|
||||
klog() << "DiskPartition::can_write offset=" << offset << " adjust=" << adjust;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include <AK/ByteBuffer.h>
|
||||
#include <Kernel/Storage/Partition/EBRPartitionTable.h>
|
||||
|
||||
#ifndef EBR_DEBUG
|
||||
# define EBR_DEBUG
|
||||
#endif
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
Result<NonnullOwnPtr<EBRPartitionTable>, PartitionTable::Error> EBRPartitionTable::try_to_initialize(const StorageDevice& device)
|
||||
|
|
|
@ -26,12 +26,9 @@
|
|||
|
||||
#include <AK/AllOf.h>
|
||||
#include <AK/Array.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/Storage/Partition/GUIDPartitionTable.h>
|
||||
|
||||
#ifndef GPT_DEBUG
|
||||
# define GPT_DEBUG
|
||||
#endif
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
#define GPT_SIGNATURE2 0x54524150
|
||||
|
@ -103,7 +100,7 @@ bool GUIDPartitionTable::initialize()
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef GPT_DEBUG
|
||||
#if GPT_DEBUG
|
||||
klog() << "GUIDPartitionTable: signature - 0x" << String::format("%x", header().sig[1]) << String::format("%x", header().sig[0]);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,12 +25,9 @@
|
|||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/Storage/Partition/MBRPartitionTable.h>
|
||||
|
||||
#ifndef MBR_DEBUG
|
||||
# define MBR_DEBUG
|
||||
#endif
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
#define MBR_SIGNATURE 0xaa55
|
||||
|
@ -123,7 +120,7 @@ const MBRPartitionTable::Header& MBRPartitionTable::header() const
|
|||
bool MBRPartitionTable::initialize()
|
||||
{
|
||||
auto& header = this->header();
|
||||
#ifdef MBR_DEBUG
|
||||
#if MBR_DEBUG
|
||||
|
||||
klog() << "Master Boot Record: mbr_signature=0x" << String::format("%x", header.mbr_signature);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
|
@ -63,7 +64,7 @@ KResultOr<size_t> StorageDevice::read(FileDescription&, size_t offset, UserOrKer
|
|||
remaining = 0;
|
||||
}
|
||||
|
||||
#ifdef STORAGE_DEVICE_DEBUG
|
||||
#if STORAGE_DEVICE_DEBUG
|
||||
klog() << "StorageDevice::read() index=" << index << " whole_blocks=" << whole_blocks << " remaining=" << remaining;
|
||||
#endif
|
||||
|
||||
|
@ -130,7 +131,7 @@ KResultOr<size_t> StorageDevice::write(FileDescription&, size_t offset, const Us
|
|||
remaining = 0;
|
||||
}
|
||||
|
||||
#ifdef STORAGE_DEVICE_DEBUG
|
||||
#if STORAGE_DEVICE_DEBUG
|
||||
klog() << "StorageDevice::write() index=" << index << " whole_blocks=" << whole_blocks << " remaining=" << remaining;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
|
@ -446,7 +447,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
ASSERT(is_user_process());
|
||||
ASSERT(!Processor::current().in_critical());
|
||||
auto path = main_program_description->absolute_path();
|
||||
#ifdef EXEC_DEBUG
|
||||
#if EXEC_DEBUG
|
||||
dbgln("do_exec({})", path);
|
||||
#endif
|
||||
|
||||
|
@ -511,7 +512,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
|
||||
kill_threads_except_self();
|
||||
|
||||
#ifdef EXEC_DEBUG
|
||||
#if EXEC_DEBUG
|
||||
dbgln("Memory layout after ELF load:");
|
||||
dump_regions();
|
||||
#endif
|
||||
|
@ -703,7 +704,7 @@ KResultOr<RefPtr<FileDescription>> Process::find_elf_interpreter_for_executable(
|
|||
|
||||
if (!interpreter_path.is_empty()) {
|
||||
|
||||
#ifdef EXEC_DEBUG
|
||||
#if EXEC_DEBUG
|
||||
dbgln("exec({}): Using program interpreter {}", path, interpreter_path);
|
||||
#endif
|
||||
auto interp_result = VFS::the().open(interpreter_path, O_EXEC, 0, current_directory());
|
||||
|
|
|
@ -50,7 +50,7 @@ RefPtr<VMObject> AnonymousVMObject::clone()
|
|||
});
|
||||
}
|
||||
|
||||
#ifdef COMMIT_DEBUG
|
||||
#if COMMIT_DEBUG
|
||||
klog() << "Cloning " << this << ", need " << need_cow_pages << " committed cow pages";
|
||||
#endif
|
||||
if (!MM.commit_user_physical_pages(need_cow_pages))
|
||||
|
@ -311,7 +311,7 @@ void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range)
|
|||
|
||||
// Return those committed pages back to the system
|
||||
if (uncommit_page_count > 0) {
|
||||
#ifdef COMMIT_DEBUG
|
||||
#if COMMIT_DEBUG
|
||||
klog() << "Uncommit " << uncommit_page_count << " lazy-commit pages from " << this;
|
||||
#endif
|
||||
MM.uncommit_user_physical_pages(uncommit_page_count);
|
||||
|
@ -364,7 +364,7 @@ size_t AnonymousVMObject::mark_committed_pages_for_nonvolatile_range(const Volat
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef COMMIT_DEBUG
|
||||
#if COMMIT_DEBUG
|
||||
klog() << "Added " << pages_updated << " lazy-commit pages to " << this;
|
||||
#endif
|
||||
m_unused_committed_pages += pages_updated;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/BinarySearch.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/VM/AnonymousVMObject.h>
|
||||
|
@ -34,7 +35,7 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
#ifdef VOLATILE_PAGE_RANGES_DEBUG
|
||||
#if VOLATILE_PAGE_RANGES_DEBUG
|
||||
inline LogStream& operator<<(const LogStream& stream, const VolatilePageRange& range)
|
||||
{
|
||||
stream << "{" << range.base << " (" << range.count << ") purged: " << range.was_purged << "}";
|
||||
|
@ -65,7 +66,7 @@ bool VolatilePageRanges::add(const VolatilePageRange& range)
|
|||
return false;
|
||||
add_range.was_purged = range.was_purged;
|
||||
|
||||
#ifdef VOLATILE_PAGE_RANGES_DEBUG
|
||||
#if VOLATILE_PAGE_RANGES_DEBUG
|
||||
klog() << "ADD " << range << " (total range: " << m_total_range << ") -->";
|
||||
dump_volatile_page_ranges(m_ranges);
|
||||
ScopeGuard debug_guard([&]() {
|
||||
|
@ -139,7 +140,7 @@ bool VolatilePageRanges::remove(const VolatilePageRange& range, bool& was_purged
|
|||
if (remove_range.is_empty())
|
||||
return false;
|
||||
|
||||
#ifdef VOLATILE_PAGE_RANGES_DEBUG
|
||||
#if VOLATILE_PAGE_RANGES_DEBUG
|
||||
klog() << "REMOVE " << range << " (total range: " << m_total_range << ") -->";
|
||||
dump_volatile_page_ranges(m_ranges);
|
||||
ScopeGuard debug_guard([&]() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue