linux.cc revision 10037
16019Shines@cs.fsu.edu/*
210037SARM gem5 Developers * Copyright (c) 2011 ARM Limited
310037SARM gem5 Developers * All rights reserved
410037SARM gem5 Developers *
510037SARM gem5 Developers * The license below extends only to copyright in the software and shall
610037SARM gem5 Developers * not be construed as granting a license to any other intellectual
710037SARM gem5 Developers * property including but not limited to intellectual property relating
810037SARM gem5 Developers * to a hardware implementation of the functionality of the software
910037SARM gem5 Developers * licensed hereunder.  You may use the software subject to the license
1010037SARM gem5 Developers * terms below provided that you ensure that this notice is replicated
1110037SARM gem5 Developers * unmodified and in its entirety in all distributions of the software,
1210037SARM gem5 Developers * modified or unmodified, in source code or in binary form.
1310037SARM gem5 Developers *
146019Shines@cs.fsu.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan
156019Shines@cs.fsu.edu * Copyright (c) 2007-2008 The Florida State University
166019Shines@cs.fsu.edu * All rights reserved.
176019Shines@cs.fsu.edu *
186019Shines@cs.fsu.edu * Redistribution and use in source and binary forms, with or without
196019Shines@cs.fsu.edu * modification, are permitted provided that the following conditions are
206019Shines@cs.fsu.edu * met: redistributions of source code must retain the above copyright
216019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer;
226019Shines@cs.fsu.edu * redistributions in binary form must reproduce the above copyright
236019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer in the
246019Shines@cs.fsu.edu * documentation and/or other materials provided with the distribution;
256019Shines@cs.fsu.edu * neither the name of the copyright holders nor the names of its
266019Shines@cs.fsu.edu * contributors may be used to endorse or promote products derived from
276019Shines@cs.fsu.edu * this software without specific prior written permission.
286019Shines@cs.fsu.edu *
296019Shines@cs.fsu.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
306019Shines@cs.fsu.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
316019Shines@cs.fsu.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
326019Shines@cs.fsu.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
336019Shines@cs.fsu.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
346019Shines@cs.fsu.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
356019Shines@cs.fsu.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
366019Shines@cs.fsu.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
376019Shines@cs.fsu.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
386019Shines@cs.fsu.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
396019Shines@cs.fsu.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
406019Shines@cs.fsu.edu *
416019Shines@cs.fsu.edu * Authors: Stephen Hines
426019Shines@cs.fsu.edu */
436019Shines@cs.fsu.edu
448229Snate@binkert.org#include <fcntl.h>
458229Snate@binkert.org
466019Shines@cs.fsu.edu#include "arch/arm/linux/linux.hh"
476019Shines@cs.fsu.edu
486019Shines@cs.fsu.edu// open(2) flags translation table
4910037SARM gem5 DevelopersOpenFlagTransTable ArmLinux32::openFlagTable[] = {
506019Shines@cs.fsu.edu#ifdef _MSC_VER
5110037SARM gem5 Developers  { ArmLinux32::TGT_O_RDONLY,     _O_RDONLY },
5210037SARM gem5 Developers  { ArmLinux32::TGT_O_WRONLY,     _O_WRONLY },
5310037SARM gem5 Developers  { ArmLinux32::TGT_O_RDWR,       _O_RDWR },
5410037SARM gem5 Developers  { ArmLinux32::TGT_O_APPEND,     _O_APPEND },
5510037SARM gem5 Developers  { ArmLinux32::TGT_O_CREAT,      _O_CREAT },
5610037SARM gem5 Developers  { ArmLinux32::TGT_O_TRUNC,      _O_TRUNC },
5710037SARM gem5 Developers  { ArmLinux32::TGT_O_EXCL,       _O_EXCL },
586019Shines@cs.fsu.edu#ifdef _O_NONBLOCK
5910037SARM gem5 Developers  { ArmLinux32::TGT_O_NONBLOCK,   _O_NONBLOCK },
606019Shines@cs.fsu.edu#endif
616019Shines@cs.fsu.edu#ifdef _O_NOCTTY
6210037SARM gem5 Developers  { ArmLinux32::TGT_O_NOCTTY,     _O_NOCTTY },
636019Shines@cs.fsu.edu#endif
646019Shines@cs.fsu.edu#ifdef _O_SYNC
6510037SARM gem5 Developers  { ArmLinux32::TGT_O_SYNC,       _O_SYNC },
666019Shines@cs.fsu.edu#endif
676019Shines@cs.fsu.edu#else /* !_MSC_VER */
6810037SARM gem5 Developers  { ArmLinux32::TGT_O_RDONLY,     O_RDONLY },
6910037SARM gem5 Developers  { ArmLinux32::TGT_O_WRONLY,     O_WRONLY },
7010037SARM gem5 Developers  { ArmLinux32::TGT_O_RDWR,       O_RDWR },
7110037SARM gem5 Developers  { ArmLinux32::TGT_O_CREAT,      O_CREAT },
7210037SARM gem5 Developers  { ArmLinux32::TGT_O_EXCL,       O_EXCL },
7310037SARM gem5 Developers  { ArmLinux32::TGT_O_NOCTTY,     O_NOCTTY },
7410037SARM gem5 Developers  { ArmLinux32::TGT_O_TRUNC,      O_TRUNC },
7510037SARM gem5 Developers  { ArmLinux32::TGT_O_APPEND,     O_APPEND },
7610037SARM gem5 Developers  { ArmLinux32::TGT_O_NONBLOCK,   O_NONBLOCK },
776019Shines@cs.fsu.edu#ifdef O_SYNC
7810037SARM gem5 Developers  { ArmLinux32::TGT_O_SYNC,       O_SYNC },
796019Shines@cs.fsu.edu#endif
807441SAli.Saidi@ARM.com#ifdef FASYNC
8110037SARM gem5 Developers  { ArmLinux32::TGT_FASYNC,       FASYNC },
827441SAli.Saidi@ARM.com#endif
837441SAli.Saidi@ARM.com#ifdef O_DIRECT
8410037SARM gem5 Developers  { ArmLinux32::TGT_O_DIRECT,     O_DIRECT },
857441SAli.Saidi@ARM.com#endif
867441SAli.Saidi@ARM.com#ifdef O_LARGEFILE
8710037SARM gem5 Developers  { ArmLinux32::TGT_O_LARGEFILE,  O_LARGEFILE },
887441SAli.Saidi@ARM.com#endif
897441SAli.Saidi@ARM.com#ifdef O_DIRECTORY
9010037SARM gem5 Developers  { ArmLinux32::TGT_O_DIRECTORY,  O_DIRECTORY },
917441SAli.Saidi@ARM.com#endif
927441SAli.Saidi@ARM.com#ifdef O_NOFOLLOW
9310037SARM gem5 Developers  { ArmLinux32::TGT_O_NOFOLLOW,   O_NOFOLLOW },
947441SAli.Saidi@ARM.com#endif
956019Shines@cs.fsu.edu#endif /* _MSC_VER */
966019Shines@cs.fsu.edu};
976019Shines@cs.fsu.edu
9810037SARM gem5 Developersconst int ArmLinux32::NUM_OPEN_FLAGS = sizeof(ArmLinux32::openFlagTable) /
9910037SARM gem5 Developers                                       sizeof(ArmLinux32::openFlagTable[0]);
1006019Shines@cs.fsu.edu
10110037SARM gem5 Developers// open(2) flags translation table
10210037SARM gem5 DevelopersOpenFlagTransTable ArmLinux64::openFlagTable[] = {
10310037SARM gem5 Developers#ifdef _MSC_VER
10410037SARM gem5 Developers  { ArmLinux64::TGT_O_RDONLY,     _O_RDONLY },
10510037SARM gem5 Developers  { ArmLinux64::TGT_O_WRONLY,     _O_WRONLY },
10610037SARM gem5 Developers  { ArmLinux64::TGT_O_RDWR,       _O_RDWR },
10710037SARM gem5 Developers  { ArmLinux64::TGT_O_APPEND,     _O_APPEND },
10810037SARM gem5 Developers  { ArmLinux64::TGT_O_CREAT,      _O_CREAT },
10910037SARM gem5 Developers  { ArmLinux64::TGT_O_TRUNC,      _O_TRUNC },
11010037SARM gem5 Developers  { ArmLinux64::TGT_O_EXCL,       _O_EXCL },
11110037SARM gem5 Developers#ifdef _O_NONBLOCK
11210037SARM gem5 Developers  { ArmLinux64::TGT_O_NONBLOCK,   _O_NONBLOCK },
11310037SARM gem5 Developers#endif
11410037SARM gem5 Developers#ifdef _O_NOCTTY
11510037SARM gem5 Developers  { ArmLinux64::TGT_O_NOCTTY,     _O_NOCTTY },
11610037SARM gem5 Developers#endif
11710037SARM gem5 Developers#ifdef _O_SYNC
11810037SARM gem5 Developers  { ArmLinux64::TGT_O_SYNC,       _O_SYNC },
11910037SARM gem5 Developers#endif
12010037SARM gem5 Developers#else /* !_MSC_VER */
12110037SARM gem5 Developers  { ArmLinux64::TGT_O_RDONLY,     O_RDONLY },
12210037SARM gem5 Developers  { ArmLinux64::TGT_O_WRONLY,     O_WRONLY },
12310037SARM gem5 Developers  { ArmLinux64::TGT_O_RDWR,       O_RDWR },
12410037SARM gem5 Developers  { ArmLinux64::TGT_O_CREAT,      O_CREAT },
12510037SARM gem5 Developers  { ArmLinux64::TGT_O_EXCL,       O_EXCL },
12610037SARM gem5 Developers  { ArmLinux64::TGT_O_NOCTTY,     O_NOCTTY },
12710037SARM gem5 Developers  { ArmLinux64::TGT_O_TRUNC,      O_TRUNC },
12810037SARM gem5 Developers  { ArmLinux64::TGT_O_APPEND,     O_APPEND },
12910037SARM gem5 Developers  { ArmLinux64::TGT_O_NONBLOCK,   O_NONBLOCK },
13010037SARM gem5 Developers#ifdef O_SYNC
13110037SARM gem5 Developers  { ArmLinux64::TGT_O_SYNC,       O_SYNC },
13210037SARM gem5 Developers#endif
13310037SARM gem5 Developers#ifdef FASYNC
13410037SARM gem5 Developers  { ArmLinux64::TGT_FASYNC,       FASYNC },
13510037SARM gem5 Developers#endif
13610037SARM gem5 Developers#ifdef O_DIRECT
13710037SARM gem5 Developers  { ArmLinux64::TGT_O_DIRECT,     O_DIRECT },
13810037SARM gem5 Developers#endif
13910037SARM gem5 Developers#ifdef O_LARGEFILE
14010037SARM gem5 Developers  { ArmLinux64::TGT_O_LARGEFILE,  O_LARGEFILE },
14110037SARM gem5 Developers#endif
14210037SARM gem5 Developers#ifdef O_DIRECTORY
14310037SARM gem5 Developers  { ArmLinux64::TGT_O_DIRECTORY,  O_DIRECTORY },
14410037SARM gem5 Developers#endif
14510037SARM gem5 Developers#ifdef O_NOFOLLOW
14610037SARM gem5 Developers  { ArmLinux64::TGT_O_NOFOLLOW,   O_NOFOLLOW },
14710037SARM gem5 Developers#endif
14810037SARM gem5 Developers#endif /* _MSC_VER */
14910037SARM gem5 Developers};
15010037SARM gem5 Developers
15110037SARM gem5 Developersconst int ArmLinux64::NUM_OPEN_FLAGS = sizeof(ArmLinux64::openFlagTable) /
15210037SARM gem5 Developers                                       sizeof(ArmLinux64::openFlagTable[0]);
15310037SARM gem5 Developers
154