Sorry, this all worked fine on my RHEL6 machine. I have a patch and am re-running the regressions on zizzer. Basically I'm adding unistd.h and changing the host call from pwrite64() => pwrite(), and I verified it can at least compile on zizzer now.
-----Original Message----- From: gem5-dev [mailto:[email protected]] On Behalf Of Andreas Hansson Sent: Friday, August 05, 2016 1:25 AM To: gem5 Developer List <[email protected]> Subject: Re: [gem5-dev] changeset in gem5: x86, sim: add some syscalls to X86 Following up on this issue. For Linux it seems we get away with including unistd.h, but this only really masks the real problem: We should not use the transitional file access API (such as pwrite64), but rather stick to pwrite. OSX doesn’t even have the pwrite64 function in its libc implementation. See e.g. This discussion around VLC: https://mailman.videolan.org/pipermail/vlc-devel/2010-March/073937.html Andreas On 05/08/2016, 08:54, "gem5-dev on behalf of Andreas Hansson" <[email protected] on behalf of [email protected]> wrote: >Tony, > >It seems you killed gem5, literally. Beyond x86 the simulator does not >even compile. > >Andreas > >On 04/08/2016, 17:32, "gem5-dev on behalf of Tony Gutierrez" ><[email protected] on behalf of [email protected]> wrote: > >>changeset ba45735a726a in /z/repo/gem5 >>details: http://repo.gem5.org/gem5?cmd=changeset;node=ba45735a726a >>description: >>x86, sim: add some syscalls to X86 >> >>this patch adds an implementation for the pwrite64 syscall and enables >>it for x86_64, and enables fstatfs for x86_64. >> >>diffstat: >> >> src/arch/x86/linux/process.cc | 4 ++-- >> src/sim/syscall_emul.hh | 22 ++++++++++++++++++++++ >> 2 files changed, 24 insertions(+), 2 deletions(-) >> >>diffs (53 lines): >> >>diff -r 92509f1b24f7 -r ba45735a726a src/arch/x86/linux/process.cc >>--- a/src/arch/x86/linux/process.ccWed Aug 03 11:10:46 2016 -0500 >>+++ b/src/arch/x86/linux/process.ccThu Aug 04 12:32:21 2016 -0400 >>@@ -236,7 +236,7 @@ >> /* 15 */ SyscallDesc("rt_sigreturn", unimplementedFunc), >> /* 16 */ SyscallDesc("ioctl", ioctlFunc<X86Linux64>), >> /* 17 */ SyscallDesc("pread64", unimplementedFunc), >>- /* 18 */ SyscallDesc("pwrite64", unimplementedFunc), >>+ /* 18 */ SyscallDesc("pwrite64", pwrite64Func<X86Linux64>), >> /* 19 */ SyscallDesc("readv", unimplementedFunc), >> /* 20 */ SyscallDesc("writev", writevFunc<X86Linux64>), >> /* 21 */ SyscallDesc("access", ignoreFunc), @@ -356,7 +356,7 @@ >> /* 135 */ SyscallDesc("personality", unimplementedFunc), >> /* 136 */ SyscallDesc("ustat", unimplementedFunc), >> /* 137 */ SyscallDesc("statfs", unimplementedFunc), >>- /* 138 */ SyscallDesc("fstatfs", unimplementedFunc), >>+ /* 138 */ SyscallDesc("fstatfs", fstatfsFunc<X86Linux64>), >> /* 139 */ SyscallDesc("sysfs", unimplementedFunc), >> /* 140 */ SyscallDesc("getpriority", unimplementedFunc), >> /* 141 */ SyscallDesc("setpriority", unimplementedFunc), diff -r >>92509f1b24f7 -r ba45735a726a src/sim/syscall_emul.hh >>--- a/src/sim/syscall_emul.hhWed Aug 03 11:10:46 2016 -0500 >>+++ b/src/sim/syscall_emul.hhThu Aug 04 12:32:21 2016 -0400 >>@@ -1389,6 +1389,28 @@ >> return start; >> } >> >>+template <class OS> >>+SyscallReturn >>+pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, >>+ThreadContext >>*tc) >>+{ >>+ int index = 0; >>+ int tgt_fd = p->getSyscallArg(tc, index); >>+ Addr bufPtr = p->getSyscallArg(tc, index); >>+ int nbytes = p->getSyscallArg(tc, index); >>+ int offset = p->getSyscallArg(tc, index); >>+ >>+ int sim_fd = p->getSimFD(tgt_fd); >>+ if (sim_fd < 0) >>+ return -EBADF; >>+ >>+ BufferArg bufArg(bufPtr, nbytes); >>+ bufArg.copyIn(tc->getMemProxy()); >>+ >>+ int bytes_written = pwrite64(sim_fd, bufArg.bufferPtr(), nbytes, >>offset); >>+ >>+ return (bytes_written == -1) ? -errno : bytes_written; } >>+ >> /// Target mmap() handler. >> template <class OS> >> SyscallReturn >>_______________________________________________ >>gem5-dev mailing list >>[email protected] >>http://m5sim.org/mailman/listinfo/gem5-dev > >IMPORTANT NOTICE: The contents of this email and any attachments are >confidential and may also be privileged. If you are not the intended >recipient, please notify the sender immediately and do not disclose the >contents to any other person, use it for any purpose, or store or copy >the information in any medium. Thank you. >_______________________________________________ >gem5-dev mailing list >[email protected] >http://m5sim.org/mailman/listinfo/gem5-dev IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
