diff --git a/riscemu/Syscall.py b/riscemu/Syscall.py index eb7460b..74aeb64 100644 --- a/riscemu/Syscall.py +++ b/riscemu/Syscall.py @@ -82,7 +82,7 @@ class SyscallInterface: return scall.ret(len(data)) except UnicodeEncodeError: - print(FMT_ERROR + '[Syscall] read: UnicodeError - invalid input "{}"'.format(chars) + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] read: UnicodeError - invalid input "{}"'.format(chars) + FMT_NONE) return scall.ret(-1) def write(self, scall: Syscall): @@ -99,7 +99,7 @@ class SyscallInterface: data = scall.cpu.mmu.read(addr, size) if not isinstance(str, bytearray): - print(FMT_ERROR + '[Syscall] write: writing from .text region not supported.' + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] write: writing from .text region not supported.' + FMT_NONE) return scall.ret(-1) self.open_files[fileno].write(data.decode('ascii')) @@ -120,7 +120,7 @@ class SyscallInterface: Requires running with flag scall-fs """ if not scall.cpu.conf.scall_fs: - print(FMT_ERROR + '[Syscall] open: opening files not supported without scall-fs flag!' + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] open: opening files not supported without scall-fs flag!' + FMT_NONE) return scall.ret(-1) mode = scall.registers.get('a0') @@ -129,7 +129,7 @@ class SyscallInterface: mode_st = OPEN_MODES.get(mode, ) if mode_st == -1: - print(FMT_ERROR + '[Syscall] open: unknown opening mode {}!'.format(mode) + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] open: unknown opening mode {}!'.format(mode) + FMT_NONE) return scall.ret(-1) path = scall.cpu.mmu.read(addr, size).decode('ascii') @@ -140,10 +140,10 @@ class SyscallInterface: try: self.open_files[fileno] = open(path, mode_st) except OSError as err: - print(FMT_ERROR + '[Syscall] open: encountered error during {}!'.format(err.strerror) + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] open: encountered error during {}!'.format(err.strerror) + FMT_NONE) return scall.ret(-1) - print(FMT_CYAN + '[Syscall] open: opened fd {} to {}!'.format(fileno, path) + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] open: opened fd {} to {}!'.format(fileno, path) + FMT_NONE) return scall.ret(fileno) def close(self, scall: Syscall): @@ -154,11 +154,11 @@ class SyscallInterface: """ fileno = scall.registers.get('a0') if fileno not in self.open_files: - print(FMT_ERROR + '[Syscall] close: unknown fileno {}!'.format(fileno) + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] close: unknown fileno {}!'.format(fileno) + FMT_NONE) return scall.ret(-1) self.open_files[fileno].close() - print(FMT_CYAN + '[Syscall] close: closed fd {}!'.format(fileno) + FMT_NONE) + print(FMT_SYSCALL + '[Syscall] close: closed fd {}!'.format(fileno) + FMT_NONE) del self.open_files[fileno] return scall.ret(0)