linux.cc (11383:5ac090acd180) linux.cc (11413:3d47d83a48eb)
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

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

29 * Authors: Timothy M. Jones
30 */
31
32#include "arch/power/linux/linux.hh"
33
34#include <fcntl.h>
35#include <sys/mman.h>
36
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

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

29 * Authors: Timothy M. Jones
30 */
31
32#include "arch/power/linux/linux.hh"
33
34#include <fcntl.h>
35#include <sys/mman.h>
36
37// open(2) flags translation table
38SyscallFlagTransTable PowerLinux::openFlagTable[] = {
39#ifdef _MSC_VER
40 { PowerLinux::TGT_O_RDONLY, _O_RDONLY },
41 { PowerLinux::TGT_O_WRONLY, _O_WRONLY },
42 { PowerLinux::TGT_O_RDWR, _O_RDWR },
43 { PowerLinux::TGT_O_CREAT, _O_CREAT },
44 { PowerLinux::TGT_O_EXCL, _O_EXCL },
45#ifdef _O_NOCTTY
46 { PowerLinux::TGT_O_NOCTTY, _O_NOCTTY },
47#endif
48 { PowerLinux::TGT_O_TRUNC, _O_TRUNC },
49 { PowerLinux::TGT_O_APPEND, _O_APPEND },
50#ifdef _O_NONBLOCK
51 { PowerLinux::TGT_O_NONBLOCK, _O_NONBLOCK },
52#endif
53#ifdef _O_DSYNC
54 { PowerLinux::TGT_O_DSYNC, _O_DSYNC },
55#endif
56 { PowerLinux::TGT_FASYNC, _O_ASYNC },
57 { PowerLinux::TGT_O_DIRECT, _O_DIRECT },
58#ifdef _O_LARGEFILE
59 { PowerLinux::TGT_O_LARGEFILE, _O_LARGEFILE },
60#endif
61 { PowerLinux::TGT_O_DIRECTORY, _O_DIRECTORY },
62 { PowerLinux::TGT_O_NOFOLLOW, _O_NOFOLLOW },
63 { PowerLinux::TGT_O_NOATIME, _O_NOATIME },
64#ifdef _O_CLOEXEC
65 { PowerLinux::TGT_O_CLOEXEC, _O_CLOEXEC },
66#endif
67#ifdef _O_SYNC
68 { PowerLinux::TGT_O_SYNC, _O_SYNC },
69#endif
70#ifdef _O_PATH
71 { PowerLinux::TGT_O_PATH, _O_PATH},
72#endif
73#else /* !_MSC_VER */
74 { PowerLinux::TGT_O_RDONLY, O_RDONLY },
75 { PowerLinux::TGT_O_WRONLY, O_WRONLY },
76 { PowerLinux::TGT_O_RDWR, O_RDWR },
77 { PowerLinux::TGT_O_CREAT, O_CREAT },
78 { PowerLinux::TGT_O_EXCL, O_EXCL },
79 { PowerLinux::TGT_O_NOCTTY, O_NOCTTY },
80 { PowerLinux::TGT_O_TRUNC, O_TRUNC },
81 { PowerLinux::TGT_O_APPEND, O_APPEND },
82 { PowerLinux::TGT_O_NONBLOCK, O_NONBLOCK },
83#ifdef O_DSYNC
84 { PowerLinux::TGT_O_DSYNC, O_DSYNC },
85#endif
86 { PowerLinux::TGT_FASYNC, O_ASYNC },
87 { PowerLinux::TGT_O_DIRECT, O_DIRECT },
88#ifdef O_LARGEFILE
89 { PowerLinux::TGT_O_LARGEFILE, O_LARGEFILE },
90#endif
91 { PowerLinux::TGT_O_DIRECTORY, O_DIRECTORY },
92 { PowerLinux::TGT_O_NOFOLLOW, O_NOFOLLOW },
93 { PowerLinux::TGT_O_NOATIME, O_NOATIME },
94#ifdef O_CLOEXEC
95 { PowerLinux::TGT_O_CLOEXEC, O_CLOEXEC },
96#endif
97#ifdef O_SYNC
98 { PowerLinux::TGT_O_SYNC, O_SYNC },
99#endif
100#ifdef O_PATH
101 { PowerLinux::TGT_O_PATH, O_PATH},
102#endif
103#endif /* _MSC_VER */
104};
105
106const int PowerLinux::NUM_OPEN_FLAGS =
107 (sizeof(PowerLinux::openFlagTable)/sizeof(PowerLinux::openFlagTable[0]));
108
109// mmap(2) flags translation table
110SyscallFlagTransTable PowerLinux::mmapFlagTable[] = {
111 { PowerLinux::TGT_MAP_SHARED, MAP_SHARED },
112 { PowerLinux::TGT_MAP_PRIVATE, MAP_PRIVATE },
113 { PowerLinux::TGT_MAP_ANON, MAP_ANON },
114 { PowerLinux::TGT_MAP_DENYWRITE, MAP_DENYWRITE },
115 { PowerLinux::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE },
116 { PowerLinux::TGT_MAP_FILE, MAP_FILE },
117 { PowerLinux::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN },
118 { PowerLinux::TGT_MAP_HUGETLB, MAP_HUGETLB },
119 { PowerLinux::TGT_MAP_LOCKED, MAP_LOCKED },
120 { PowerLinux::TGT_MAP_NONBLOCK, MAP_NONBLOCK },
121 { PowerLinux::TGT_MAP_NORESERVE, MAP_NORESERVE },
122 { PowerLinux::TGT_MAP_POPULATE, MAP_POPULATE },
123#ifdef MAP_STACK
124 { PowerLinux::TGT_MAP_STACK, MAP_STACK },
125#endif
126 { PowerLinux::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS },
127 { PowerLinux::TGT_MAP_FIXED, MAP_FIXED },
128};
129
130const unsigned PowerLinux::NUM_MMAP_FLAGS =
131 sizeof(PowerLinux::mmapFlagTable) /
132 sizeof(PowerLinux::mmapFlagTable[0]);
133
37#define TARGET PowerLinux
38#include "kern/linux/flag_tables.hh"