On Tuesday 11 September 2007 17:16:25 Ali Saidi wrote:
> Yea, if Elliott sends us a diff we'll be happy to commit it.

Well, I guess Elliot wasn't able to test it yet, but I applied his changes and 
they work very well. Find the patch attached for inclusion in the main tree.

> When we open up the repository, mailing a change should be as easy as  
> typing a single command line. I hope people will contribute regularly  
> when that happens. Publishing your fixing for a bug or new  
> functionality can save someone the time of repeating the work later  
> and ultimately increase the overall success of M5.

Full ACK. An open repos will be very beneficial.

-- 
Dipl.-Ing. Jonas Diemer
Institut für Datentechnik und Kommunikationsnetze
(Institute of Computer and Communication Network Engineering)

Hans-Sommer-Str. 66
D-38106 Braunschweig
Germany

Telefon: +49 531 391 3752
Telefax: +49 531 391 4587
E-Mail:  [EMAIL PROTECTED]
Web:     http://www.ida.ing.tu-bs.de/

diff -ur ../m5-2.0b3-orig/src/arch/alpha/linux/process.cc src/arch/alpha/linux/process.cc
--- ../m5-2.0b3-orig/src/arch/alpha/linux/process.cc	2007-05-17 04:25:47.000000000 +0200
+++ src/arch/alpha/linux/process.cc	2007-09-12 14:01:00.539984316 +0200
@@ -549,7 +549,7 @@
     /* 422 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
     /* 423 */ SyscallDesc("semtimedop", unimplementedFunc),
     /* 424 */ SyscallDesc("tgkill", unimplementedFunc),
-    /* 425 */ SyscallDesc("stat64", unimplementedFunc),
+    /* 425 */ SyscallDesc("stat64", stat64Func<AlphaLinux>),
     /* 426 */ SyscallDesc("lstat64", lstat64Func<AlphaLinux>),
     /* 427 */ SyscallDesc("fstat64", fstat64Func<AlphaLinux>),
     /* 428 */ SyscallDesc("vserver", unimplementedFunc),
diff -ur ../m5-2.0b3-orig/src/sim/syscall_emul.hh src/sim/syscall_emul.hh
--- ../m5-2.0b3-orig/src/sim/syscall_emul.hh	2007-05-17 04:25:46.000000000 +0200
+++ src/sim/syscall_emul.hh	2007-09-12 13:59:51.064025105 +0200
@@ -604,6 +604,32 @@
 }
 
 
+/// Target stat64() handler.
+template <class OS>
+        SyscallReturn
+        stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
+                   ThreadContext *tc)
+{
+    std::string path;
+
+    if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
+        return -EFAULT;
+
+    // Adjust path for current working directory
+    path = process->fullPath(path);
+
+    struct stat64 hostBuf;
+    int result = stat64(path.c_str(), &hostBuf);
+
+    if (result < 0)
+        return -errno;
+
+    copyOutStat64Buf<OS>(tc->getMemPort(), tc->getSyscallArg(1), &hostBuf);
+
+    return 0;
+}
+
+
 /// Target fstat64() handler.
 template <class OS>
 SyscallReturn
_______________________________________________
m5-users mailing list
m5-users@m5sim.org
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to