POWER: Add support for the Power ISA
[gem5.git] / src / arch / power / linux / linux.cc
1 /*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * Copyright (c) 2009 The University of Edinburgh
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Authors: Timothy M. Jones
30 */
31
32 #include "arch/power/linux/linux.hh"
33
34 #include <fcntl.h>
35
36 // open(2) flags translation table
37 OpenFlagTransTable PowerLinux::openFlagTable[] = {
38 #ifdef _MSC_VER
39 { PowerLinux::TGT_O_RDONLY, _O_RDONLY },
40 { PowerLinux::TGT_O_WRONLY, _O_WRONLY },
41 { PowerLinux::TGT_O_RDWR, _O_RDWR },
42 { PowerLinux::TGT_O_APPEND, _O_APPEND },
43 { PowerLinux::TGT_O_CREAT, _O_CREAT },
44 { PowerLinux::TGT_O_TRUNC, _O_TRUNC },
45 { PowerLinux::TGT_O_EXCL, _O_EXCL },
46 #ifdef _O_NONBLOCK
47 { PowerLinux::TGT_O_NONBLOCK, _O_NONBLOCK },
48 #endif
49 #ifdef _O_NOCTTY
50 { PowerLinux::TGT_O_NOCTTY, _O_NOCTTY },
51 #endif
52 #ifdef _O_SYNC
53 { PowerLinux::TGT_O_SYNC, _O_SYNC },
54 #endif
55 #ifdef _O_LARGEFILE
56 { PowerLinux::TGT_O_LARGEFILE, _O_LARGEFILE },
57 #endif
58 #else /* !_MSC_VER */
59 { PowerLinux::TGT_O_RDONLY, O_RDONLY },
60 { PowerLinux::TGT_O_WRONLY, O_WRONLY },
61 { PowerLinux::TGT_O_RDWR, O_RDWR },
62 { PowerLinux::TGT_O_APPEND, O_APPEND },
63 { PowerLinux::TGT_O_CREAT, O_CREAT },
64 { PowerLinux::TGT_O_TRUNC, O_TRUNC },
65 { PowerLinux::TGT_O_EXCL, O_EXCL },
66 { PowerLinux::TGT_O_NONBLOCK, O_NONBLOCK },
67 { PowerLinux::TGT_O_NOCTTY, O_NOCTTY },
68 #ifdef O_SYNC
69 { PowerLinux::TGT_O_SYNC, O_SYNC },
70 #endif
71 #ifdef O_LARGEFILE
72 { PowerLinux::TGT_O_LARGEFILE, O_LARGEFILE },
73 #endif
74 #endif /* _MSC_VER */
75 };
76
77 const int PowerLinux::NUM_OPEN_FLAGS =
78 (sizeof(PowerLinux::openFlagTable)/sizeof(PowerLinux::openFlagTable[0]));
79