caller.py: implement write syscall
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 1 Dec 2023 07:29:18 +0000 (23:29 -0800)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 Dec 2023 19:26:21 +0000 (19:26 +0000)
src/openpower/decoder/isa/caller.py

index ae6ade0195b22d85e5a00eb8305e2a87606135f3..205ae88808ab7ecf7c23e89eeb35fdf1322cbb32 100644 (file)
@@ -1166,6 +1166,13 @@ class SyscallEmulator(openpower.syscalls.Dispatcher):
         self.__isacaller.halted = True
         raise ExitSyscallCalled(status)
 
+    def sys_write(self, fd, buf, count, *rest):
+        buf = self.__isacaller.mem.get_ctypes(buf, count, is_write=False)
+        try:
+            return os.write(fd, buf)
+        except OSError as e:
+            return -e.errno
+
 
 class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop):
     # decoder2 - an instance of power_decoder2