From a1b9cf7f22b55a7047ad56e513204af8c9e4fa84 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 18 Apr 2021 19:19:28 +0200 Subject: [PATCH] provide global syscall symbols if flag is set --- riscemu/CPU.py | 4 ++++ riscemu/Syscall.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/riscemu/CPU.py b/riscemu/CPU.py index 5431887..0db3423 100644 --- a/riscemu/CPU.py +++ b/riscemu/CPU.py @@ -27,6 +27,10 @@ class CPU: self.regs = Registers(conf) self.syscall_int = SyscallInterface() + # provide global syscall symbols if option is set + if conf.include_scall_symbols: + self.mmu.global_symbols.update(self.syscall_int.get_syscall_symbols()) + def load(self, e: 'Executable'): return self.mmu.load_bin(e) diff --git a/riscemu/Syscall.py b/riscemu/Syscall.py index 5d3c117..60a889e 100644 --- a/riscemu/Syscall.py +++ b/riscemu/Syscall.py @@ -165,3 +165,8 @@ class SyscallInterface: def exit(self, scall: Syscall): scall.cpu.exit = True scall.cpu.exit_code = scall.registers.get('a0') + + def get_syscall_symbols(self): + symbols = dict() + for num, name in SYSCALLS.items(): + symbols['SCALL_' + name.upper()] = num \ No newline at end of file