mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 14:57:34 +00:00
Kernel: Use klog() instead of kprintf()
Also, duplicate data in dbg() and klog() calls were removed. In addition, leakage of virtual address to kernel log is prevented. This is done by replacing kprintf() calls to dbg() calls with the leaked data instead. Also, other kprintf() calls were replaced with klog().
This commit is contained in:
parent
19aa53e1f9
commit
0fc60e41dd
53 changed files with 397 additions and 573 deletions
|
@ -160,7 +160,7 @@ u32 BXVGADevice::find_framebuffer_address()
|
|||
PCI::enumerate_all([&framebuffer_address](const PCI::Address& address, PCI::ID id) {
|
||||
if (id == bochs_vga_id || id == virtualbox_vga_id) {
|
||||
framebuffer_address = PCI::get_BAR0(address) & 0xfffffff0;
|
||||
kprintf("BXVGA: framebuffer @ P%x\n", framebuffer_address);
|
||||
klog() << "BXVGA: framebuffer @ P " << String::format("%p", framebuffer_address);
|
||||
}
|
||||
});
|
||||
return framebuffer_address;
|
||||
|
|
|
@ -50,7 +50,7 @@ DiskPartition::~DiskPartition()
|
|||
bool DiskPartition::read_blocks(unsigned index, u16 count, u8* out)
|
||||
{
|
||||
#ifdef OFFD_DEBUG
|
||||
kprintf("DiskPartition::read_blocks %u (really: %u) count=%u\n", index, m_block_offset + index, count);
|
||||
klog() << "DiskPartition::read_blocks " << index << " (really: " << (m_block_offset + index) << ") count=" << count;
|
||||
#endif
|
||||
|
||||
return m_device->read_blocks(m_block_offset + index, count, out);
|
||||
|
@ -59,7 +59,7 @@ bool DiskPartition::read_blocks(unsigned index, u16 count, u8* out)
|
|||
bool DiskPartition::write_blocks(unsigned index, u16 count, const u8* data)
|
||||
{
|
||||
#ifdef OFFD_DEBUG
|
||||
kprintf("DiskPartition::write_blocks %u (really: %u) count=%u\n", index, m_block_offset + index, count);
|
||||
klog() << "DiskPartition::write_blocks " << index << " (really: " << (m_block_offset + index) << ") count=" << count;
|
||||
#endif
|
||||
|
||||
return m_device->write_blocks(m_block_offset + index, count, data);
|
||||
|
|
|
@ -69,11 +69,11 @@ bool EBRPartitionTable::initialize()
|
|||
m_ebr_container_id = index_of_ebr_container() + 1;
|
||||
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::initialize: MBR_signature=%#x\n", header.mbr_signature);
|
||||
klog() << "EBRPartitionTable::initialize: MBR_signature=0x" << String::format("%x", header.mbr_signature);
|
||||
#endif
|
||||
|
||||
if (header.mbr_signature != MBR_SIGNATURE) {
|
||||
kprintf("EBRPartitionTable::initialize: bad MBR signature %#x\n", header.mbr_signature);
|
||||
klog() << "EBRPartitionTable::initialize: bad MBR signature 0x" << String::format("%x", header.mbr_signature);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ bool EBRPartitionTable::initialize()
|
|||
|
||||
m_ebr_chained_extensions_count = index;
|
||||
|
||||
kprintf("EBRPartitionTable::initialize: Extended partitions count - %d\n", m_ebr_chained_extensions_count);
|
||||
klog() << "EBRPartitionTable::initialize: Extended partitions count - " << m_ebr_chained_extensions_count;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -105,19 +105,19 @@ RefPtr<DiskPartition> EBRPartitionTable::get_non_extended_partition(unsigned ind
|
|||
auto& entry = header.entry[index - 1];
|
||||
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: status=%#x offset=%#x\n", entry.status, entry.offset);
|
||||
klog() << "EBRPartitionTable::partition: status=0x" << String::format("%x", entry.status) << " offset=0x" << String::format("%x", entry.offset);
|
||||
#endif
|
||||
|
||||
if (entry.offset == 0x00) {
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: missing partition requested index=%d\n", index);
|
||||
klog() << "EBRPartitionTable::partition: missing partition requested index=" << index;
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: found partition index=%d type=%x\n", index, entry.type);
|
||||
klog() << "EBRPartitionTable::partition: found partition index=" << index << " type=" << String::format("%x", entry.type);
|
||||
#endif
|
||||
|
||||
return DiskPartition::create(m_device, entry.offset, (entry.offset + entry.length));
|
||||
|
@ -130,12 +130,12 @@ RefPtr<DiskPartition> EBRPartitionTable::get_extended_partition(unsigned index)
|
|||
auto& header = this->header();
|
||||
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: relative index %d\n", relative_index);
|
||||
klog() << "EBRPartitionTable::partition: relative index " << relative_index;
|
||||
#endif
|
||||
|
||||
auto& ebr_entry = header.entry[m_ebr_container_id - 1];
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: Extended partition, offset 0x%x, type %x\n", ebr_entry.offset, ebr_entry.type);
|
||||
klog() << "EBRPartitionTable::partition: Extended partition, offset 0x" << String::format("%x", ebr_entry.offset) << ", type " << String::format("%x", ebr_entry.type);
|
||||
#endif
|
||||
|
||||
if (!m_device->read_block(ebr_entry.offset, m_cached_ebr_header)) {
|
||||
|
@ -144,8 +144,8 @@ RefPtr<DiskPartition> EBRPartitionTable::get_extended_partition(unsigned index)
|
|||
size_t i = 0;
|
||||
while (i < relative_index) {
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: logical partition, relative offset 0x%x, type %x\n", ebr_extension().entry.offset, ebr_extension().entry.type);
|
||||
kprintf("EBRPartitionTable::partition: next logical partition, relative offset 0x%x, type %x\n", ebr_extension().next_chained_ebr_extension.offset, ebr_extension().next_chained_ebr_extension.type);
|
||||
klog() << "EBRPartitionTable::partition: logical partition, relative offset 0x" << String::format("%x", ebr_extension().entry.offset) << ", type " << String::format("%x", ebr_extension().entry.type);
|
||||
klog() << "EBRPartitionTable::partition: next logical partition, relative offset 0x" << String::format("%x", ebr_extension().next_chained_ebr_extension.offset) << ", type " << String::format("%x", ebr_extension().next_chained_ebr_extension.type);
|
||||
#endif
|
||||
if (ebr_extension().next_chained_ebr_extension.offset == 0 && ebr_extension().next_chained_ebr_extension.type == 0) {
|
||||
break;
|
||||
|
@ -158,19 +158,19 @@ RefPtr<DiskPartition> EBRPartitionTable::get_extended_partition(unsigned index)
|
|||
}
|
||||
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: status=%#x offset=%#x\n", ebr_extension().entry.status, ebr_extension().entry.offset + ebr_entry.offset);
|
||||
klog() << "EBRPartitionTable::partition: status=" << String::format("%x", ebr_extension().entry.status) << " offset=" << String::format("%x", ebr_extension().entry.offset + ebr_entry.offset);
|
||||
#endif
|
||||
|
||||
if (ebr_extension().entry.offset == 0x00) {
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: missing partition requested index=%d\n", index);
|
||||
klog() << "EBRPartitionTable::partition: missing partition requested index=" << index;
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef EBR_DEBUG
|
||||
kprintf("EBRPartitionTable::partition: found partition index=%d type=%x\n", index, ebr_extension().entry.type);
|
||||
klog() << "EBRPartitionTable::partition: found partition index=" << index << " type=" << String::format("%x", ebr_extension().entry.type);
|
||||
#endif
|
||||
|
||||
return DiskPartition::create(m_device, ebr_extension().entry.offset + ebr_entry.offset, (ebr_extension().entry.offset + ebr_entry.offset + ebr_extension().entry.length));
|
||||
|
@ -187,7 +187,7 @@ RefPtr<DiskPartition> EBRPartitionTable::partition(unsigned index)
|
|||
|
||||
auto& header = this->header();
|
||||
if (header.mbr_signature != MBR_SIGNATURE) {
|
||||
kprintf("EBRPartitionTable::initialize: bad MBR signature - not initalized? %#x\n", header.mbr_signature);
|
||||
klog() << "EBRPartitionTable::initialize: bad MBR signature - not initalized? 0x" << String::format("%x", header.mbr_signature);
|
||||
return nullptr;
|
||||
}
|
||||
if (index_is_extended_partition(index))
|
||||
|
|
|
@ -134,7 +134,7 @@ bool FloppyDiskDevice::read_sectors_with_dma(u16 lba, u16 count, u8* outbuf)
|
|||
{
|
||||
LOCKER(m_lock); // Acquire lock
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: read_sectors_with_dma lba = %d count = %d\n", lba, count);
|
||||
klog() << "fdc: read_sectors_with_dma lba = " << lba << " count = " << count;
|
||||
#endif
|
||||
|
||||
motor_enable(is_slave()); // Should I bother casting this?!
|
||||
|
@ -142,7 +142,7 @@ bool FloppyDiskDevice::read_sectors_with_dma(u16 lba, u16 count, u8* outbuf)
|
|||
recalibrate();
|
||||
|
||||
if (!seek(lba)) {
|
||||
kprintf("fdc: failed to seek to lba = %d!\n", lba);
|
||||
klog() << "fdc: failed to seek to lba = " << lba << "!";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ bool FloppyDiskDevice::read_sectors_with_dma(u16 lba, u16 count, u8* outbuf)
|
|||
u16 sector = lba2sector(lba);
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: addr = 0x%x c = %d h = %d s = %d\n", lba * BYTES_PER_SECTOR, cylinder, head, sector);
|
||||
klog() << "fdc: addr = 0x" << String::format("%x", lba * BYTES_PER_SECTOR) << " c = " << cylinder << " h = " << head << " s = " << sector;
|
||||
#endif
|
||||
|
||||
// Intel recommends 3 attempts for a read/write
|
||||
|
@ -194,13 +194,13 @@ bool FloppyDiskDevice::read_sectors_with_dma(u16 lba, u16 count, u8* outbuf)
|
|||
// the command executed correctly
|
||||
u8 cmd_st0 = read_byte();
|
||||
if ((cmd_st0 & 0xc0) != 0) {
|
||||
kprintf("fdc: read failed with error code (st0) 0x%x\n", cmd_st0 >> 6);
|
||||
klog() << "fdc: read failed with error code (st0) 0x" << String::format("%x", cmd_st0 >> 6);
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 cmd_st1 = read_byte();
|
||||
if (cmd_st1 != 0) {
|
||||
kprintf("fdc: read failed with error code (st1) 0x%x\n", cmd_st1);
|
||||
klog() << "fdc: read failed with error code (st1) 0x" << String::format("%x", cmd_st1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ bool FloppyDiskDevice::read_sectors_with_dma(u16 lba, u16 count, u8* outbuf)
|
|||
|
||||
if (cyl != cylinder) {
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: cyl != cylinder (cyl = %d cylinder = %d)! Retrying...\n", cyl, cylinder);
|
||||
klog() << "fdc: cyl != cylinder (cyl = " << cyl << " cylinder = " << cylinder << ")! Retrying...";
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ bool FloppyDiskDevice::read_sectors_with_dma(u16 lba, u16 count, u8* outbuf)
|
|||
}
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: out of read attempts (check your hardware maybe!?)\n");
|
||||
klog() << "fdc: out of read attempts (check your hardware maybe!?)";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ bool FloppyDiskDevice::write_sectors_with_dma(u16 lba, u16 count, const u8* inbu
|
|||
{
|
||||
LOCKER(m_lock); // Acquire lock
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: write_sectors_with_dma lba = %d count = %d\n", lba, count);
|
||||
klog() << "fdc: write_sectors_with_dma lba = " << lba << " count = " << count;
|
||||
#endif
|
||||
|
||||
motor_enable(is_slave() ? 1 : 0); // Should I bother casting this?!
|
||||
|
@ -247,7 +247,7 @@ bool FloppyDiskDevice::write_sectors_with_dma(u16 lba, u16 count, const u8* inbu
|
|||
recalibrate(); // Recalibrate the drive
|
||||
|
||||
if (!seek(lba)) {
|
||||
kprintf("fdc: failed to seek to lba = %d!\n", lba);
|
||||
klog() << "fdc: failed to seek to lba = " << lba << "!";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ bool FloppyDiskDevice::write_sectors_with_dma(u16 lba, u16 count, const u8* inbu
|
|||
u16 sector = lba2sector(lba);
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: addr = 0x%x c = %d h = %d s = %d\n", lba * BYTES_PER_SECTOR, cylinder, head, sector);
|
||||
klog() << "fdc: addr = 0x" << String::format("%x", lba * BYTES_PER_SECTOR) << " c = " << cylinder << " h = " << head << " s = " << sector;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
@ -292,13 +292,13 @@ bool FloppyDiskDevice::write_sectors_with_dma(u16 lba, u16 count, const u8* inbu
|
|||
// Flush FIFO
|
||||
u8 cmd_st0 = read_byte();
|
||||
if ((cmd_st0 & 0xc0) != 0) {
|
||||
kprintf("fdc: write failed! Error code 0x%x\n", cmd_st0 >> 6);
|
||||
klog() << "fdc: write failed! Error code 0x" << String::format("%x", cmd_st0 >> 6);
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 cmd_st1 = read_byte();
|
||||
if (cmd_st1 != 0) {
|
||||
kprintf("fdc: write failed with error code (st1) 0x%x\n", cmd_st1);
|
||||
klog() << "fdc: write failed with error code (st1) 0x" << String::format("%x", cmd_st1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ bool FloppyDiskDevice::write_sectors_with_dma(u16 lba, u16 count, const u8* inbu
|
|||
|
||||
if (cyl != cylinder) {
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: cyl != cylinder (cyl = %d cylinder = %d)! Retrying...\n", cyl, cylinder);
|
||||
klog() << "fdc: cyl != cylinder (cyl = " << cyl << " cylinder = " << cylinder << ")! Retrying...";
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ bool FloppyDiskDevice::write_sectors_with_dma(u16 lba, u16 count, const u8* inbu
|
|||
}
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: out of read attempts (check your hardware maybe!?)\n");
|
||||
klog() << "fdc: out of read attempts (check your hardware maybe!?)";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ bool FloppyDiskDevice::write_sectors_with_dma(u16 lba, u16 count, const u8* inbu
|
|||
bool FloppyDiskDevice::wait_for_irq()
|
||||
{
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: Waiting for interrupt...\n");
|
||||
klog() << "fdc: Waiting for interrupt...";
|
||||
#endif
|
||||
|
||||
while (!m_interrupted) {
|
||||
|
@ -353,7 +353,7 @@ void FloppyDiskDevice::handle_irq(RegisterState&)
|
|||
m_interrupted = true;
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: Received IRQ!\n");
|
||||
klog() << "fdc: Received IRQ!";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ void FloppyDiskDevice::send_byte(u8 value) const
|
|||
}
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: FIFO write timed out!\n");
|
||||
klog() << "fdc: FIFO write timed out!";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ void FloppyDiskDevice::send_byte(FloppyCommand value) const
|
|||
}
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: FIFO write timed out!\n");
|
||||
klog() << "fdc: FIFO write timed out!";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ u8 FloppyDiskDevice::read_byte() const
|
|||
}
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: FIFO read timed out!\n");
|
||||
klog() << "fdc: FIFO read timed out!";
|
||||
#endif
|
||||
|
||||
return 0xff;
|
||||
|
@ -429,7 +429,7 @@ bool FloppyDiskDevice::is_busy() const
|
|||
bool FloppyDiskDevice::recalibrate()
|
||||
{
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: recalibrating drive...\n");
|
||||
klog() << "fdc: recalibrating drive...";
|
||||
#endif
|
||||
|
||||
u8 slave = is_slave();
|
||||
|
@ -451,7 +451,7 @@ bool FloppyDiskDevice::recalibrate()
|
|||
}
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: failed to calibrate drive (check your hardware!)\n");
|
||||
klog() << "fdc: failed to calibrate drive (check your hardware!)";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ bool FloppyDiskDevice::seek(u16 lba)
|
|||
// First, we need to enable the correct drive motor
|
||||
motor_enable(slave);
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: seeking to cylinder %d on side %d on drive %d\n", cylinder, head, slave);
|
||||
klog() << "fdc: seeking to cylinder " << cylinder << " on side " << head << " on drive " << slave;
|
||||
#endif
|
||||
|
||||
// Try at most 5 times to seek to the desired cylinder
|
||||
|
@ -482,7 +482,7 @@ bool FloppyDiskDevice::seek(u16 lba)
|
|||
|
||||
if ((st0 >> 5) != 1 || pcn != cylinder || (st0 & 0x01)) {
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: failed to seek to cylinder %d on attempt %d!\n", cylinder, attempt);
|
||||
klog() << "fdc: failed to seek to cylinder " << cylinder << " on attempt " << attempt << "!";
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ bool FloppyDiskDevice::seek(u16 lba)
|
|||
return true;
|
||||
}
|
||||
|
||||
kprintf("fdc: failed to seek after 3 attempts! Aborting...\n");
|
||||
klog() << "fdc: failed to seek after 3 attempts! Aborting...";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ bool FloppyDiskDevice::seek(u16 lba)
|
|||
void FloppyDiskDevice::initialize()
|
||||
{
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: m_io_base = 0x%x IRQn = %d\n", m_io_base_addr, IRQ_FLOPPY_DRIVE);
|
||||
klog() << "fdc: m_io_base = 0x" << String::format("%x", m_io_base_addr) << " IRQn = " << IRQ_FLOPPY_DRIVE;
|
||||
#endif
|
||||
|
||||
enable_irq();
|
||||
|
@ -506,7 +506,7 @@ void FloppyDiskDevice::initialize()
|
|||
// Get the version of the Floppy Disk Controller
|
||||
send_byte(FloppyCommand::Version);
|
||||
m_controller_version = read_byte();
|
||||
kprintf("fdc: Version = 0x%x\n", m_controller_version);
|
||||
klog() << "fdc: Version = 0x" << String::format("%x", m_controller_version);
|
||||
|
||||
// Reset
|
||||
write_dor(0);
|
||||
|
@ -523,7 +523,7 @@ void FloppyDiskDevice::initialize()
|
|||
u8 sr0 = read_byte();
|
||||
u8 trk = read_byte();
|
||||
|
||||
kprintf("sr0 = 0x%x, cyl = 0x%x\n", sr0, trk);
|
||||
klog() << "sr0 = 0x" << String::format("%x", sr0) << ", cyl = 0x" << String::format("%x", trk);
|
||||
}
|
||||
|
||||
// This is hardcoded for a 3.5" floppy disk drive
|
||||
|
@ -534,7 +534,7 @@ void FloppyDiskDevice::initialize()
|
|||
// Allocate a buffer page for us to read into. This only needs to be one sector in size.
|
||||
m_dma_buffer_page = MM.allocate_supervisor_physical_page();
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: allocated supervisor page at paddr 0x%x\n", m_dma_buffer_page->paddr());
|
||||
klog() << "fdc: allocated supervisor page at paddr 0x", String::format("%x", m_dma_buffer_page->paddr());
|
||||
#endif
|
||||
|
||||
// Now, let's initialise channel 2 of the DMA controller!
|
||||
|
@ -557,7 +557,7 @@ void FloppyDiskDevice::initialize()
|
|||
IO::out8(0xA, 0x2); // Unmask Channel 2
|
||||
|
||||
#ifdef FLOPPY_DEBUG
|
||||
kprintf("fdc: fd%d initialised succesfully!\n", is_slave() ? 1 : 0);
|
||||
klog() << "fdc: fd" << (is_slave() ? 1 : 0) << " initialised succesfully!";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ bool GPTPartitionTable::initialize()
|
|||
auto& header = this->header();
|
||||
|
||||
#ifdef GPT_DEBUG
|
||||
kprintf("GPTPartitionTable::initialize: gpt_signature=%#x%x\n", header.sig[1], header.sig[0]);
|
||||
klog() << "GPTPartitionTable::initialize: gpt_signature=0x" << String::format("%x", header.sig[1]) << String::format("%x", header.sig[0]);
|
||||
#endif
|
||||
|
||||
if (header.sig[0] != GPT_SIGNATURE && header.sig[1] != GPT_SIGNATURE2) {
|
||||
kprintf("GPTPartitionTable::initialize: bad GPT signature %#x%x\n", header.sig[1], header.sig[0]);
|
||||
klog() << "GPTPartitionTable::initialize: bad GPT signature 0x" << String::format("%x", header.sig[1]) << String::format("%x", header.sig[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ RefPtr<DiskPartition> GPTPartitionTable::partition(unsigned index)
|
|||
unsigned lba = header.partition_array_start_lba + (((index - 1) * header.partition_entry_size) / BytesPerSector);
|
||||
|
||||
if (header.sig[0] != GPT_SIGNATURE) {
|
||||
kprintf("GPTPartitionTable::initialize: bad gpt signature - not initalized? %#x\n", header.sig);
|
||||
klog() << "GPTPartitionTable::initialize: bad gpt signature - not initalized? 0x" << String::format("%x", header.sig);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -84,20 +84,20 @@ RefPtr<DiskPartition> GPTPartitionTable::partition(unsigned index)
|
|||
GPTPartitionEntry& entry = entries[((index - 1) % entries_per_sector)];
|
||||
|
||||
#ifdef GPT_DEBUG
|
||||
kprintf("GPTPartitionTable::partition %d\n", index);
|
||||
kprintf("GPTPartitionTable - offset = %d%d\n", entry.first_lba[1], entry.first_lba[0]);
|
||||
klog() << "GPTPartitionTable::partition " << index;
|
||||
klog() << "GPTPartitionTable - offset = " << entry.first_lba[1] << entry.first_lba[0];
|
||||
#endif
|
||||
|
||||
if (entry.first_lba[0] == 0x00) {
|
||||
#ifdef GPT_DEBUG
|
||||
kprintf("GPTPartitionTable::partition: missing partition requested index=%d\n", index);
|
||||
klog() << "GPTPartitionTable::partition: missing partition requested index=" << index;
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef GPT_DEBUG
|
||||
kprintf("GPTPartitionTable::partition: found partition index=%d type=%x-%x-%x-%x\n", index, entry.partition_guid[3], entry.partition_guid[2], entry.partition_guid[1], entry.partition_guid[0]);
|
||||
klog() << "GPTPartitionTable::partition: found partition index=" << index << " type=" << String::format("%x", entry.partition_guid[3]) << "-" << String::format("%x", entry.partition_guid[2]) << "-" << String::format("%x", entry.partition_guid[1]) << "-" << String::format("%x", entry.partition_guid[0]);
|
||||
#endif
|
||||
return DiskPartition::create(m_device, entry.first_lba[0], entry.last_lba[0]);
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ bool MBRPartitionTable::initialize()
|
|||
auto& header = this->header();
|
||||
|
||||
#ifdef MBR_DEBUG
|
||||
kprintf("MBRPartitionTable::initialize: mbr_signature=%#x\n", header.mbr_signature);
|
||||
klog() << "MBRPartitionTable::initialize: mbr_signature=0x" << String::format("%x", header.mbr_signature);
|
||||
#endif
|
||||
|
||||
if (header.mbr_signature != MBR_SIGNATURE) {
|
||||
kprintf("MBRPartitionTable::initialize: bad mbr signature %#x\n", header.mbr_signature);
|
||||
klog() << "MBRPartitionTable::initialize: bad mbr signature 0x" << String::format("%x", header.mbr_signature);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -87,24 +87,24 @@ RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
|
|||
auto& entry = header.entry[index - 1];
|
||||
|
||||
if (header.mbr_signature != MBR_SIGNATURE) {
|
||||
kprintf("MBRPartitionTable::initialize: bad mbr signature - not initalized? %#x\n", header.mbr_signature);
|
||||
klog() << "MBRPartitionTable::initialize: bad mbr signature - not initalized? 0x" << String::format("%x", header.mbr_signature);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef MBR_DEBUG
|
||||
kprintf("MBRPartitionTable::partition: status=%#x offset=%#x\n", entry.status, entry.offset);
|
||||
klog() << "MBRPartitionTable::partition: status=0x" << String::format("%x", entry.status) << " offset=0x" << String::format("%x", entry.offset);
|
||||
#endif
|
||||
|
||||
if (entry.offset == 0x00) {
|
||||
#ifdef MBR_DEBUG
|
||||
kprintf("MBRPartitionTable::partition: missing partition requested index=%d\n", index);
|
||||
klog() << "MBRPartitionTable::partition: missing partition requested index=" << index;
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef MBR_DEBUG
|
||||
kprintf("MBRPartitionTable::partition: found partition index=%d type=%x\n", index, entry.type);
|
||||
klog() << "MBRPartitionTable::partition: found partition index=" << index << " type=" << String::format("%x", entry.type);
|
||||
#endif
|
||||
|
||||
return DiskPartition::create(m_device, entry.offset, (entry.offset + entry.length));
|
||||
|
|
|
@ -261,7 +261,7 @@ bool PATAChannel::ata_read_sectors_with_dma(u32 lba, u16 count, u8* outbuf, bool
|
|||
{
|
||||
LOCKER(s_lock());
|
||||
#ifdef PATA_DEBUG
|
||||
dbg() << Process::current->name().characters() << "(" << Process::current->pid() << "): PATAChannel::ata_read_sectors_with_dma (" << lba << " x" << count << ") -> " << outbuf;
|
||||
dbg() << "PATAChannel::ata_read_sectors_with_dma (" << lba << " x" << count << ") -> " << outbuf;
|
||||
#endif
|
||||
|
||||
prdt().offset = m_dma_buffer_page->paddr();
|
||||
|
@ -332,7 +332,7 @@ bool PATAChannel::ata_write_sectors_with_dma(u32 lba, u16 count, const u8* inbuf
|
|||
{
|
||||
LOCKER(s_lock());
|
||||
#ifdef PATA_DEBUG
|
||||
dbg() << Process::current->name().characters() << "(" << Process::current->pid() << "): PATAChannel::ata_write_sectors_with_dma (" << lba << " x" << count << ") <- " << inbuf;
|
||||
dbg() << "PATAChannel::ata_write_sectors_with_dma (" << lba << " x" << count << ") <- " << inbuf;
|
||||
#endif
|
||||
|
||||
prdt().offset = m_dma_buffer_page->paddr();
|
||||
|
@ -401,7 +401,7 @@ bool PATAChannel::ata_read_sectors(u32 start_sector, u16 count, u8* outbuf, bool
|
|||
ASSERT(count <= 256);
|
||||
LOCKER(s_lock());
|
||||
#ifdef PATA_DEBUG
|
||||
dbg() << Process::current->name().characters() << "(" << Process::current->pid() << "): PATAChannel::ata_read_sectors request (" << count << " sector(s) @ " << start_sector << " into " << outbuf << ")";
|
||||
dbg() << "PATAChannel::ata_read_sectors request (" << count << " sector(s) @ " << start_sector << " into " << outbuf << ")";
|
||||
#endif
|
||||
|
||||
while (m_io_base.offset(ATA_REG_STATUS).in<u8>() & ATA_SR_BSY)
|
||||
|
|
|
@ -84,7 +84,7 @@ PIT::PIT()
|
|||
|
||||
IO::out8(PIT_CTL, TIMER0_SELECT | WRITE_WORD | MODE_SQUARE_WAVE);
|
||||
|
||||
kprintf("PIT: %u Hz, square wave (%x)\n", TICKS_PER_SECOND, m_default_timer_reload);
|
||||
klog() << "PIT: " << TICKS_PER_SECOND << " Hz, square wave (" << String::format("%x", m_default_timer_reload) << ")";
|
||||
|
||||
IO::out8(TIMER0_CTL, LSB(m_default_timer_reload));
|
||||
IO::out8(TIMER0_CTL, MSB(m_default_timer_reload));
|
||||
|
|
|
@ -246,7 +246,7 @@ void PS2MouseDevice::check_device_presence()
|
|||
u8 maybe_ack = mouse_read();
|
||||
if (maybe_ack == I8042_ACK) {
|
||||
m_device_present = true;
|
||||
kprintf("PS2MouseDevice: Device detected\n");
|
||||
klog() << "PS2MouseDevice: Device detected";
|
||||
|
||||
// the mouse will send a packet of data, since that's what we asked
|
||||
// for. we don't care about the content.
|
||||
|
@ -255,7 +255,7 @@ void PS2MouseDevice::check_device_presence()
|
|||
mouse_read();
|
||||
} else {
|
||||
m_device_present = false;
|
||||
kprintf("PS2MouseDevice: Device not detected\n");
|
||||
klog() << "PS2MouseDevice: Device not detected";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,9 +307,9 @@ void PS2MouseDevice::initialize_device()
|
|||
|
||||
if (device_id == PS2MOUSE_INTELLIMOUSE_ID) {
|
||||
m_has_wheel = true;
|
||||
kprintf("PS2MouseDevice: Mouse wheel enabled!\n");
|
||||
klog() << "PS2MouseDevice: Mouse wheel enabled!";
|
||||
} else {
|
||||
kprintf("PS2MouseDevice: No mouse wheel detected!\n");
|
||||
klog() << "PS2MouseDevice: No mouse wheel detected!";
|
||||
}
|
||||
|
||||
enable_irq();
|
||||
|
|
|
@ -103,7 +103,7 @@ void SB16::initialize()
|
|||
|
||||
auto data = dsp_read();
|
||||
if (data != 0xaa) {
|
||||
kprintf("SB16: sb not ready");
|
||||
klog() << "SB16: sb not ready";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -112,9 +112,9 @@ void SB16::initialize()
|
|||
m_major_version = dsp_read();
|
||||
auto vmin = dsp_read();
|
||||
|
||||
kprintf("SB16: found version %d.%d\n", m_major_version, vmin);
|
||||
klog() << "SB16: found version " << m_major_version << "." << vmin;
|
||||
set_irq_register(SB16_DEFAULT_IRQ);
|
||||
kprintf("SB16: IRQ %d\n", get_irq_line());
|
||||
klog() << "SB16: IRQ " << get_irq_line();
|
||||
}
|
||||
|
||||
void SB16::set_irq_register(u8 irq_number)
|
||||
|
@ -235,7 +235,7 @@ ssize_t SB16::write(FileDescription&, const u8* data, ssize_t length)
|
|||
}
|
||||
|
||||
#ifdef SB16_DEBUG
|
||||
kprintf("SB16: Writing buffer of %d bytes\n", length);
|
||||
klog() << "SB16: Writing buffer of " << length << " bytes";
|
||||
#endif
|
||||
ASSERT(length <= PAGE_SIZE);
|
||||
const int BLOCK_SIZE = 32 * 1024;
|
||||
|
|
|
@ -97,11 +97,11 @@ VMWareBackdoor& VMWareBackdoor::the()
|
|||
VMWareBackdoor::VMWareBackdoor()
|
||||
{
|
||||
if (!detect_presence()) {
|
||||
kprintf("VMWare Backdoor: Not supported!\n");
|
||||
klog() << "VMWare Backdoor: Not supported!";
|
||||
m_supported = false;
|
||||
return;
|
||||
}
|
||||
kprintf("VMWare Backdoor: Supported.\n");
|
||||
klog() << "VMWare Backdoor: Supported.";
|
||||
m_supported = true;
|
||||
}
|
||||
bool VMWareBackdoor::detect_presence()
|
||||
|
@ -153,7 +153,7 @@ void VMWareBackdoor::enable_absolute_vmmouse()
|
|||
command.command = VMMOUSE_STATUS;
|
||||
send(command);
|
||||
if (command.ax == 0xFFFF0000) {
|
||||
kprintf("VMMouse retuned bad status.\n");
|
||||
klog() << "VMMouse retuned bad status.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue