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>
Thu, 7 Dec 2023 17:51:22 +0000 (17:51 +0000)
src/openpower/decoder/isa/caller.py

index 61a0b35bc39a8e991203f335b9ea71b939542908..725a7045c8a2670fcc7ece5353c1bdf699d6142f 100644 (file)
@@ -1170,6 +1170,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