Handle gcc __builtin_strcmp using 128/256 bit vectors with sse4.1, avx/avx2
[valgrind.git] / include / vki / vki-s390x-linux.h
blob9d1cf1dde73a1bc4d905242c9bb7b05a16b4dd11
2 /*--------------------------------------------------------------------*/
3 /*--- s390x/Linux-specific kernel interface. vki-s390x-linux.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright IBM Corp. 2010-2017
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, see <http://www.gnu.org/licenses/>.
25 The GNU General Public License is contained in the file COPYING.
28 /* Contributed by Florian Krohm and Volker Sameske */
30 #ifndef __VKI_S390X_LINUX_H
31 #define __VKI_S390X_LINUX_H
33 #define __force
35 //----------------------------------------------------------------------
36 // From linux-2.6.16.60/include/asm-s390/types.h
37 //----------------------------------------------------------------------
39 typedef __signed__ char __vki_s8;
40 typedef unsigned char __vki_u8;
42 typedef __signed__ short __vki_s16;
43 typedef unsigned short __vki_u16;
45 typedef __signed__ int __vki_s32;
46 typedef unsigned int __vki_u32;
48 typedef __signed__ long __vki_s64;
49 typedef unsigned long __vki_u64;
51 typedef unsigned short vki_u16;
53 typedef unsigned int vki_u32;
55 //----------------------------------------------------------------------
56 // From linux-2.6.16.60/include/asm-s390/page.h
57 //----------------------------------------------------------------------
59 /* PAGE_SHIFT determines the page size */
60 #define VKI_PAGE_SHIFT 12
61 #define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
63 //----------------------------------------------------------------------
64 // From linux-2.6.16.60/include/asm-s390/siginfo.h
65 //----------------------------------------------------------------------
67 /* We need that to ensure that sizeof(siginfo) == 128. */
68 #ifdef __s390x__
69 #define __VKI_ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
70 #endif
72 //----------------------------------------------------------------------
73 // From linux-2.6.16.60/include/asm-s390/sigcontext.h
74 //----------------------------------------------------------------------
76 #define __VKI_NUM_GPRS 16
77 #define __VKI_NUM_FPRS 16
78 #define __VKI_NUM_ACRS 16
80 #ifndef VGA_s390x
82 /* Has to be at least _NSIG_WORDS from asm/signal.h */
83 #define _VKI_SIGCONTEXT_NSIG 64
84 #define _VKI_SIGCONTEXT_NSIG_BPW 32
85 /* Size of stack frame allocated when calling signal handler. */
86 #define __VKI_SIGNAL_FRAMESIZE 96
88 #else /* VGA_s390x */
90 /* Has to be at least _NSIG_WORDS from asm/signal.h */
91 #define _VKI_SIGCONTEXT_NSIG 64
92 #define _VKI_SIGCONTEXT_NSIG_BPW 64
93 /* Size of stack frame allocated when calling signal handler. */
94 #define __VKI_SIGNAL_FRAMESIZE 160
96 #endif /* VGA_s390x */
99 #define _VKI_SIGCONTEXT_NSIG_WORDS (_VKI_SIGCONTEXT_NSIG / _VKI_SIGCONTEXT_NSIG_BPW)
100 #define _VKI_SIGMASK_COPY_SIZE (sizeof(unsigned long)*_VKI_SIGCONTEXT_NSIG_WORDS)
102 typedef struct
104 unsigned long mask;
105 unsigned long addr;
106 } __attribute__ ((aligned(8))) _vki_psw_t;
108 typedef struct
110 _vki_psw_t psw;
111 unsigned long gprs[__VKI_NUM_GPRS];
112 unsigned int acrs[__VKI_NUM_ACRS];
113 } _vki_s390_regs_common;
115 typedef struct
117 unsigned int fpc;
118 double fprs[__VKI_NUM_FPRS];
119 } _vki_s390_fp_regs;
121 typedef struct
123 _vki_s390_regs_common regs;
124 _vki_s390_fp_regs fpregs;
125 } _vki_sigregs;
128 struct vki_sigcontext
130 unsigned long oldmask[_VKI_SIGCONTEXT_NSIG_WORDS];
131 _vki_sigregs __user *sregs;
135 //----------------------------------------------------------------------
136 // From linux-2.6.16.60/include/asm-s390/signal.h
137 //----------------------------------------------------------------------
139 #define _VKI_NSIG _VKI_SIGCONTEXT_NSIG
140 #define _VKI_NSIG_BPW _VKI_SIGCONTEXT_NSIG_BPW
141 #define _VKI_NSIG_WORDS _VKI_SIGCONTEXT_NSIG_WORDS
143 typedef unsigned long vki_old_sigset_t;
145 typedef struct {
146 unsigned long sig[_VKI_NSIG_WORDS];
147 } vki_sigset_t;
149 #define VKI_SIGHUP 1
150 #define VKI_SIGINT 2
151 #define VKI_SIGQUIT 3
152 #define VKI_SIGILL 4
153 #define VKI_SIGTRAP 5
154 #define VKI_SIGABRT 6
155 #define VKI_SIGIOT 6
156 #define VKI_SIGBUS 7
157 #define VKI_SIGFPE 8
158 #define VKI_SIGKILL 9
159 #define VKI_SIGUSR1 10
160 #define VKI_SIGSEGV 11
161 #define VKI_SIGUSR2 12
162 #define VKI_SIGPIPE 13
163 #define VKI_SIGALRM 14
164 #define VKI_SIGTERM 15
165 #define VKI_SIGSTKFLT 16
166 #define VKI_SIGCHLD 17
167 #define VKI_SIGCONT 18
168 #define VKI_SIGSTOP 19
169 #define VKI_SIGTSTP 20
170 #define VKI_SIGTTIN 21
171 #define VKI_SIGTTOU 22
172 #define VKI_SIGURG 23
173 #define VKI_SIGXCPU 24
174 #define VKI_SIGXFSZ 25
175 #define VKI_SIGVTALRM 26
176 #define VKI_SIGPROF 27
177 #define VKI_SIGWINCH 28
178 #define VKI_SIGIO 29
179 #define VKI_SIGPOLL VKI_SIGIO
181 #define VKI_SIGLOST 29
183 #define VKI_SIGPWR 30
184 #define VKI_SIGSYS 31
185 #define VKI_SIGUNUSED 31
187 /* These should not be considered constants from userland. */
188 #define VKI_SIGRTMIN 32
189 #define VKI_SIGRTMAX _VKI_NSIG
192 * SA_FLAGS values:
194 * SA_ONSTACK indicates that a registered stack_t will be used.
195 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
196 * SA_RESTART flag to get restarting signals (which were the default long ago)
197 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
198 * SA_RESETHAND clears the handler when the signal is delivered.
199 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
200 * SA_NODEFER prevents the current signal from being masked in the handler.
202 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
203 * Unix names RESETHAND and NODEFER respectively.
205 #define VKI_SA_NOCLDSTOP 0x00000001
206 #define VKI_SA_NOCLDWAIT 0x00000002
207 #define VKI_SA_SIGINFO 0x00000004
208 #define VKI_SA_ONSTACK 0x08000000
209 #define VKI_SA_RESTART 0x10000000
210 #define VKI_SA_NODEFER 0x40000000
211 #define VKI_SA_RESETHAND 0x80000000
213 #define VKI_SA_NOMASK VKI_SA_NODEFER
214 #define VKI_SA_ONESHOT VKI_SA_RESETHAND
215 #define VKI_SA_INTERRUPT 0x20000000 /* dummy -- ignored */
217 #define VKI_SA_RESTORER 0x04000000
220 * sigaltstack controls
222 #define VKI_SS_ONSTACK 1
223 #define VKI_SS_DISABLE 2
225 #define VKI_MINSIGSTKSZ 2048
226 #define VKI_SIGSTKSZ 8192
229 /* Next lines asm-generic/signal.h */
230 #define VKI_SIG_BLOCK 0 /* for blocking signals */
231 #define VKI_SIG_UNBLOCK 1 /* for unblocking signals */
232 #define VKI_SIG_SETMASK 2 /* for setting the signal mask */
234 typedef void __vki_signalfn_t(int);
235 typedef __vki_signalfn_t __user *__vki_sighandler_t;
237 /* default signal handling */
238 #define VKI_SIG_DFL ((__force __vki_sighandler_t)0)
239 /* ignore signal */
240 #define VKI_SIG_IGN ((__force __vki_sighandler_t)1)
241 /* error return from signal */
242 #define VKI_SIG_ERR ((__force __vki_sighandler_t)-1)
243 /* Back to asm-s390/signal.h */
245 struct vki_old_sigaction {
246 // [[Nb: a 'k' prefix is added to "sa_handler" because
247 // bits/sigaction.h (which gets dragged in somehow via signal.h)
248 // #defines it as something else. Since that is done for glibc's
249 // purposes, which we don't care about here, we use our own name.]]
250 __vki_sighandler_t ksa_handler;
251 vki_old_sigset_t sa_mask;
252 unsigned long sa_flags;
253 void (*sa_restorer)(void);
256 struct vki_sigaction {
257 // [[See comment about extra 'k' above]]
258 __vki_sighandler_t ksa_handler;
259 // Yes, the reserved field is really glibc specific. The kernel
260 // doesn't have it and uses an unsigned long for sa_flags.
261 // The glibc and the kernel agreed this is fine and the
262 // __glibc_reserved0 field can be undefined.
263 // See https://sourceware.org/ml/libc-alpha/2014-09/msg00161.html
264 int __glibc_reserved0;
265 int sa_flags;
266 void (*sa_restorer)(void);
267 vki_sigset_t sa_mask; /* mask last for extensibility */
270 struct vki_k_sigaction {
271 struct vki_sigaction sa;
275 /* On Linux we use the same type for passing sigactions to
276 and from the kernel. Hence: */
277 typedef struct vki_sigaction vki_sigaction_toK_t;
278 typedef struct vki_sigaction vki_sigaction_fromK_t;
281 typedef struct vki_sigaltstack {
282 void __user *ss_sp;
283 int ss_flags;
284 vki_size_t ss_size;
285 } vki_stack_t;
288 //----------------------------------------------------------------------
289 // From linux-2.6.16.60/include/asm-s390/mman.h
290 //----------------------------------------------------------------------
292 #define VKI_PROT_NONE 0x0 /* No page permissions */
293 #define VKI_PROT_READ 0x1 /* page can be read */
294 #define VKI_PROT_WRITE 0x2 /* page can be written */
295 #define VKI_PROT_EXEC 0x4 /* page can be executed */
296 #define VKI_PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend
297 change to start of
298 growsdown vma */
299 #define VKI_PROT_GROWSUP 0x02000000 /* mprotect flag:
300 extend change to end
301 of growsup vma */
303 #define VKI_MAP_SHARED 0x0001 /* Share changes */
304 #define VKI_MAP_PRIVATE 0x0002 /* */
305 #define VKI_MAP_FIXED 0x0010 /* */
306 #define VKI_MAP_ANONYMOUS 0x0020 /* */
309 //----------------------------------------------------------------------
310 // From linux-2.6.16.60/include/asm-s390/fcntl.h
311 //----------------------------------------------------------------------
313 #define VKI_O_RDONLY 00000000
314 #define VKI_O_WRONLY 00000001
315 #define VKI_O_RDWR 00000002
316 #define VKI_O_ACCMODE 00000003
317 #define VKI_O_CREAT 00000100 /* not fcntl */
318 #define VKI_O_EXCL 00000200 /* not fcntl */
319 #define VKI_O_NOCTTY 00000400 /* not fcntl */
320 #define VKI_O_TRUNC 00001000 /* not fcntl */
321 #define VKI_O_APPEND 00002000
322 #define VKI_O_NONBLOCK 00004000
323 #define VKI_O_DIRECT 00040000
325 #define VKI_AT_FDCWD -100
327 #define VKI_F_DUPFD 0 /* dup */
328 #define VKI_F_GETFD 1 /* get close_on_exec */
329 #define VKI_F_SETFD 2 /* set/clear close_on_exec */
330 #define VKI_F_GETFL 3 /* get file->f_flags */
331 #define VKI_F_SETFL 4 /* set file->f_flags */
332 #define VKI_F_GETLK 5
333 #define VKI_F_SETLK 6
334 #define VKI_F_SETLKW 7
335 #define VKI_F_SETOWN 8 /* for sockets. */
336 #define VKI_F_GETOWN 9 /* for sockets. */
337 #define VKI_F_SETSIG 10 /* for sockets. */
338 #define VKI_F_GETSIG 11 /* for sockets. */
340 #define VKI_F_SETOWN_EX 15
341 #define VKI_F_GETOWN_EX 16
343 #define VKI_F_OFD_GETLK 36
344 #define VKI_F_OFD_SETLK 37
345 #define VKI_F_OFD_SETLKW 38
347 #define VKI_F_OWNER_TID 0
348 #define VKI_F_OWNER_PID 1
349 #define VKI_F_OWNER_PGRP 2
351 struct vki_f_owner_ex {
352 int type;
353 __vki_kernel_pid_t pid;
356 #define VKI_FD_CLOEXEC 1 /* actually anything with low bit set goes */
358 #define VKI_F_LINUX_SPECIFIC_BASE 1024
361 //----------------------------------------------------------------------
362 // From linux-2.6.16.60/include/asm-s390x/resource.h
363 //----------------------------------------------------------------------
365 // which just does #include <asm-generic/resource.h>
367 #define VKI_RLIMIT_DATA 2 /* max data size */
368 #define VKI_RLIMIT_STACK 3 /* max stack size */
369 #define VKI_RLIMIT_CORE 4 /* max core file size */
370 #define VKI_RLIMIT_NOFILE 7 /* max number of open files */
373 //----------------------------------------------------------------------
374 // From linux-2.6.16.60/include/asm-s390/socket.h
375 //----------------------------------------------------------------------
377 #define VKI_SOL_SOCKET 1
379 #define VKI_SO_TYPE 3
381 #define VKI_SO_ATTACH_FILTER 26
383 //----------------------------------------------------------------------
384 // From linux-2.6.16.60/include/asm-s390/sockios.h
385 //----------------------------------------------------------------------
387 #define VKI_SIOCSPGRP 0x8902
388 #define VKI_SIOCGPGRP 0x8904
389 #define VKI_SIOCATMARK 0x8905
390 #define VKI_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
391 /* since 2.6.22 */
392 #define VKI_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
395 //----------------------------------------------------------------------
396 // From linux-2.6.16.60/include/asm-s390/stat.h
397 //----------------------------------------------------------------------
399 #ifndef VGA_s390x
400 struct vki_stat {
401 unsigned short st_dev;
402 unsigned short __pad1;
403 unsigned long st_ino;
404 unsigned short st_mode;
405 unsigned short st_nlink;
406 unsigned short st_uid;
407 unsigned short st_gid;
408 unsigned short st_rdev;
409 unsigned short __pad2;
410 unsigned long st_size;
411 unsigned long st_blksize;
412 unsigned long st_blocks;
413 unsigned long st_atime;
414 unsigned long st_atime_nsec;
415 unsigned long st_mtime;
416 unsigned long st_mtime_nsec;
417 unsigned long st_ctime;
418 unsigned long st_ctime_nsec;
419 unsigned long __unused4;
420 unsigned long __unused5;
423 /* This matches struct stat64 in glibc2.1, hence the absolutely
424 * insane amounts of padding around dev_t's.
426 struct vki_stat64 {
427 unsigned long long st_dev;
428 unsigned int __pad1;
429 unsigned long __st_ino;
430 unsigned int st_mode;
431 unsigned int st_nlink;
432 unsigned long st_uid;
433 unsigned long st_gid;
434 unsigned long long st_rdev;
435 unsigned int __pad3;
436 long long st_size;
437 unsigned long st_blksize;
438 unsigned char __pad4[4];
439 unsigned long __pad5; /* future possible st_blocks high bits */
440 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
441 unsigned long st_atime;
442 unsigned long st_atime_nsec;
443 unsigned long st_mtime;
444 unsigned long st_mtime_nsec;
445 unsigned long st_ctime;
446 unsigned long st_ctime_nsec; /* will be high 32 bits of ctime someday */
447 unsigned long long st_ino;
450 #else
452 struct vki_stat {
453 unsigned long st_dev;
454 unsigned long st_ino;
455 unsigned long st_nlink;
456 unsigned int st_mode;
457 unsigned int st_uid;
458 unsigned int st_gid;
459 unsigned int __pad1;
460 unsigned long st_rdev;
461 unsigned long st_size;
462 unsigned long st_atime;
463 unsigned long st_atime_nsec;
464 unsigned long st_mtime;
465 unsigned long st_mtime_nsec;
466 unsigned long st_ctime;
467 unsigned long st_ctime_nsec;
468 unsigned long st_blksize;
469 long st_blocks;
470 unsigned long __unused0[3];
473 #endif /* VGA_s390x */
476 //----------------------------------------------------------------------
477 // From linux-2.6.16.60/include/asm-s390/statfs.h
478 //----------------------------------------------------------------------
480 struct vki_statfs {
481 int f_type;
482 int f_bsize;
483 long f_blocks;
484 long f_bfree;
485 long f_bavail;
486 long f_files;
487 long f_ffree;
488 __vki_kernel_fsid_t f_fsid;
489 int f_namelen;
490 int f_frsize;
491 int f_spare[5];
495 //----------------------------------------------------------------------
496 // From linux-2.6.16.60/include/asm-s390/termios.h
497 //----------------------------------------------------------------------
499 struct vki_winsize {
500 unsigned short ws_row;
501 unsigned short ws_col;
502 unsigned short ws_xpixel;
503 unsigned short ws_ypixel;
506 #define VKI_NCC 8
507 struct vki_termio {
508 unsigned short c_iflag; /* input mode flags */
509 unsigned short c_oflag; /* output mode flags */
510 unsigned short c_cflag; /* control mode flags */
511 unsigned short c_lflag; /* local mode flags */
512 unsigned char c_line; /* line discipline */
513 unsigned char c_cc[VKI_NCC]; /* control characters */
517 //----------------------------------------------------------------------
518 // From linux-2.6.16.60/include/asm-s390/termbits.h
519 //----------------------------------------------------------------------
521 typedef unsigned char vki_cc_t;
522 typedef unsigned int vki_tcflag_t;
524 #define VKI_NCCS 19
525 struct vki_termios {
526 vki_tcflag_t c_iflag; /* input mode flags */
527 vki_tcflag_t c_oflag; /* output mode flags */
528 vki_tcflag_t c_cflag; /* control mode flags */
529 vki_tcflag_t c_lflag; /* local mode flags */
530 vki_cc_t c_line; /* line discipline */
531 vki_cc_t c_cc[VKI_NCCS]; /* control characters */
535 //----------------------------------------------------------------------
536 // From linux-2.6.16.60/include/asm-s390/ioctl.h
537 //----------------------------------------------------------------------
539 #define _VKI_IOC_NRBITS 8
540 #define _VKI_IOC_TYPEBITS 8
541 #define _VKI_IOC_SIZEBITS 14
542 #define _VKI_IOC_DIRBITS 2
544 #define _VKI_IOC_NRMASK ((1 << _VKI_IOC_NRBITS)-1)
545 #define _VKI_IOC_TYPEMASK ((1 << _VKI_IOC_TYPEBITS)-1)
546 #define _VKI_IOC_SIZEMASK ((1 << _VKI_IOC_SIZEBITS)-1)
547 #define _VKI_IOC_DIRMASK ((1 << _VKI_IOC_DIRBITS)-1)
549 #define _VKI_IOC_NRSHIFT 0
550 #define _VKI_IOC_TYPESHIFT (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
551 #define _VKI_IOC_SIZESHIFT (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
552 #define _VKI_IOC_DIRSHIFT (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
554 #define _VKI_IOC_NONE 0U
555 #define _VKI_IOC_WRITE 1U
556 #define _VKI_IOC_READ 2U
558 #define _VKI_IOC(dir,type,nr,size) \
559 (((dir) << _VKI_IOC_DIRSHIFT) | \
560 ((type) << _VKI_IOC_TYPESHIFT) | \
561 ((nr) << _VKI_IOC_NRSHIFT) | \
562 ((size) << _VKI_IOC_SIZESHIFT))
564 /* used to create numbers */
565 #define _VKI_IO(type,nr) _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
566 #define _VKI_IOR(type,nr,size) _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
567 #define _VKI_IOW(type,nr,size) _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
568 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
570 /* used to decode ioctl numbers.. */
571 #define _VKI_IOC_DIR(nr) (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
572 #define _VKI_IOC_TYPE(nr) (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
573 #define _VKI_IOC_NR(nr) (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
574 #define _VKI_IOC_SIZE(nr) (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
576 //----------------------------------------------------------------------
577 // From linux-2.6.16.60/include/asm-s390/ioctls.h
578 //----------------------------------------------------------------------
580 /* 0x54 is just a magic number to make these relatively unique ('T') */
582 #define VKI_TCGETS 0x5401
583 #define VKI_TCSETS 0x5402
584 #define VKI_TCSETSW 0x5403
585 #define VKI_TCSETSF 0x5404
586 #define VKI_TCGETA 0x5405
587 #define VKI_TCSETA 0x5406
588 #define VKI_TCSETAW 0x5407
589 #define VKI_TCSETAF 0x5408
590 #define VKI_TCSBRK 0x5409
591 #define VKI_TCXONC 0x540A
592 #define VKI_TCFLSH 0x540B
594 #define VKI_TIOCSCTTY 0x540E
595 #define VKI_TIOCGPGRP 0x540F
596 #define VKI_TIOCSPGRP 0x5410
597 #define VKI_TIOCOUTQ 0x5411
599 #define VKI_TIOCGWINSZ 0x5413
600 #define VKI_TIOCSWINSZ 0x5414
601 #define VKI_TIOCMGET 0x5415
602 #define VKI_TIOCMBIS 0x5416
603 #define VKI_TIOCMBIC 0x5417
604 #define VKI_TIOCMSET 0x5418
606 #define VKI_FIONREAD 0x541B
607 #define VKI_TIOCLINUX 0x541C
609 #define VKI_FIONBIO 0x5421
610 #define VKI_TIOCNOTTY 0x5422
612 #define VKI_TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
614 #define VKI_TIOCGPTN _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
615 #define VKI_TIOCSPTLCK _VKI_IOW('T',0x31, int) /* Lock/unlock Pty */
617 #define VKI_FIONCLEX 0x5450
618 #define VKI_FIOCLEX 0x5451
619 #define VKI_FIOASYNC 0x5452
621 #define VKI_TIOCSERGETLSR 0x5459 /* Get line status register */
623 #define VKI_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
625 //----------------------------------------------------------------------
626 // From linux-2.6.39-rc2/arch/s390/include/asm/ioctls.h
627 //----------------------------------------------------------------------
629 #define VKI_FIOQSIZE 0x545E
631 //----------------------------------------------------------------------
632 // From linux-2.6.16.60/include/asm-s390/poll.h
633 //----------------------------------------------------------------------
635 struct vki_pollfd {
636 int fd;
637 short events;
638 short revents;
641 #define VKI_POLLIN 0x0001
643 //----------------------------------------------------------------------
644 // From linux-2.6.16.60/include/asm-s390/ptrace.h
645 //----------------------------------------------------------------------
646 #define VKI_NUM_GPRS 16
647 #define VKI_NUM_FPRS 16
648 #define VKI_NUM_CRS 16
649 #define VKI_NUM_ACRS 16
651 typedef union
653 float f;
654 double d;
655 __vki_u64 ui;
656 struct
658 __vki_u32 hi;
659 __vki_u32 lo;
660 } fp;
661 } vki_freg_t;
663 typedef struct
665 __vki_u32 fpc;
666 vki_freg_t fprs[VKI_NUM_FPRS];
667 } vki_s390_fp_regs;
669 typedef struct
671 unsigned long mask;
672 unsigned long addr;
673 } __attribute__ ((aligned(8))) vki_psw_t;
675 typedef struct
677 vki_psw_t psw;
678 unsigned long gprs[VKI_NUM_GPRS];
679 unsigned int acrs[VKI_NUM_ACRS];
680 unsigned long orig_gpr2;
681 } vki_s390_regs;
684 * Now for the program event recording (trace) definitions.
686 typedef struct
688 unsigned long cr[3];
689 } vki_per_cr_words;
691 typedef struct
693 #ifdef VGA_s390x
694 unsigned : 32;
695 #endif /* VGA_s390x */
696 unsigned em_branching : 1;
697 unsigned em_instruction_fetch : 1;
699 * Switching on storage alteration automatically fixes
700 * the storage alteration event bit in the users std.
702 unsigned em_storage_alteration : 1;
703 unsigned em_gpr_alt_unused : 1;
704 unsigned em_store_real_address : 1;
705 unsigned : 3;
706 unsigned branch_addr_ctl : 1;
707 unsigned : 1;
708 unsigned storage_alt_space_ctl : 1;
709 unsigned : 21;
710 unsigned long starting_addr;
711 unsigned long ending_addr;
712 } vki_per_cr_bits;
714 typedef struct
716 unsigned short perc_atmid;
717 unsigned long address;
718 unsigned char access_id;
719 } vki_per_lowcore_words;
721 typedef struct
723 unsigned perc_branching : 1;
724 unsigned perc_instruction_fetch : 1;
725 unsigned perc_storage_alteration : 1;
726 unsigned perc_gpr_alt_unused : 1;
727 unsigned perc_store_real_address : 1;
728 unsigned : 3;
729 unsigned atmid_psw_bit_31 : 1;
730 unsigned atmid_validity_bit : 1;
731 unsigned atmid_psw_bit_32 : 1;
732 unsigned atmid_psw_bit_5 : 1;
733 unsigned atmid_psw_bit_16 : 1;
734 unsigned atmid_psw_bit_17 : 1;
735 unsigned si : 2;
736 unsigned long address;
737 unsigned : 4;
738 unsigned access_id : 4;
739 } vki_per_lowcore_bits;
741 typedef struct
743 union {
744 vki_per_cr_words words;
745 vki_per_cr_bits bits;
746 } control_regs;
748 * Use these flags instead of setting em_instruction_fetch
749 * directly they are used so that single stepping can be
750 * switched on & off while not affecting other tracing
752 unsigned single_step : 1;
753 unsigned instruction_fetch : 1;
754 unsigned : 30;
756 * These addresses are copied into cr10 & cr11 if single
757 * stepping is switched off
759 unsigned long starting_addr;
760 unsigned long ending_addr;
761 union {
762 vki_per_lowcore_words words;
763 vki_per_lowcore_bits bits;
764 } lowcore;
765 } vki_per_struct;
768 * The user_regs_struct defines the way the user registers are
769 * store on the stack for signal handling.
771 struct vki_user_regs_struct
773 vki_psw_t psw;
774 unsigned long gprs[VKI_NUM_GPRS];
775 unsigned int acrs[VKI_NUM_ACRS];
776 unsigned long orig_gpr2;
777 vki_s390_fp_regs fp_regs;
779 * These per registers are in here so that gdb can modify them
780 * itself as there is no "official" ptrace interface for hardware
781 * watchpoints. This is the way intel does it.
783 vki_per_struct per_info;
784 unsigned long ieee_instruction_pointer;
785 /* Used to give failing instruction back to user for ieee exceptions */
788 typedef struct
790 unsigned int vki_len;
791 unsigned long vki_kernel_addr;
792 unsigned long vki_process_addr;
793 } vki_ptrace_area;
796 * S/390 specific non posix ptrace requests
798 #define VKI_PTRACE_PEEKUSR_AREA 0x5000
799 #define VKI_PTRACE_POKEUSR_AREA 0x5001
801 //----------------------------------------------------------------------
802 // From linux-3.18/include/asm-s390/elf.h
803 //----------------------------------------------------------------------
805 typedef vki_s390_fp_regs vki_elf_fpregset_t;
806 typedef vki_s390_regs vki_elf_gregset_t;
808 #define VKI_HWCAP_S390_TE 1024
809 #define VKI_HWCAP_S390_VXRS 2048
810 #define VKI_HWCAP_S390_VXRS_EXT 8192
811 #define VKI_HWCAP_S390_VXRS_EXT2 32768
814 //----------------------------------------------------------------------
815 // From linux-2.6.16.60/include/asm-s390/ucontext.h
816 //----------------------------------------------------------------------
818 struct vki_ucontext {
819 unsigned long uc_flags;
820 struct vki_ucontext *uc_link;
821 vki_stack_t uc_stack;
822 _vki_sigregs uc_mcontext;
823 vki_sigset_t uc_sigmask; /* mask last for extensibility */
826 typedef char vki_modify_ldt_t;
828 //----------------------------------------------------------------------
829 // From linux-2.6.16.60/include/asm-s390/ipcbuf.h
830 //----------------------------------------------------------------------
832 struct vki_ipc64_perm
834 __vki_kernel_key_t key;
835 __vki_kernel_uid32_t uid;
836 __vki_kernel_gid32_t gid;
837 __vki_kernel_uid32_t cuid;
838 __vki_kernel_gid32_t cgid;
839 __vki_kernel_mode_t mode;
840 unsigned short __pad1;
841 unsigned short seq;
842 #ifndef VGA_s390x
843 unsigned short __pad2;
844 #endif /* ! VGA_s390x */
845 unsigned long __unused1;
846 unsigned long __unused2;
850 //----------------------------------------------------------------------
851 // From linux-2.6.16.60/include/asm-s390/sembuf.h
852 //----------------------------------------------------------------------
854 struct vki_semid64_ds {
855 struct vki_ipc64_perm sem_perm; /* permissions .. see ipc.h */
856 __vki_kernel_time_t sem_otime; /* last semop time */
857 #ifndef VGA_s390x
858 unsigned long __unused1;
859 #endif /* ! VGA_s390x */
860 __vki_kernel_time_t sem_ctime; /* last change time */
861 #ifndef VGA_s390x
862 unsigned long __unused2;
863 #endif /* ! VGA_s390x */
864 unsigned long sem_nsems; /* no. of semaphores in array */
865 unsigned long __unused3;
866 unsigned long __unused4;
870 //----------------------------------------------------------------------
871 // From linux-2.6.16.60/include/asm-s390/msgbuf.h
872 //----------------------------------------------------------------------
874 struct vki_msqid64_ds {
875 struct vki_ipc64_perm msg_perm;
876 __vki_kernel_time_t msg_stime; /* last msgsnd time */
877 #ifndef VGA_s390x
878 unsigned long __unused1;
879 #endif /* ! VGA_s390x */
880 __vki_kernel_time_t msg_rtime; /* last msgrcv time */
881 #ifndef VGA_s390x
882 unsigned long __unused2;
883 #endif /* ! VGA_s390x */
884 __vki_kernel_time_t msg_ctime; /* last change time */
885 #ifndef VGA_s390x
886 unsigned long __unused3;
887 #endif /* ! VGA_s390x */
888 unsigned long msg_cbytes; /* current number of bytes on queue */
889 unsigned long msg_qnum; /* number of messages in queue */
890 unsigned long msg_qbytes; /* max number of bytes on queue */
891 __vki_kernel_pid_t msg_lspid; /* pid of last msgsnd */
892 __vki_kernel_pid_t msg_lrpid; /* last receive pid */
893 unsigned long __unused4;
894 unsigned long __unused5;
898 //----------------------------------------------------------------------
899 // From linux-2.6.16.60/include/asm-s390/ipc.h
900 //----------------------------------------------------------------------
902 struct vki_ipc_kludge {
903 struct vki_msgbuf __user *msgp;
904 long msgtyp;
907 #define VKI_SEMOP 1
908 #define VKI_SEMGET 2
909 #define VKI_SEMCTL 3
910 #define VKI_SEMTIMEDOP 4
911 #define VKI_MSGSND 11
912 #define VKI_MSGRCV 12
913 #define VKI_MSGGET 13
914 #define VKI_MSGCTL 14
915 #define VKI_SHMAT 21
916 #define VKI_SHMDT 22
917 #define VKI_SHMGET 23
918 #define VKI_SHMCTL 24
921 //----------------------------------------------------------------------
922 // From linux-2.6.16.60/include/asm-s390/shmbuf.h
923 //----------------------------------------------------------------------
925 struct vki_shmid64_ds {
926 struct vki_ipc64_perm shm_perm; /* operation perms */
927 vki_size_t shm_segsz; /* size of segment (bytes) */
928 __vki_kernel_time_t shm_atime; /* last attach time */
929 #ifndef VGA_s390x
930 unsigned long __unused1;
931 #endif /* ! VGA_s390x */
932 __vki_kernel_time_t shm_dtime; /* last detach time */
933 #ifndef VGA_s390x
934 unsigned long __unused2;
935 #endif /* ! VGA_s390x */
936 __vki_kernel_time_t shm_ctime; /* last change time */
937 #ifndef VGA_s390x
938 unsigned long __unused3;
939 #endif /* ! VGA_s390x */
940 __vki_kernel_pid_t shm_cpid; /* pid of creator */
941 __vki_kernel_pid_t shm_lpid; /* pid of last operator */
942 unsigned long shm_nattch; /* no. of current attaches */
943 unsigned long __unused4;
944 unsigned long __unused5;
947 struct vki_shminfo64 {
948 unsigned long shmmax;
949 unsigned long shmmin;
950 unsigned long shmmni;
951 unsigned long shmseg;
952 unsigned long shmall;
953 unsigned long __unused1;
954 unsigned long __unused2;
955 unsigned long __unused3;
956 unsigned long __unused4;
960 //----------------------------------------------------------------------
961 // The following are defined in the VKI namespace but are nowhere found
962 // in the linux headers.
963 //----------------------------------------------------------------------
964 #define VKI_BIG_ENDIAN 1
965 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
966 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
968 //----------------------------------------------------------------------
969 // From linux-2.6.35.4/arch/s390x/include/asm/shmparam.h
970 //----------------------------------------------------------------------
972 #define VKI_SHMLBA VKI_PAGE_SIZE
974 /* If a system call returns a value >= VKI_MAX_ERRNO then that is considered
975 an error condition. I.e. the system call failed. */
976 #define VKI_MAX_ERRNO -125
978 //----------------------------------------------------------------------
979 // From linux-2.6.8.1/include/asm-generic/errno.h
980 //----------------------------------------------------------------------
982 #define VKI_ENOSYS 38 /* Function not implemented */
983 #define VKI_EOVERFLOW 75 /* Value too large for defined data type */
985 //----------------------------------------------------------------------
986 // From linux-3.19.0/include/uapi/asm-generic/ioctls.h
987 //----------------------------------------------------------------------
989 #define VKI_TIOCGSERIAL 0x541E
990 #define VKI_TIOCSSERIAL 0x541F
992 #endif // __VKI_S390X_LINUX_H
994 /*--------------------------------------------------------------------*/
995 /*--- end ---*/
996 /*--------------------------------------------------------------------*/