flag_tables.hh revision 11413
111413Ssteve.reinhardt@amd.com/* 211413Ssteve.reinhardt@amd.com * Copyright (c) 2011 ARM Limited 311413Ssteve.reinhardt@amd.com * All rights reserved 411413Ssteve.reinhardt@amd.com * 511413Ssteve.reinhardt@amd.com * The license below extends only to copyright in the software and shall 611413Ssteve.reinhardt@amd.com * not be construed as granting a license to any other intellectual 711413Ssteve.reinhardt@amd.com * property including but not limited to intellectual property relating 811413Ssteve.reinhardt@amd.com * to a hardware implementation of the functionality of the software 911413Ssteve.reinhardt@amd.com * licensed hereunder. You may use the software subject to the license 1011413Ssteve.reinhardt@amd.com * terms below provided that you ensure that this notice is replicated 1111413Ssteve.reinhardt@amd.com * unmodified and in its entirety in all distributions of the software, 1211413Ssteve.reinhardt@amd.com * modified or unmodified, in source code or in binary form. 1311413Ssteve.reinhardt@amd.com * 1411413Ssteve.reinhardt@amd.com * Copyright (c) 2003-2005, 2006 The Regents of The University of Michigan 1511413Ssteve.reinhardt@amd.com * Copyright (c) 2007-2008 The Florida State University 1611413Ssteve.reinhardt@amd.com * Copyright (c) 2009 The University of Edinburgh 1711413Ssteve.reinhardt@amd.com * All rights reserved. 1811413Ssteve.reinhardt@amd.com * 1911413Ssteve.reinhardt@amd.com * Redistribution and use in source and binary forms, with or without 2011413Ssteve.reinhardt@amd.com * modification, are permitted provided that the following conditions are 2111413Ssteve.reinhardt@amd.com * met: redistributions of source code must retain the above copyright 2211413Ssteve.reinhardt@amd.com * notice, this list of conditions and the following disclaimer; 2311413Ssteve.reinhardt@amd.com * redistributions in binary form must reproduce the above copyright 2411413Ssteve.reinhardt@amd.com * notice, this list of conditions and the following disclaimer in the 2511413Ssteve.reinhardt@amd.com * documentation and/or other materials provided with the distribution; 2611413Ssteve.reinhardt@amd.com * neither the name of the copyright holders nor the names of its 2711413Ssteve.reinhardt@amd.com * contributors may be used to endorse or promote products derived from 2811413Ssteve.reinhardt@amd.com * this software without specific prior written permission. 2911413Ssteve.reinhardt@amd.com * 3011413Ssteve.reinhardt@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3111413Ssteve.reinhardt@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3211413Ssteve.reinhardt@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3311413Ssteve.reinhardt@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3411413Ssteve.reinhardt@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3511413Ssteve.reinhardt@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3611413Ssteve.reinhardt@amd.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3711413Ssteve.reinhardt@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3811413Ssteve.reinhardt@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3911413Ssteve.reinhardt@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 4011413Ssteve.reinhardt@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4111413Ssteve.reinhardt@amd.com * 4211413Ssteve.reinhardt@amd.com * Authors: Korey Sewell 4311413Ssteve.reinhardt@amd.com */ 4411413Ssteve.reinhardt@amd.com 4511413Ssteve.reinhardt@amd.com/* 4611413Ssteve.reinhardt@amd.com * @file flag_tables.hh 4711413Ssteve.reinhardt@amd.com * 4811413Ssteve.reinhardt@amd.com * This file contains definitions of flag translation tables for the 4911413Ssteve.reinhardt@amd.com * open() and mmap() system calls. Since the tables are nearly identical 5011413Ssteve.reinhardt@amd.com * across target platforms (other than the values of the target flags), 5111413Ssteve.reinhardt@amd.com * we use a single copy of the tables but include it separately for 5211413Ssteve.reinhardt@amd.com * each target platform. The TARGET macro must be #defined before including 5311413Ssteve.reinhardt@amd.com * to indicate the class for which the table is being defined. 5411413Ssteve.reinhardt@amd.com * 5511413Ssteve.reinhardt@amd.com * See src/arch/<*>/linux/linux.cc. 5611413Ssteve.reinhardt@amd.com */ 5711413Ssteve.reinhardt@amd.com 5811413Ssteve.reinhardt@amd.com// open(2) flags translation table 5911413Ssteve.reinhardt@amd.comSyscallFlagTransTable TARGET::openFlagTable[] = { 6011413Ssteve.reinhardt@amd.com#ifdef _MSC_VER 6111413Ssteve.reinhardt@amd.com { TARGET::TGT_O_RDONLY, _O_RDONLY }, 6211413Ssteve.reinhardt@amd.com { TARGET::TGT_O_WRONLY, _O_WRONLY }, 6311413Ssteve.reinhardt@amd.com { TARGET::TGT_O_RDWR, _O_RDWR }, 6411413Ssteve.reinhardt@amd.com { TARGET::TGT_O_CREAT, _O_CREAT }, 6511413Ssteve.reinhardt@amd.com { TARGET::TGT_O_EXCL, _O_EXCL }, 6611413Ssteve.reinhardt@amd.com { TARGET::TGT_O_TRUNC, _O_TRUNC }, 6711413Ssteve.reinhardt@amd.com { TARGET::TGT_O_APPEND, _O_APPEND }, 6811413Ssteve.reinhardt@amd.com#else /* !_MSC_VER */ 6911413Ssteve.reinhardt@amd.com { TARGET::TGT_O_RDONLY, O_RDONLY }, 7011413Ssteve.reinhardt@amd.com { TARGET::TGT_O_WRONLY, O_WRONLY }, 7111413Ssteve.reinhardt@amd.com { TARGET::TGT_O_RDWR, O_RDWR }, 7211413Ssteve.reinhardt@amd.com { TARGET::TGT_O_CREAT, O_CREAT }, 7311413Ssteve.reinhardt@amd.com { TARGET::TGT_O_EXCL, O_EXCL }, 7411413Ssteve.reinhardt@amd.com { TARGET::TGT_O_TRUNC, O_TRUNC }, 7511413Ssteve.reinhardt@amd.com { TARGET::TGT_O_APPEND, O_APPEND }, 7611413Ssteve.reinhardt@amd.com { TARGET::TGT_O_NOCTTY, O_NOCTTY }, 7711413Ssteve.reinhardt@amd.com { TARGET::TGT_O_NONBLOCK, O_NONBLOCK }, 7811413Ssteve.reinhardt@amd.com#ifdef O_DSYNC 7911413Ssteve.reinhardt@amd.com { TARGET::TGT_O_DSYNC, O_DSYNC }, 8011413Ssteve.reinhardt@amd.com#endif 8111413Ssteve.reinhardt@amd.com#ifdef O_ASYNC 8211413Ssteve.reinhardt@amd.com { TARGET::TGT_FASYNC, O_ASYNC }, 8311413Ssteve.reinhardt@amd.com#endif 8411413Ssteve.reinhardt@amd.com#ifdef O_DIRECT 8511413Ssteve.reinhardt@amd.com { TARGET::TGT_O_DIRECT, O_DIRECT }, 8611413Ssteve.reinhardt@amd.com#endif 8711413Ssteve.reinhardt@amd.com#ifdef O_LARGEFILE 8811413Ssteve.reinhardt@amd.com { TARGET::TGT_O_LARGEFILE, O_LARGEFILE }, 8911413Ssteve.reinhardt@amd.com#endif 9011413Ssteve.reinhardt@amd.com#ifdef O_DIRECTORY 9111413Ssteve.reinhardt@amd.com { TARGET::TGT_O_DIRECTORY, O_DIRECTORY }, 9211413Ssteve.reinhardt@amd.com#endif 9311413Ssteve.reinhardt@amd.com#ifdef O_NOFOLLOW 9411413Ssteve.reinhardt@amd.com { TARGET::TGT_O_NOFOLLOW, O_NOFOLLOW }, 9511413Ssteve.reinhardt@amd.com#endif 9611413Ssteve.reinhardt@amd.com#ifdef O_NOATIME 9711413Ssteve.reinhardt@amd.com { TARGET::TGT_O_NOATIME, O_NOATIME }, 9811413Ssteve.reinhardt@amd.com#endif 9911413Ssteve.reinhardt@amd.com#ifdef O_CLOEXEC 10011413Ssteve.reinhardt@amd.com { TARGET::TGT_O_CLOEXEC, O_CLOEXEC }, 10111413Ssteve.reinhardt@amd.com#endif 10211413Ssteve.reinhardt@amd.com#ifdef O_SYNC 10311413Ssteve.reinhardt@amd.com { TARGET::TGT_O_SYNC, O_SYNC }, 10411413Ssteve.reinhardt@amd.com#endif 10511413Ssteve.reinhardt@amd.com#ifdef O_PATH 10611413Ssteve.reinhardt@amd.com { TARGET::TGT_O_PATH, O_PATH }, 10711413Ssteve.reinhardt@amd.com#endif 10811413Ssteve.reinhardt@amd.com#endif /* _MSC_VER */ 10911413Ssteve.reinhardt@amd.com}; 11011413Ssteve.reinhardt@amd.com 11111413Ssteve.reinhardt@amd.comconst int TARGET::NUM_OPEN_FLAGS = 11211413Ssteve.reinhardt@amd.com sizeof(TARGET::openFlagTable) / sizeof(TARGET::openFlagTable[0]); 11311413Ssteve.reinhardt@amd.com 11411413Ssteve.reinhardt@amd.com// mmap(2) flags translation table 11511413Ssteve.reinhardt@amd.comSyscallFlagTransTable TARGET::mmapFlagTable[] = { 11611413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_SHARED, MAP_SHARED }, 11711413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_PRIVATE, MAP_PRIVATE }, 11811413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_FIXED, MAP_FIXED }, 11911413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS }, 12011413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_ANON, MAP_ANON }, 12111413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_FILE, MAP_FILE }, 12211413Ssteve.reinhardt@amd.com#if defined(MAP_32BIT) && defined(TARGET_HAS_MAP_32BIT) 12311413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_32BIT, MAP_32BIT }, 12411413Ssteve.reinhardt@amd.com#endif 12511413Ssteve.reinhardt@amd.com#ifdef MAP_DENYWRITE 12611413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_DENYWRITE, MAP_DENYWRITE }, 12711413Ssteve.reinhardt@amd.com#endif 12811413Ssteve.reinhardt@amd.com#ifdef MAP_EXECUTABLE 12911413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE }, 13011413Ssteve.reinhardt@amd.com#endif 13111413Ssteve.reinhardt@amd.com#ifdef MAP_GROWSDOWN 13211413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN }, 13311413Ssteve.reinhardt@amd.com#endif 13411413Ssteve.reinhardt@amd.com#ifdef MAP_HUGETLB 13511413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_HUGETLB, MAP_HUGETLB }, 13611413Ssteve.reinhardt@amd.com#endif 13711413Ssteve.reinhardt@amd.com#ifdef MAP_LOCKED 13811413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_LOCKED, MAP_LOCKED }, 13911413Ssteve.reinhardt@amd.com#endif 14011413Ssteve.reinhardt@amd.com#ifdef MAP_NONBLOCK 14111413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_NONBLOCK, MAP_NONBLOCK }, 14211413Ssteve.reinhardt@amd.com#endif 14311413Ssteve.reinhardt@amd.com#ifdef MAP_NORESERVE 14411413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_NORESERVE, MAP_NORESERVE }, 14511413Ssteve.reinhardt@amd.com#endif 14611413Ssteve.reinhardt@amd.com#ifdef MAP_POPULATE 14711413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_POPULATE, MAP_POPULATE }, 14811413Ssteve.reinhardt@amd.com#endif 14911413Ssteve.reinhardt@amd.com#ifdef MAP_STACK 15011413Ssteve.reinhardt@amd.com { TARGET::TGT_MAP_STACK, MAP_STACK }, 15111413Ssteve.reinhardt@amd.com#endif 15211413Ssteve.reinhardt@amd.com}; 15311413Ssteve.reinhardt@amd.com 15411413Ssteve.reinhardt@amd.comconst unsigned TARGET::NUM_MMAP_FLAGS = 15511413Ssteve.reinhardt@amd.com sizeof(TARGET::mmapFlagTable) / sizeof(TARGET::mmapFlagTable[0]); 15611413Ssteve.reinhardt@amd.com 157