992,998c992,993
< /// doesn't really check addresses anyway). Always print a warning,
< /// since this could be seriously broken if we're not mapping
< /// /dev/zero.
< //
< /// Someday we should explicitly check for /dev/zero in open, flag the
< /// file descriptor, and fail (or implement!) a non-anonymous mmap to
< /// anything else.
---
> /// doesn't really check addresses anyway).
> ///
1008c1003
< int fd = p->sim_fd(p->getSyscallArg(tc, index));
---
> int tgt_fd = p->getSyscallArg(tc, index);
1010a1006,1011
> if (!(flags & OS::TGT_MAP_ANONYMOUS)) {
> Process::FdMap *fd_map = p->sim_fd_obj(tgt_fd);
> if (!fd_map || fd_map->fd < 0) {
> warn("mmap failing: target fd %d is not valid\n", tgt_fd);
> return -EBADF;
> }
1011a1013,1021
> if (fd_map->filename != "/dev/zero") {
> // This is very likely broken, but leave a warning here
> // (rather than panic) in case /dev/zero is known by
> // another name on some platform
> warn("allowing mmap of file %s; mmap not supported on files"
> " other than /dev/zero\n", fd_map->filename);
> }
> }
>
1035,1039d1044
< if (!(flags & OS::TGT_MAP_ANONYMOUS)) {
< warn("allowing mmap of file @ fd %d. "
< "This will break if not /dev/zero.", fd);
< }
<