linux.hh (11383:5ac090acd180) linux.hh (11386:94c09b607a84)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Gabe Black
38 */
39
40#ifndef __ARCH_X86_LINUX_LINUX_HH__
41#define __ARCH_X86_LINUX_LINUX_HH__
42
43#include "kern/linux/linux.hh"
44
45class X86Linux64 : public Linux
46{
47 public:
48
49 typedef struct {
50 uint64_t st_dev;
51 uint64_t st_ino;
52 uint64_t st_nlink;
53 uint32_t st_mode;
54 uint32_t st_uid;
55 uint32_t st_gid;
56 uint32_t __pad0;
57 uint64_t st_rdev;
58 int64_t st_size;
59 int64_t st_blksize;
60 int64_t st_blocks;
61 uint64_t st_atimeX;
62 uint64_t st_atime_nsec;
63 uint64_t st_mtimeX;
64 uint64_t st_mtime_nsec;
65 uint64_t st_ctimeX;
66 uint64_t st_ctime_nsec;
67 int64_t unused0[3];
68 } tgt_stat64;
69
70 static const int TGT_SIGHUP = 0x000001;
71 static const int TGT_SIGINT = 0x000002;
72 static const int TGT_SIGQUIT = 0x000003;
73 static const int TGT_SIGILL = 0x000004;
74 static const int TGT_SIGTRAP = 0x000005;
75 static const int TGT_SIGABRT = 0x000006;
76 static const int TGT_SIGIOT = 0x000006;
77 static const int TGT_SIGBUS = 0x000007;
78 static const int TGT_SIGFPE = 0x000008;
79 static const int TGT_SIGKILL = 0x000009;
80 static const int TGT_SIGUSR1 = 0x00000a;
81 static const int TGT_SIGSEGV = 0x00000b;
82 static const int TGT_SIGUSR2 = 0x00000c;
83 static const int TGT_SIGPIPE = 0x00000d;
84 static const int TGT_SIGALRM = 0x00000e;
85 static const int TGT_SIGTERM = 0x00000f;
86 static const int TGT_SIGSTKFLT = 0x000010;
87 static const int TGT_SIGCHLD = 0x000011;
88 static const int TGT_SIGCONT = 0x000012;
89 static const int TGT_SIGSTOP = 0x000013;
90 static const int TGT_SIGTSTP = 0x000014;
91 static const int TGT_SIGTTIN = 0x000015;
92 static const int TGT_SIGTTOU = 0x000016;
93 static const int TGT_SIGURG = 0x000017;
94 static const int TGT_SIGXCPU = 0x000018;
95 static const int TGT_SIGXFSZ = 0x000019;
96 static const int TGT_SIGVTALRM = 0x00001a;
97 static const int TGT_SIGPROF = 0x00001b;
98 static const int TGT_SIGWINCH = 0x00001c;
99 static const int TGT_SIGIO = 0x00001d;
100 static const int TGT_SIGPOLL = 0x00001d;
101 static const int TGT_SIGPWR = 0x00001e;
102 static const int TGT_SIGSYS = 0x00001f;
103 static const int TGT_SIGUNUSED = 0x00001f;
104
105 static SyscallFlagTransTable openFlagTable[];
106
107 static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY
108 static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY
109 static const int TGT_O_RDWR = 000000002; //!< O_RDWR
110 static const int TGT_O_CREAT = 000000100; //!< O_CREAT
111 static const int TGT_O_EXCL = 000000200; //!< O_EXCL
112 static const int TGT_O_NOCTTY = 000000400; //!< O_NOCTTY
113 static const int TGT_O_TRUNC = 000001000; //!< O_TRUNC
114 static const int TGT_O_APPEND = 000002000; //!< O_APPEND
115 static const int TGT_O_NONBLOCK = 000004000; //!< O_NONBLOCK
116 static const int TGT_O_DSYNC = 000010000;
117 static const int TGT_FASYNC = 000020000;
118 static const int TGT_O_DIRECT = 000040000; //!< O_DIRECTIO
119 static const int TGT_O_LARGEFILE = 000100000;
120 static const int TGT_O_DIRECTORY = 000200000;
121 static const int TGT_O_NOFOLLOW = 000400000;
122 static const int TGT_O_NOATIME = 001000000;
123 static const int TGT_O_CLOEXEC = 002000000;
124 static const int TGT_O_SYNC = 004010000; //!< O_SYNC
125 static const int TGT_O_PATH = 010000000;
126
127 static const int NUM_OPEN_FLAGS;
128
129 /// For mmap().
130 static SyscallFlagTransTable mmapFlagTable[];
131
132 static const unsigned TGT_MAP_SHARED = 0x00001;
133 static const unsigned TGT_MAP_PRIVATE = 0x00002;
134 static const unsigned TGT_MAP_32BIT = 0x00040;
135 static const unsigned TGT_MAP_ANON = 0x00020;
136 static const unsigned TGT_MAP_DENYWRITE = 0x00800;
137 static const unsigned TGT_MAP_EXECUTABLE = 0x01000;
138 static const unsigned TGT_MAP_FILE = 0x00000;
139 static const unsigned TGT_MAP_GROWSDOWN = 0x00100;
140 static const unsigned TGT_MAP_HUGETLB = 0x40000;
141 static const unsigned TGT_MAP_LOCKED = 0x02000;
142 static const unsigned TGT_MAP_NONBLOCK = 0x10000;
143 static const unsigned TGT_MAP_NORESERVE = 0x04000;
144 static const unsigned TGT_MAP_POPULATE = 0x08000;
145 static const unsigned TGT_MAP_STACK = 0x20000;
146 static const unsigned TGT_MAP_ANONYMOUS = 0x00020;
147 static const unsigned TGT_MAP_FIXED = 0x00010;
148
149 static const unsigned NUM_MMAP_FLAGS;
150
151 typedef struct {
152 uint64_t iov_base; // void *
153 uint64_t iov_len; // size_t
154 } tgt_iovec;
155
156 typedef struct {
157 int64_t uptime; /* Seconds since boot */
158 uint64_t loads[3]; /* 1, 5, and 15 minute load averages */
159 uint64_t totalram; /* Total usable main memory size */
160 uint64_t freeram; /* Available memory size */
161 uint64_t sharedram; /* Amount of shared memory */
162 uint64_t bufferram; /* Memory used by buffers */
163 uint64_t totalswap; /* Total swap space size */
164 uint64_t freeswap; /* swap space still available */
165 uint16_t procs; /* Number of current processes */
166 uint64_t totalhigh; /* Total high memory size */
167 uint64_t freehigh; /* Available high memory size */
168 uint64_t mem_unit; /* Memory unit size in bytes */
169 } tgt_sysinfo;
170
171};
172
173class X86Linux32 : public Linux
174{
175 public:
176
177 typedef struct {
178 uint64_t st_dev;
179 uint8_t __pad0[4];
180 uint32_t __st_ino;
181 uint32_t st_mode;
182 uint32_t st_nlink;
183 uint32_t st_uid;
184 uint32_t st_gid;
185 uint64_t st_rdev;
186 uint8_t __pad3[4];
187 int64_t st_size;
188 uint32_t st_blksize;
189 uint64_t st_blocks;
190 uint32_t st_atimeX;
191 uint32_t st_atime_nsec;
192 uint32_t st_mtimeX;
193 uint32_t st_mtime_nsec;
194 uint32_t st_ctimeX;
195 uint32_t st_ctime_nsec;
196 uint64_t st_ino;
197 } __attribute__((__packed__)) tgt_stat64;
198
199 static const int TGT_SIGHUP = 0x000001;
200 static const int TGT_SIGINT = 0x000002;
201 static const int TGT_SIGQUIT = 0x000003;
202 static const int TGT_SIGILL = 0x000004;
203 static const int TGT_SIGTRAP = 0x000005;
204 static const int TGT_SIGABRT = 0x000006;
205 static const int TGT_SIGIOT = 0x000006;
206 static const int TGT_SIGBUS = 0x000007;
207 static const int TGT_SIGFPE = 0x000008;
208 static const int TGT_SIGKILL = 0x000009;
209 static const int TGT_SIGUSR1 = 0x00000a;
210 static const int TGT_SIGSEGV = 0x00000b;
211 static const int TGT_SIGUSR2 = 0x00000c;
212 static const int TGT_SIGPIPE = 0x00000d;
213 static const int TGT_SIGALRM = 0x00000e;
214 static const int TGT_SIGTERM = 0x00000f;
215 static const int TGT_SIGSTKFLT = 0x000010;
216 static const int TGT_SIGCHLD = 0x000011;
217 static const int TGT_SIGCONT = 0x000012;
218 static const int TGT_SIGSTOP = 0x000013;
219 static const int TGT_SIGTSTP = 0x000014;
220 static const int TGT_SIGTTIN = 0x000015;
221 static const int TGT_SIGTTOU = 0x000016;
222 static const int TGT_SIGURG = 0x000017;
223 static const int TGT_SIGXCPU = 0x000018;
224 static const int TGT_SIGXFSZ = 0x000019;
225 static const int TGT_SIGVTALRM = 0x00001a;
226 static const int TGT_SIGPROF = 0x00001b;
227 static const int TGT_SIGWINCH = 0x00001c;
228 static const int TGT_SIGIO = 0x00001d;
229 static const int TGT_SIGPOLL = 0x00001d;
230 static const int TGT_SIGPWR = 0x00001e;
231 static const int TGT_SIGSYS = 0x00001f;
232 static const int TGT_SIGUNUSED = 0x00001f;
233
234 static SyscallFlagTransTable openFlagTable[];
235
236 static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY
237 static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY
238 static const int TGT_O_RDWR = 000000002; //!< O_RDWR
239 static const int TGT_O_CREAT = 000000100; //!< O_CREAT
240 static const int TGT_O_EXCL = 000000200; //!< O_EXCL
241 static const int TGT_O_NOCTTY = 000000400; //!< O_NOCTTY
242 static const int TGT_O_TRUNC = 000001000; //!< O_TRUNC
243 static const int TGT_O_APPEND = 000002000; //!< O_APPEND
244 static const int TGT_O_NONBLOCK = 000004000; //!< O_NONBLOCK
245 static const int TGT_O_DSYNC = 000010000; //!< O_DSYNC
246 static const int TGT_FASYNC = 000020000;
247 static const int TGT_O_DIRECT = 000040000; //!< O_DIRECTIO
248 static const int TGT_O_LARGEFILE = 000100000;
249 static const int TGT_O_DIRECTORY = 000200000;
250 static const int TGT_O_NOFOLLOW = 000400000;
251 static const int TGT_O_NOATIME = 001000000;
252 static const int TGT_O_CLOEXEC = 002000000;
253 static const int TGT_O_SYNC = 004010000; //!< O_SYNC
254 static const int TGT_O_PATH = 010000000;
255
256 static const int NUM_OPEN_FLAGS;
257
258 static SyscallFlagTransTable mmapFlagTable[];
259
260 static const unsigned TGT_MAP_SHARED = 0x00001;
261 static const unsigned TGT_MAP_PRIVATE = 0x00002;
262 static const unsigned TGT_MAP_32BIT = 0x00040;
263 static const unsigned TGT_MAP_ANON = 0x00020;
264 static const unsigned TGT_MAP_DENYWRITE = 0x00800;
265 static const unsigned TGT_MAP_EXECUTABLE = 0x01000;
266 static const unsigned TGT_MAP_FILE = 0x00000;
267 static const unsigned TGT_MAP_GROWSDOWN = 0x00100;
268 static const unsigned TGT_MAP_HUGETLB = 0x40000;
269 static const unsigned TGT_MAP_LOCKED = 0x02000;
270 static const unsigned TGT_MAP_NONBLOCK = 0x10000;
271 static const unsigned TGT_MAP_NORESERVE = 0x04000;
272 static const unsigned TGT_MAP_POPULATE = 0x08000;
273 static const unsigned TGT_MAP_STACK = 0x20000;
274 static const unsigned TGT_MAP_ANONYMOUS = 0x00020;
275 static const unsigned TGT_MAP_FIXED = 0x00010;
276
277 static const unsigned NUM_MMAP_FLAGS;
278
279 typedef struct {
280 int32_t uptime; /* Seconds since boot */
281 uint32_t loads[3]; /* 1, 5, and 15 minute load averages */
282 uint32_t totalram; /* Total usable main memory size */
283 uint32_t freeram; /* Available memory size */
284 uint32_t sharedram; /* Amount of shared memory */
285 uint32_t bufferram; /* Memory used by buffers */
286 uint32_t totalswap; /* Total swap space size */
287 uint32_t freeswap; /* swap space still available */
288 uint16_t procs; /* Number of current processes */
289 uint32_t totalhigh; /* Total high memory size */
290 uint32_t freehigh; /* Available high memory size */
291 uint32_t mem_unit; /* Memory unit size in bytes */
292 } tgt_sysinfo;
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Gabe Black
38 */
39
40#ifndef __ARCH_X86_LINUX_LINUX_HH__
41#define __ARCH_X86_LINUX_LINUX_HH__
42
43#include "kern/linux/linux.hh"
44
45class X86Linux64 : public Linux
46{
47 public:
48
49 typedef struct {
50 uint64_t st_dev;
51 uint64_t st_ino;
52 uint64_t st_nlink;
53 uint32_t st_mode;
54 uint32_t st_uid;
55 uint32_t st_gid;
56 uint32_t __pad0;
57 uint64_t st_rdev;
58 int64_t st_size;
59 int64_t st_blksize;
60 int64_t st_blocks;
61 uint64_t st_atimeX;
62 uint64_t st_atime_nsec;
63 uint64_t st_mtimeX;
64 uint64_t st_mtime_nsec;
65 uint64_t st_ctimeX;
66 uint64_t st_ctime_nsec;
67 int64_t unused0[3];
68 } tgt_stat64;
69
70 static const int TGT_SIGHUP = 0x000001;
71 static const int TGT_SIGINT = 0x000002;
72 static const int TGT_SIGQUIT = 0x000003;
73 static const int TGT_SIGILL = 0x000004;
74 static const int TGT_SIGTRAP = 0x000005;
75 static const int TGT_SIGABRT = 0x000006;
76 static const int TGT_SIGIOT = 0x000006;
77 static const int TGT_SIGBUS = 0x000007;
78 static const int TGT_SIGFPE = 0x000008;
79 static const int TGT_SIGKILL = 0x000009;
80 static const int TGT_SIGUSR1 = 0x00000a;
81 static const int TGT_SIGSEGV = 0x00000b;
82 static const int TGT_SIGUSR2 = 0x00000c;
83 static const int TGT_SIGPIPE = 0x00000d;
84 static const int TGT_SIGALRM = 0x00000e;
85 static const int TGT_SIGTERM = 0x00000f;
86 static const int TGT_SIGSTKFLT = 0x000010;
87 static const int TGT_SIGCHLD = 0x000011;
88 static const int TGT_SIGCONT = 0x000012;
89 static const int TGT_SIGSTOP = 0x000013;
90 static const int TGT_SIGTSTP = 0x000014;
91 static const int TGT_SIGTTIN = 0x000015;
92 static const int TGT_SIGTTOU = 0x000016;
93 static const int TGT_SIGURG = 0x000017;
94 static const int TGT_SIGXCPU = 0x000018;
95 static const int TGT_SIGXFSZ = 0x000019;
96 static const int TGT_SIGVTALRM = 0x00001a;
97 static const int TGT_SIGPROF = 0x00001b;
98 static const int TGT_SIGWINCH = 0x00001c;
99 static const int TGT_SIGIO = 0x00001d;
100 static const int TGT_SIGPOLL = 0x00001d;
101 static const int TGT_SIGPWR = 0x00001e;
102 static const int TGT_SIGSYS = 0x00001f;
103 static const int TGT_SIGUNUSED = 0x00001f;
104
105 static SyscallFlagTransTable openFlagTable[];
106
107 static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY
108 static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY
109 static const int TGT_O_RDWR = 000000002; //!< O_RDWR
110 static const int TGT_O_CREAT = 000000100; //!< O_CREAT
111 static const int TGT_O_EXCL = 000000200; //!< O_EXCL
112 static const int TGT_O_NOCTTY = 000000400; //!< O_NOCTTY
113 static const int TGT_O_TRUNC = 000001000; //!< O_TRUNC
114 static const int TGT_O_APPEND = 000002000; //!< O_APPEND
115 static const int TGT_O_NONBLOCK = 000004000; //!< O_NONBLOCK
116 static const int TGT_O_DSYNC = 000010000;
117 static const int TGT_FASYNC = 000020000;
118 static const int TGT_O_DIRECT = 000040000; //!< O_DIRECTIO
119 static const int TGT_O_LARGEFILE = 000100000;
120 static const int TGT_O_DIRECTORY = 000200000;
121 static const int TGT_O_NOFOLLOW = 000400000;
122 static const int TGT_O_NOATIME = 001000000;
123 static const int TGT_O_CLOEXEC = 002000000;
124 static const int TGT_O_SYNC = 004010000; //!< O_SYNC
125 static const int TGT_O_PATH = 010000000;
126
127 static const int NUM_OPEN_FLAGS;
128
129 /// For mmap().
130 static SyscallFlagTransTable mmapFlagTable[];
131
132 static const unsigned TGT_MAP_SHARED = 0x00001;
133 static const unsigned TGT_MAP_PRIVATE = 0x00002;
134 static const unsigned TGT_MAP_32BIT = 0x00040;
135 static const unsigned TGT_MAP_ANON = 0x00020;
136 static const unsigned TGT_MAP_DENYWRITE = 0x00800;
137 static const unsigned TGT_MAP_EXECUTABLE = 0x01000;
138 static const unsigned TGT_MAP_FILE = 0x00000;
139 static const unsigned TGT_MAP_GROWSDOWN = 0x00100;
140 static const unsigned TGT_MAP_HUGETLB = 0x40000;
141 static const unsigned TGT_MAP_LOCKED = 0x02000;
142 static const unsigned TGT_MAP_NONBLOCK = 0x10000;
143 static const unsigned TGT_MAP_NORESERVE = 0x04000;
144 static const unsigned TGT_MAP_POPULATE = 0x08000;
145 static const unsigned TGT_MAP_STACK = 0x20000;
146 static const unsigned TGT_MAP_ANONYMOUS = 0x00020;
147 static const unsigned TGT_MAP_FIXED = 0x00010;
148
149 static const unsigned NUM_MMAP_FLAGS;
150
151 typedef struct {
152 uint64_t iov_base; // void *
153 uint64_t iov_len; // size_t
154 } tgt_iovec;
155
156 typedef struct {
157 int64_t uptime; /* Seconds since boot */
158 uint64_t loads[3]; /* 1, 5, and 15 minute load averages */
159 uint64_t totalram; /* Total usable main memory size */
160 uint64_t freeram; /* Available memory size */
161 uint64_t sharedram; /* Amount of shared memory */
162 uint64_t bufferram; /* Memory used by buffers */
163 uint64_t totalswap; /* Total swap space size */
164 uint64_t freeswap; /* swap space still available */
165 uint16_t procs; /* Number of current processes */
166 uint64_t totalhigh; /* Total high memory size */
167 uint64_t freehigh; /* Available high memory size */
168 uint64_t mem_unit; /* Memory unit size in bytes */
169 } tgt_sysinfo;
170
171};
172
173class X86Linux32 : public Linux
174{
175 public:
176
177 typedef struct {
178 uint64_t st_dev;
179 uint8_t __pad0[4];
180 uint32_t __st_ino;
181 uint32_t st_mode;
182 uint32_t st_nlink;
183 uint32_t st_uid;
184 uint32_t st_gid;
185 uint64_t st_rdev;
186 uint8_t __pad3[4];
187 int64_t st_size;
188 uint32_t st_blksize;
189 uint64_t st_blocks;
190 uint32_t st_atimeX;
191 uint32_t st_atime_nsec;
192 uint32_t st_mtimeX;
193 uint32_t st_mtime_nsec;
194 uint32_t st_ctimeX;
195 uint32_t st_ctime_nsec;
196 uint64_t st_ino;
197 } __attribute__((__packed__)) tgt_stat64;
198
199 static const int TGT_SIGHUP = 0x000001;
200 static const int TGT_SIGINT = 0x000002;
201 static const int TGT_SIGQUIT = 0x000003;
202 static const int TGT_SIGILL = 0x000004;
203 static const int TGT_SIGTRAP = 0x000005;
204 static const int TGT_SIGABRT = 0x000006;
205 static const int TGT_SIGIOT = 0x000006;
206 static const int TGT_SIGBUS = 0x000007;
207 static const int TGT_SIGFPE = 0x000008;
208 static const int TGT_SIGKILL = 0x000009;
209 static const int TGT_SIGUSR1 = 0x00000a;
210 static const int TGT_SIGSEGV = 0x00000b;
211 static const int TGT_SIGUSR2 = 0x00000c;
212 static const int TGT_SIGPIPE = 0x00000d;
213 static const int TGT_SIGALRM = 0x00000e;
214 static const int TGT_SIGTERM = 0x00000f;
215 static const int TGT_SIGSTKFLT = 0x000010;
216 static const int TGT_SIGCHLD = 0x000011;
217 static const int TGT_SIGCONT = 0x000012;
218 static const int TGT_SIGSTOP = 0x000013;
219 static const int TGT_SIGTSTP = 0x000014;
220 static const int TGT_SIGTTIN = 0x000015;
221 static const int TGT_SIGTTOU = 0x000016;
222 static const int TGT_SIGURG = 0x000017;
223 static const int TGT_SIGXCPU = 0x000018;
224 static const int TGT_SIGXFSZ = 0x000019;
225 static const int TGT_SIGVTALRM = 0x00001a;
226 static const int TGT_SIGPROF = 0x00001b;
227 static const int TGT_SIGWINCH = 0x00001c;
228 static const int TGT_SIGIO = 0x00001d;
229 static const int TGT_SIGPOLL = 0x00001d;
230 static const int TGT_SIGPWR = 0x00001e;
231 static const int TGT_SIGSYS = 0x00001f;
232 static const int TGT_SIGUNUSED = 0x00001f;
233
234 static SyscallFlagTransTable openFlagTable[];
235
236 static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY
237 static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY
238 static const int TGT_O_RDWR = 000000002; //!< O_RDWR
239 static const int TGT_O_CREAT = 000000100; //!< O_CREAT
240 static const int TGT_O_EXCL = 000000200; //!< O_EXCL
241 static const int TGT_O_NOCTTY = 000000400; //!< O_NOCTTY
242 static const int TGT_O_TRUNC = 000001000; //!< O_TRUNC
243 static const int TGT_O_APPEND = 000002000; //!< O_APPEND
244 static const int TGT_O_NONBLOCK = 000004000; //!< O_NONBLOCK
245 static const int TGT_O_DSYNC = 000010000; //!< O_DSYNC
246 static const int TGT_FASYNC = 000020000;
247 static const int TGT_O_DIRECT = 000040000; //!< O_DIRECTIO
248 static const int TGT_O_LARGEFILE = 000100000;
249 static const int TGT_O_DIRECTORY = 000200000;
250 static const int TGT_O_NOFOLLOW = 000400000;
251 static const int TGT_O_NOATIME = 001000000;
252 static const int TGT_O_CLOEXEC = 002000000;
253 static const int TGT_O_SYNC = 004010000; //!< O_SYNC
254 static const int TGT_O_PATH = 010000000;
255
256 static const int NUM_OPEN_FLAGS;
257
258 static SyscallFlagTransTable mmapFlagTable[];
259
260 static const unsigned TGT_MAP_SHARED = 0x00001;
261 static const unsigned TGT_MAP_PRIVATE = 0x00002;
262 static const unsigned TGT_MAP_32BIT = 0x00040;
263 static const unsigned TGT_MAP_ANON = 0x00020;
264 static const unsigned TGT_MAP_DENYWRITE = 0x00800;
265 static const unsigned TGT_MAP_EXECUTABLE = 0x01000;
266 static const unsigned TGT_MAP_FILE = 0x00000;
267 static const unsigned TGT_MAP_GROWSDOWN = 0x00100;
268 static const unsigned TGT_MAP_HUGETLB = 0x40000;
269 static const unsigned TGT_MAP_LOCKED = 0x02000;
270 static const unsigned TGT_MAP_NONBLOCK = 0x10000;
271 static const unsigned TGT_MAP_NORESERVE = 0x04000;
272 static const unsigned TGT_MAP_POPULATE = 0x08000;
273 static const unsigned TGT_MAP_STACK = 0x20000;
274 static const unsigned TGT_MAP_ANONYMOUS = 0x00020;
275 static const unsigned TGT_MAP_FIXED = 0x00010;
276
277 static const unsigned NUM_MMAP_FLAGS;
278
279 typedef struct {
280 int32_t uptime; /* Seconds since boot */
281 uint32_t loads[3]; /* 1, 5, and 15 minute load averages */
282 uint32_t totalram; /* Total usable main memory size */
283 uint32_t freeram; /* Available memory size */
284 uint32_t sharedram; /* Amount of shared memory */
285 uint32_t bufferram; /* Memory used by buffers */
286 uint32_t totalswap; /* Total swap space size */
287 uint32_t freeswap; /* swap space still available */
288 uint16_t procs; /* Number of current processes */
289 uint32_t totalhigh; /* Total high memory size */
290 uint32_t freehigh; /* Available high memory size */
291 uint32_t mem_unit; /* Memory unit size in bytes */
292 } tgt_sysinfo;
293
294 static bool mmapGrowsDown() { return true; }
295};
296
297#endif
293};
294
295#endif