caller.py: implement write syscall
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 1 Dec 2023 07:29:18 +0000 (23:29 -0800)
committerJacob Lifshay <programmerjake@gmail.com>
Fri, 1 Dec 2023 09:29:58 +0000 (01:29 -0800)
src/openpower/decoder/isa/caller.py

index 53412e99802b256538a424419d118be7816eacf6..e48b714898a428b1d802731a345896385eaf9f47 100644 (file)
@@ -1163,6 +1163,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