summaryrefslogtreecommitdiff
path: root/arch/alpha/alpha_linux_process.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-02-15 01:23:13 -0500
committerAli Saidi <saidi@eecs.umich.edu>2006-02-15 01:23:13 -0500
commit18a0fa3e0c19e1afaf1dedb3d5a3b14a2c3aa3c7 (patch)
treed2df59785f910ac7d285ac4591a15dda8c01bf49 /arch/alpha/alpha_linux_process.cc
parent79613686f0f6a8725e88e935a7c9ff4ede4cfc2b (diff)
downloadgem5-18a0fa3e0c19e1afaf1dedb3d5a3b14a2c3aa3c7.tar.xz
endian fixes and compiles on mac os x
arch/alpha/alpha_linux_process.cc: add endian conversions for fstat functions arch/alpha/alpha_tru64_process.cc: add endian conversions for various functions sim/byteswap.hh: for some reason gcc on macos really wants long and unsigned long Why int32_t and uint32_t isn't sufficient I don't know. sim/process.cc: sim/syscall_emul.hh: endian fixes --HG-- extra : convert_revision : ce625d5660b70867c43c74fbed856149c0d8cd36
Diffstat (limited to 'arch/alpha/alpha_linux_process.cc')
-rw-r--r--arch/alpha/alpha_linux_process.cc46
1 files changed, 29 insertions, 17 deletions
diff --git a/arch/alpha/alpha_linux_process.cc b/arch/alpha/alpha_linux_process.cc
index 113b41472..fb5e32e63 100644
--- a/arch/alpha/alpha_linux_process.cc
+++ b/arch/alpha/alpha_linux_process.cc
@@ -296,27 +296,38 @@ class Linux {
// Same for stat64
static void
- copyOutStat64Buf(FunctionalMemory *mem, Addr addr, hst_stat64 *host)
+ copyOutStat64Buf(FunctionalMemory *mem, int fd, Addr addr, hst_stat64 *host)
{
TypedBufferArg<Linux::tgt_stat64> tgt(addr);
- // XXX byteswaps
- tgt->st_dev = htog(host->st_dev);
+ // fd == 1 checks are because libc does some checks
+ // that the stdout is interactive vs. a file
+ // this makes it work on non-linux systems
+ if (fd == 1)
+ tgt->st_dev = htog((uint64_t)0xA);
+ else
+ tgt->st_dev = htog((uint64_t)host->st_dev);
// XXX What about STAT64_HAS_BROKEN_ST_INO ???
- tgt->st_ino = htog(host->st_ino);
- tgt->st_rdev = htog(host->st_rdev);
- tgt->st_size = htog(host->st_size);
- tgt->st_blocks = htog(host->st_blocks);
-
- tgt->st_mode = htog(host->st_mode);
- tgt->st_uid = htog(host->st_uid);
- tgt->st_gid = htog(host->st_gid);
- tgt->st_blksize = htog(host->st_blksize);
- tgt->st_nlink = htog(host->st_nlink);
- tgt->tgt_st_atime = htog(host->st_atime);
- tgt->tgt_st_mtime = htog(host->st_mtime);
- tgt->tgt_st_ctime = htog(host->st_ctime);
-#if defined(STAT_HAVE_NSEC) || (BSD_HOST == 1)
+ tgt->st_ino = htog((uint64_t)host->st_ino);
+ if (fd == 1)
+ tgt->st_rdev = htog((uint64_t)0x880d);
+ else
+ tgt->st_rdev = htog((uint64_t)host->st_rdev);
+ tgt->st_size = htog((int64_t)host->st_size);
+ tgt->st_blocks = htog((uint64_t)host->st_blocks);
+
+ if (fd == 1)
+ tgt->st_mode = htog((uint32_t)0x2190);
+ else
+ tgt->st_mode = htog((uint32_t)host->st_mode);
+ tgt->st_uid = htog((uint32_t)host->st_uid);
+ tgt->st_gid = htog((uint32_t)host->st_gid);
+ tgt->st_blksize = htog((uint32_t)host->st_blksize);
+ tgt->st_nlink = htog((uint32_t)host->st_nlink);
+ tgt->tgt_st_atime = htog((uint64_t)host->st_atime);
+ tgt->tgt_st_mtime = htog((uint64_t)host->st_mtime);
+ tgt->tgt_st_ctime = htog((uint64_t)host->st_ctime);
+#if defined(STAT_HAVE_NSEC)
tgt->st_atime_nsec = htog(host->st_atime_nsec);
tgt->st_mtime_nsec = htog(host->st_mtime_nsec);
tgt->st_ctime_nsec = htog(host->st_ctime_nsec);
@@ -325,6 +336,7 @@ class Linux {
tgt->st_mtime_nsec = 0;
tgt->st_ctime_nsec = 0;
#endif
+
tgt.copyOut(mem);
}