mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
Use new format functions in remaining DevTools. (#3755)
* AK: Add formatter for JsonValue. * Inspector: Use new format functions. * Profiler: Use new format functions. * UserspaceEmulator: Use new format functions.
This commit is contained in:
parent
626bb1be9c
commit
d94f674bbb
11 changed files with 45 additions and 37 deletions
|
@ -29,8 +29,8 @@
|
|||
#include "SharedBufferRegion.h"
|
||||
#include "SimpleRegion.h"
|
||||
#include "SoftCPU.h"
|
||||
#include <AK/Format.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <LibX86/ELFSymbolProvider.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -171,7 +171,7 @@ int Emulator::exec()
|
|||
auto insn = X86::Instruction::from_stream(m_cpu, true, true);
|
||||
|
||||
if (trace)
|
||||
out() << (const void*)m_cpu.base_eip() << " \033[33;1m" << insn.to_string(m_cpu.base_eip(), &symbol_provider) << "\033[0m";
|
||||
outln("{:p} \033[33;1m{}\033[0m", m_cpu.base_eip(), insn.to_string(m_cpu.base_eip(), &symbol_provider));
|
||||
|
||||
(m_cpu.*insn.handler())(insn);
|
||||
|
||||
|
@ -1070,7 +1070,7 @@ void Emulator::register_signal_handlers()
|
|||
int Emulator::virt$sigaction(int signum, FlatPtr act, FlatPtr oldact)
|
||||
{
|
||||
if (signum == SIGKILL) {
|
||||
dbg() << "Attempted to sigaction() with SIGKILL";
|
||||
dbgln("Attempted to sigaction() with SIGKILL");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1342,13 +1342,13 @@ void SoftCPU::DIV_RM16(const X86::Instruction& insn)
|
|||
{
|
||||
auto divisor = insn.modrm().read16(*this, insn);
|
||||
if (divisor.value() == 0) {
|
||||
warn() << "Divide by zero";
|
||||
warnln("Divide by zero");
|
||||
TODO();
|
||||
}
|
||||
u32 dividend = ((u32)dx().value() << 16) | ax().value();
|
||||
auto quotient = dividend / divisor.value();
|
||||
if (quotient > NumericLimits<u16>::max()) {
|
||||
warn() << "Divide overflow";
|
||||
warnln("Divide overflow");
|
||||
TODO();
|
||||
}
|
||||
|
||||
|
@ -1363,13 +1363,13 @@ void SoftCPU::DIV_RM32(const X86::Instruction& insn)
|
|||
{
|
||||
auto divisor = insn.modrm().read32(*this, insn);
|
||||
if (divisor.value() == 0) {
|
||||
warn() << "Divide by zero";
|
||||
warnln("Divide by zero");
|
||||
TODO();
|
||||
}
|
||||
u64 dividend = ((u64)edx().value() << 32) | eax().value();
|
||||
auto quotient = dividend / divisor.value();
|
||||
if (quotient > NumericLimits<u32>::max()) {
|
||||
warn() << "Divide overflow";
|
||||
warnln("Divide overflow");
|
||||
TODO();
|
||||
}
|
||||
|
||||
|
@ -1384,13 +1384,13 @@ void SoftCPU::DIV_RM8(const X86::Instruction& insn)
|
|||
{
|
||||
auto divisor = insn.modrm().read8(*this, insn);
|
||||
if (divisor.value() == 0) {
|
||||
warn() << "Divide by zero";
|
||||
warnln("Divide by zero");
|
||||
TODO();
|
||||
}
|
||||
u16 dividend = ax().value();
|
||||
auto quotient = dividend / divisor.value();
|
||||
if (quotient > NumericLimits<u8>::max()) {
|
||||
warn() << "Divide overflow";
|
||||
warnln("Divide overflow");
|
||||
TODO();
|
||||
}
|
||||
|
||||
|
@ -1405,7 +1405,7 @@ void SoftCPU::ENTER32(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::ESCAPE(const X86::Instruction&)
|
||||
{
|
||||
dbg() << "FIXME: x87 floating-point support";
|
||||
dbgln("FIXME: x87 floating-point support");
|
||||
m_emulator.dump_backtrace();
|
||||
TODO();
|
||||
}
|
||||
|
@ -1546,13 +1546,13 @@ void SoftCPU::IDIV_RM16(const X86::Instruction& insn)
|
|||
auto divisor_with_shadow = insn.modrm().read16(*this, insn);
|
||||
auto divisor = (i16)divisor_with_shadow.value();
|
||||
if (divisor == 0) {
|
||||
warn() << "Divide by zero";
|
||||
warnln("Divide by zero");
|
||||
TODO();
|
||||
}
|
||||
i32 dividend = (i32)(((u32)dx().value() << 16) | (u32)ax().value());
|
||||
i32 result = dividend / divisor;
|
||||
if (result > NumericLimits<i16>::max() || result < NumericLimits<i16>::min()) {
|
||||
warn() << "Divide overflow";
|
||||
warnln("Divide overflow");
|
||||
TODO();
|
||||
}
|
||||
|
||||
|
@ -1566,13 +1566,13 @@ void SoftCPU::IDIV_RM32(const X86::Instruction& insn)
|
|||
auto divisor_with_shadow = insn.modrm().read32(*this, insn);
|
||||
auto divisor = (i32)divisor_with_shadow.value();
|
||||
if (divisor == 0) {
|
||||
warn() << "Divide by zero";
|
||||
warnln("Divide by zero");
|
||||
TODO();
|
||||
}
|
||||
i64 dividend = (i64)(((u64)edx().value() << 32) | (u64)eax().value());
|
||||
i64 result = dividend / divisor;
|
||||
if (result > NumericLimits<i32>::max() || result < NumericLimits<i32>::min()) {
|
||||
warn() << "Divide overflow";
|
||||
warnln("Divide overflow");
|
||||
TODO();
|
||||
}
|
||||
|
||||
|
@ -1586,13 +1586,13 @@ void SoftCPU::IDIV_RM8(const X86::Instruction& insn)
|
|||
auto divisor_with_shadow = insn.modrm().read8(*this, insn);
|
||||
auto divisor = (i8)divisor_with_shadow.value();
|
||||
if (divisor == 0) {
|
||||
warn() << "Divide by zero";
|
||||
warnln("Divide by zero");
|
||||
TODO();
|
||||
}
|
||||
i16 dividend = ax().value();
|
||||
i16 result = dividend / divisor;
|
||||
if (result > NumericLimits<i8>::max() || result < NumericLimits<i8>::min()) {
|
||||
warn() << "Divide overflow";
|
||||
warnln("Divide overflow");
|
||||
TODO();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
#include "Emulator.h"
|
||||
#include "SoftCPU.h"
|
||||
#include <AK/Format.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
@ -49,7 +49,7 @@ int main(int argc, char** argv, char** env)
|
|||
|
||||
MappedFile mapped_file(executable_path);
|
||||
if (!mapped_file.is_valid()) {
|
||||
warn() << "Unable to map " << executable_path;
|
||||
warnln("Unable to map {}", executable_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue