1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

Kernel: Remove some unnecessary .characters() when doing dbg()<<String

This commit is contained in:
Andreas Kling 2020-03-01 13:23:26 +01:00
parent 22d0a6d92f
commit c3c8eae25a
3 changed files with 11 additions and 8 deletions

View file

@ -238,7 +238,6 @@ EH_ENTRY(14, page_fault);
void page_fault_handler(RegisterState regs) void page_fault_handler(RegisterState regs)
{ {
clac(); clac();
//ASSERT(current);
u32 fault_address; u32 fault_address;
asm("movl %%cr2, %%eax" asm("movl %%cr2, %%eax"
@ -246,8 +245,12 @@ void page_fault_handler(RegisterState regs)
#ifdef PAGE_FAULT_DEBUG #ifdef PAGE_FAULT_DEBUG
u32 fault_page_directory = read_cr3(); u32 fault_page_directory = read_cr3();
dbg() << (current ? Process::current->name().characters() : "(none)") << "(" << (current ? Process::current->pid() : 0) << "): ring" << (regs.cs & 3) << " " << (regs.exception_code & 1 ? "PV" : "NP") << " page fault in PD=" << String::format("%x", fault_page_directory) << ", " << (regs.exception_code & 8 ? "reserved-bit " : "") << regs.exception_code & 2 ? "write" : "read" dbg() << "Ring " << (regs.cs & 3)
<< " V" << String::format("%08x", fault_address); << " " << (regs.exception_code & 1 ? "PV" : "NP")
<< " page fault in PD=" << String::format("%x", fault_page_directory) << ", "
<< (regs.exception_code & 8 ? "reserved-bit " : "")
<< (regs.exception_code & 2 ? "write" : "read")
<< " " << VirtualAddress(fault_address);
#endif #endif
#ifdef PAGE_FAULT_DEBUG #ifdef PAGE_FAULT_DEBUG

View file

@ -155,7 +155,7 @@ static void load_ksyms_from_data(const ByteBuffer& buffer)
break; break;
if (!symbol.ksym) { if (!symbol.ksym) {
if (Process::current && Process::current->elf_loader() && Process::current->elf_loader()->has_symbols()) { if (Process::current && Process::current->elf_loader() && Process::current->elf_loader()->has_symbols()) {
dbg() << String::format("%p", symbol.address) << " " << Process::current->elf_loader()->symbolicate(symbol.address).characters(); dbg() << String::format("%p", symbol.address) << " " << Process::current->elf_loader()->symbolicate(symbol.address);
} else { } else {
dbg() << String::format("%p", symbol.address) << " (no ELF symbols for process)"; dbg() << String::format("%p", symbol.address) << " (no ELF symbols for process)";
} }
@ -165,7 +165,7 @@ static void load_ksyms_from_data(const ByteBuffer& buffer)
if (symbol.ksym->address == ksym_highest_address && offset > 4096) if (symbol.ksym->address == ksym_highest_address && offset > 4096)
dbg() << String::format("%p", symbol.address); dbg() << String::format("%p", symbol.address);
else else
dbg() << String::format("%p", symbol.address) << " " << demangle(symbol.ksym->name).characters() << " +" << offset; dbg() << String::format("%p", symbol.address) << " " << demangle(symbol.ksym->name) << " +" << offset;
} }
} }

View file

@ -113,7 +113,7 @@ KResult IPv4Socket::bind(const sockaddr* user_address, socklen_t address_size)
auto requested_local_port = ntohs(address.sin_port); auto requested_local_port = ntohs(address.sin_port);
if (!Process::current->is_superuser()) { if (!Process::current->is_superuser()) {
if (requested_local_port < 1024) { if (requested_local_port < 1024) {
dbg() << Process::current << " (uid " << Process::current->uid() << ") attempted to bind " << class_name() << " to port " << requested_local_port; dbg() << "UID " << Process::current->uid() << " attempted to bind " << class_name() << " to port " << requested_local_port;
return KResult(-EACCES); return KResult(-EACCES);
} }
} }
@ -122,7 +122,7 @@ KResult IPv4Socket::bind(const sockaddr* user_address, socklen_t address_size)
m_local_port = requested_local_port; m_local_port = requested_local_port;
#ifdef IPV4_SOCKET_DEBUG #ifdef IPV4_SOCKET_DEBUG
dbg() << "IPv4Socket::bind " << class_name() << "{" << this << "} to " << m_local_address.to_string().characters() << ":" << m_local_port; dbg() << "IPv4Socket::bind " << class_name() << "{" << this << "} to " << m_local_address << ":" << m_local_port;
#endif #endif
return protocol_bind(); return protocol_bind();
@ -316,7 +316,7 @@ ssize_t IPv4Socket::receive_packet_buffered(FileDescription& description, void*
if (addr) { if (addr) {
#ifdef IPV4_SOCKET_DEBUG #ifdef IPV4_SOCKET_DEBUG
dbg() << "Incoming packet is from: " << packet.peer_address.to_string().characters() << ":" << packet.peer_port; dbg() << "Incoming packet is from: " << packet.peer_address << ":" << packet.peer_port;
#endif #endif
auto& ia = *(sockaddr_in*)addr; auto& ia = *(sockaddr_in*)addr;
memcpy(&ia.sin_addr, &packet.peer_address, sizeof(IPv4Address)); memcpy(&ia.sin_addr, &packet.peer_address, sizeof(IPv4Address));