Deleted Added
sdiff udiff text old ( 11383:5ac090acd180 ) new ( 11385:dbbf54058f6f )
full compact
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
3 * Copyright (c) 2015 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 1209 unchanged lines hidden (view full) ---

1218 delete [] (char *)hiov[i].iov_base;
1219
1220 if (result < 0)
1221 return -errno;
1222
1223 return result;
1224}
1225
1226/// Real mmap handler.
1227template <class OS>
1228SyscallReturn
1229mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
1230 bool is_mmap2)
1231{
1232 int index = 0;
1233 Addr start = p->getSyscallArg(tc, index);
1234 uint64_t length = p->getSyscallArg(tc, index);
1235 int prot = p->getSyscallArg(tc, index);
1236 int tgt_flags = p->getSyscallArg(tc, index);
1237 int tgt_fd = p->getSyscallArg(tc, index);
1238 int offset = p->getSyscallArg(tc, index);
1239
1240 if (is_mmap2)
1241 offset *= TheISA::PageBytes;
1242
1243 if (start & (TheISA::PageBytes - 1) ||
1244 offset & (TheISA::PageBytes - 1) ||
1245 (tgt_flags & OS::TGT_MAP_PRIVATE &&
1246 tgt_flags & OS::TGT_MAP_SHARED) ||
1247 (!(tgt_flags & OS::TGT_MAP_PRIVATE) &&
1248 !(tgt_flags & OS::TGT_MAP_SHARED)) ||
1249 !length) {

--- 107 unchanged lines hidden (view full) ---

1357 // Note that we do not zero out the remainder of the mapping. This
1358 // is done by a real system, but it probably will not affect
1359 // execution (hopefully).
1360 }
1361
1362 return start;
1363}
1364
1365/// Target mmap() handler.
1366template <class OS>
1367SyscallReturn
1368mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
1369{
1370 return mmapImpl<OS>(desc, num, p, tc, false);
1371}
1372
1373/// Target mmap2() handler.
1374template <class OS>
1375SyscallReturn
1376mmap2Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
1377{
1378 return mmapImpl<OS>(desc, num, p, tc, true);
1379}
1380
1381/// Target getrlimit() handler.
1382template <class OS>
1383SyscallReturn
1384getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
1385 ThreadContext *tc)
1386{
1387 int index = 0;
1388 unsigned resource = process->getSyscallArg(tc, index);

--- 219 unchanged lines hidden ---