diff options
author | Brandon Potter <brandon.potter@amd.com> | 2016-03-17 10:24:17 -0700 |
---|---|---|
committer | Brandon Potter <brandon.potter@amd.com> | 2016-03-17 10:24:17 -0700 |
commit | a04fac976f02377237bb827d46854b669ebc2397 (patch) | |
tree | 2f2a5e55e16b2c05e4d94e302081bb977e864a36 /src/arch/mips/linux/linux.cc | |
parent | 3fa311e5acd58ce720014dd964728c2fa414ca6a (diff) | |
download | gem5-a04fac976f02377237bb827d46854b669ebc2397.tar.xz |
syscall_emul: extend mmap system call to support file backed mmaps
For O3, which has a stat that counts reg reads, there is an additional
reg read per mmap() call since there's an arg we no longer ignore.
Otherwise, stats should not be affected.
Diffstat (limited to 'src/arch/mips/linux/linux.cc')
-rw-r--r-- | src/arch/mips/linux/linux.cc | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/arch/mips/linux/linux.cc b/src/arch/mips/linux/linux.cc index 4861f7cb9..2f0ca6090 100644 --- a/src/arch/mips/linux/linux.cc +++ b/src/arch/mips/linux/linux.cc @@ -28,10 +28,11 @@ * Authors: Korey Sewell */ -#include <fcntl.h> - #include "arch/mips/linux/linux.hh" +#include <fcntl.h> +#include <sys/mman.h> + // open(2) flags translation table SyscallFlagTransTable MipsLinux::openFlagTable[] = { #ifdef _MSC_VER @@ -97,3 +98,29 @@ SyscallFlagTransTable MipsLinux::openFlagTable[] = { const int MipsLinux::NUM_OPEN_FLAGS = (sizeof(MipsLinux::openFlagTable)/sizeof(MipsLinux::openFlagTable[0])); + +// mmap(2) flags translation table +SyscallFlagTransTable MipsLinux::mmapFlagTable[] = { + { MipsLinux::TGT_MAP_SHARED, MAP_SHARED }, + { MipsLinux::TGT_MAP_PRIVATE, MAP_PRIVATE }, + { MipsLinux::TGT_MAP_ANON, MAP_ANON }, + { MipsLinux::TGT_MAP_DENYWRITE, MAP_DENYWRITE }, + { MipsLinux::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE }, + { MipsLinux::TGT_MAP_FILE, MAP_FILE }, + { MipsLinux::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN }, + { MipsLinux::TGT_MAP_HUGETLB, MAP_HUGETLB }, + { MipsLinux::TGT_MAP_LOCKED, MAP_LOCKED }, + { MipsLinux::TGT_MAP_NONBLOCK, MAP_NONBLOCK }, + { MipsLinux::TGT_MAP_NORESERVE, MAP_NORESERVE }, + { MipsLinux::TGT_MAP_POPULATE, MAP_POPULATE }, +#ifdef MAP_STACK + { MipsLinux::TGT_MAP_STACK, MAP_STACK }, +#endif + { MipsLinux::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS }, + { MipsLinux::TGT_MAP_FIXED, MAP_FIXED }, +}; + +const unsigned MipsLinux::NUM_MMAP_FLAGS = + sizeof(MipsLinux::mmapFlagTable) / + sizeof(MipsLinux::mmapFlagTable[0]); + |