arch-arm: Semihosting, fix SYS_FLEN
authorAdrian Herrera <adrian.herrera@arm.com>
Fri, 15 Nov 2019 11:42:23 +0000 (11:42 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 18 Dec 2019 14:23:04 +0000 (14:23 +0000)
SYS_FLEN was incorrectly handled as SYS_ISTTY. This patch fixes this
behaviour.

Change-Id: I66e0b97d8b44d2cb78e0b1bb940fd6f4b52c658f
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23752
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/semihosting.cc

index e04f4199dfe484514c571daa0a54f110cd0a00f0..2fe5373b85381a9b16c208ff4710ddd5cc919e79 100644 (file)
@@ -454,11 +454,11 @@ ArmSemihosting::callFLen(ThreadContext *tc, bool aarch64,
     if (argv[1] > files.size() || !files[argv[1]])
         return retError(EBADF);
 
-    int64_t ret = files[argv[1]]->isTTY();
+    int64_t ret = files[argv[1]]->flen();
     if (ret < 0) {
         return retError(-ret);
     } else {
-        return retOK(0);
+        return retOK(ret);
     }
 }