From d3fe6cb1a9768636377ea464b992cdfa837418f5 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Mon, 19 Apr 2021 00:04:10 +0200 Subject: [PATCH] fixed read syscall shadowing of len --- riscemu/CPU.py | 1 + riscemu/Syscall.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/riscemu/CPU.py b/riscemu/CPU.py index 267ebc3..7de1aa0 100644 --- a/riscemu/CPU.py +++ b/riscemu/CPU.py @@ -83,6 +83,7 @@ class CPU: launch_debug_session(self, self.mmu, self.regs, "Exception encountered, launching debug:".format(self.pc-1)) + print() print(FMT_CPU + "Program exited with code {}".format(self.exit_code) + FMT_NONE) def __run_instruction(self, ins: 'LoadedInstruction'): diff --git a/riscemu/Syscall.py b/riscemu/Syscall.py index 7622154..1ea4a9d 100644 --- a/riscemu/Syscall.py +++ b/riscemu/Syscall.py @@ -70,12 +70,12 @@ class SyscallInterface: """ fileno = scall.registers.get('a0') addr = scall.registers.get('a1') - len = scall.registers.get('a2') + size = scall.registers.get('a2') if fileno not in self.open_files: scall.registers.set('a0', -1) return - chars = self.open_files[fileno].read(len) + chars = self.open_files[fileno].read(size) try: data = bytearray(chars, 'ascii') scall.cpu.mmu.write(addr, len(data), data)