#include "parser.h" #include "shell.h" //--- // ms //--- static FxOS::Symbol parse_ms(Session &session, Parser &parser) { FxOS::Symbol s; if(parser.lookahead().type == T::SYSCALL) { s.type = FxOS::Symbol::Syscall; s.value = parser.expect(T::SYSCALL).value.NUM; } else { s.type = FxOS::Symbol::Address; s.value = parser.expr(session.current_space); } s.name = parser.symbol(); parser.end(); return s; } void _ms(Session &session, Symbol s) { if(!session.current_space) return; session.current_space->symbols.add(s); } static ShellCommand _ms_cmd( "ms", [](Session &s, Parser &p) { _ms(s, parse_ms(s, p)); }, [](Session &s, Parser &p) { parse_ms(s, p); }, "Metadata Symbol", R"( ms Defines a new symbol at the specified address or syscall number in the current virtual space. If a syscall number is provided, the address is not resolved; the same syscall symbol can be used across multiple OS versions regardless of where the functions are actually located. )");