provide global syscall symbols if flag is set

This commit is contained in:
Anton Lydike 2021-04-18 19:19:28 +02:00
parent 11568ec9b0
commit a1b9cf7f22
2 changed files with 9 additions and 0 deletions

View File

@ -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)

View File

@ -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