fixed read syscall shadowing of len

float_support
Anton Lydike 4 years ago
parent 38cb3f7669
commit d3fe6cb1a9

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

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

Loading…
Cancel
Save