Print all syscalls to 4 hex figures

This commit is contained in:
Dr-Carlos 2022-12-04 21:15:25 +10:30
parent dd09f9a71d
commit 0e6cec0821
3 changed files with 7 additions and 11 deletions

View File

@ -37,7 +37,7 @@ bool PrintPass::analyzeInstruction(uint32_t pc, Instruction &i)
int syscall_id;
if(m_os && (syscall_id = m_os->find_syscall(pc)) >= 0) {
printf("\n<%%%03x", syscall_id);
printf("\n<%%%04x", syscall_id);
auto maybe_str = symquery(Symbol::Syscall, syscall_id);
if(maybe_str)
printf(" %s", (*maybe_str).c_str());
@ -163,7 +163,7 @@ void PrintPass::syscall(Argument const &a)
return;
}
queue(format("%%%03x", a.syscall_id), promote_syscall == Promote);
queue(format("%%%04x", a.syscall_id), promote_syscall == Promote);
syscallname(a);
}

View File

@ -70,7 +70,7 @@ static char const *syscall_str
" First seemingly invalid entry : 0x%08x\n"
" Syscall entries outside ROM:\n";
static char const *syscall_nonrom_str = " %%%03x -> %08x (%s memory)\n";
static char const *syscall_nonrom_str = " %%%04x -> %08x (%s memory)\n";
static std::string parse_io(Session &, Parser &parser)
{
@ -236,8 +236,7 @@ void _isc(Session &session, std::string vspace_name, bool sort,
for(int i = 0; i < total; i++) {
fmt::print(theme(3), " 0x{:08x}", info[i].address);
fmt::print(theme(10), (total >= 0x1000 ? " %{:04x}" : " %{:03x}"),
info[i].id);
fmt::print(theme(10), " %{:04x}", info[i].id);
fmt::print("\n");
}
}
@ -353,10 +352,7 @@ void _is(Session &session, std::string vspace_name,
}
for(auto const &s: symbols) {
if(s.type == FxOS::Symbol::Syscall && s.value < 0x1000) {
fmt::print(theme(10), " %{:03x}", s.value);
}
else if(s.type == FxOS::Symbol::Syscall) {
if(s.type == FxOS::Symbol::Syscall) {
fmt::print(theme(10), " %{:04x}", s.value);
}
else {

View File

@ -52,7 +52,7 @@ std::string Token::str() const
case T::SYMBOL:
return fmt::format("symbol '{}'", this->value.STRING);
case T::SYSCALL:
return fmt::format("syscall number %{:03x}", this->value.NUM);
return fmt::format("syscall number %{:04x}", this->value.NUM);
case T::OPTION:
return fmt::format("command option '{}'", this->value.STRING);
case T::STRING:
@ -146,7 +146,7 @@ void Parser::dump_command()
if(t.type == T::NUM)
fmt::print("NUM {:#x}\n", t.value.NUM);
else if(t.type == T::SYSCALL)
fmt::print("SYSCALL %{:03x}\n", t.value.NUM);
fmt::print("SYSCALL %{:04x}\n", t.value.NUM);
else if(t.type == T::SYMBOL)
fmt::print("SYMBOL '{}'\n", t.value.STRING);
else if(t.type == T::OPTION)