sim-se: fstat64 bugfix

The fstat64 system call does an upcast on entries in the file
descriptor array to check if the file descriptor has a backing
host-filesystem file opened. It does so because it needs to pass
the host fd into the fstat call (since we rely on the host
filesystem to service filesystem system calls).

The upcast was overly specific. This changeset alters the system
call to use the most general base class of the file descriptor
entries that can satisfy the code.

Change-Id: I10daf820257cea4d678ee6917e01e9cc9cd1cf5e
Tested-by: kokoro <>
Maintainer: Brandon Potter <>
Reviewed-by: Jason Lowe-Power <>
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 8a73cb2..e2f2fc2 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1338,7 +1338,7 @@
     int tgt_fd = p->getSyscallArg(tc, index);
     Addr bufPtr = p->getSyscallArg(tc, index);
-    auto ffdp = std::dynamic_pointer_cast<FileFDEntry>((*p->fds)[tgt_fd]);
+    auto ffdp = std::dynamic_pointer_cast<HBFDEntry>((*p->fds)[tgt_fd]);
     if (!ffdp)
         return -EBADF;
     int sim_fd = ffdp->getSimFD();