1 2 /*--------------------------------------------------------------------*/ 3 /*--- TILEGX/Linux-specific kernel interface. vki-tilegx-linux.h ---*/ 4 /*--------------------------------------------------------------------*/ 5 6 /* 7 This file is part of Valgrind, a dynamic binary instrumentation 8 framework. 9 10 Copyright (C) 2010-2015 Tilera Corp. 11 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. 16 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. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 25 02111-1307, USA. 26 27 The GNU General Public License is contained in the file COPYING. 28 */ 29 30 /* Contributed by Zhi-Gang Liu <zliu at tilera dot com> */ 31 32 #ifndef __VKI_TILEGX_LINUX_H 33 #define __VKI_TILEGX_LINUX_H 34 35 // TILEGX is little-endian. 36 #define VKI_LITTLE_ENDIAN 1 37 38 //---------------------------------------------------------------------- 39 // From tilegx linux/include/asm-generic/types.h 40 //---------------------------------------------------------------------- 41 42 typedef unsigned char __vki_u8; 43 44 typedef __signed__ short __vki_s16; 45 typedef unsigned short __vki_u16; 46 47 typedef __signed__ int __vki_s32; 48 typedef unsigned int __vki_u32; 49 50 typedef __signed__ long long __vki_s64; 51 typedef unsigned long long __vki_u64; 52 53 typedef unsigned short vki_u16; 54 55 typedef unsigned int vki_u32; 56 57 //---------------------------------------------------------------------- 58 // From tilegx linux/include/asm_generic/page.h 59 //---------------------------------------------------------------------- 60 61 #define VKI_PAGE_SHIFT 16 62 #define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT) 63 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT 64 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE 65 66 //---------------------------------------------------------------------- 67 // From linux/include/asm/shmparam.h 68 //---------------------------------------------------------------------- 69 70 #define VKI_SHMLBA VKI_PAGE_SIZE 71 72 //---------------------------------------------------------------------- 73 // From tilegx linux/include/asm_generic/signal.h 74 //---------------------------------------------------------------------- 75 76 #define _VKI_NSIG 64 77 #define _VKI_NSIG_BPW 64 78 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW) 79 80 typedef unsigned long vki_old_sigset_t; 81 82 typedef struct { 83 unsigned long sig[_VKI_NSIG_WORDS]; 84 } vki_sigset_t; 85 86 #define VKI_SIGHUP 1 87 #define VKI_SIGINT 2 88 #define VKI_SIGQUIT 3 89 #define VKI_SIGILL 4 90 #define VKI_SIGTRAP 5 91 #define VKI_SIGABRT 6 92 #define VKI_SIGIOT 6 93 #define VKI_SIGBUS 7 94 #define VKI_SIGFPE 8 95 #define VKI_SIGKILL 9 96 #define VKI_SIGUSR1 10 97 #define VKI_SIGSEGV 11 98 #define VKI_SIGUSR2 12 99 #define VKI_SIGPIPE 13 100 #define VKI_SIGALRM 14 101 #define VKI_SIGTERM 15 102 #define VKI_SIGSTKFLT 16 103 #define VKI_SIGCHLD 17 104 #define VKI_SIGCONT 18 105 #define VKI_SIGSTOP 19 106 #define VKI_SIGTSTP 20 107 #define VKI_SIGTTIN 21 108 #define VKI_SIGTTOU 22 109 #define VKI_SIGURG 23 110 #define VKI_SIGXCPU 24 111 #define VKI_SIGXFSZ 25 112 #define VKI_SIGVTALRM 26 113 #define VKI_SIGPROF 27 114 #define VKI_SIGWINCH 28 115 #define VKI_SIGIO 29 116 #define VKI_SIGPOLL 29 117 #define VKI_SIGPWR 30 118 #define VKI_SIGSYS 31 119 #define VKI_SIGUNUSED 31 120 121 #define VKI_SIGRTMIN 32 122 #define VKI_SIGRTMAX _VKI_NSIG 123 124 #define VKI_SA_NOCLDSTOP 0x00000001 125 #define VKI_SA_NOCLDWAIT 0x00000002 126 #define VKI_SA_SIGINFO 0x00000004 127 #define VKI_SA_ONSTACK 0x08000000 128 #define VKI_SA_RESTART 0x10000000 129 #define VKI_SA_NODEFER 0x40000000 130 #define VKI_SA_RESETHAND 0x80000000 131 132 #define VKI_SA_NOMASK VKI_SA_NODEFER 133 #define VKI_SA_ONESHOT VKI_SA_RESETHAND 134 135 #define VKI_SA_RESTORER 0x04000000 136 137 #define VKI_SS_ONSTACK 1 138 #define VKI_SS_DISABLE 2 139 140 #define VKI_MINSIGSTKSZ 2048 141 142 #define VKI_SIG_BLOCK 0 /* for blocking signals */ 143 #define VKI_SIG_UNBLOCK 1 /* for unblocking signals */ 144 #define VKI_SIG_SETMASK 2 /* for setting the signal mask */ 145 146 typedef void __vki_signalfn_t(int); 147 typedef __vki_signalfn_t __user *__vki_sighandler_t; 148 149 typedef void __vki_restorefn_t(void); 150 typedef __vki_restorefn_t __user *__vki_sigrestore_t; 151 152 #define VKI_SIG_DFL ((__vki_sighandler_t)0) /* default signal handling */ 153 #define VKI_SIG_IGN ((__vki_sighandler_t)1) /* ignore signal */ 154 155 struct vki_sigaction_base { 156 // [[Nb: a 'k' prefix is added to "sa_handler" because 157 // bits/sigaction.h (which gets dragged in somehow via signal.h) 158 // #defines it as something else. Since that is done for glibc's 159 // purposes, which we don't care about here, we use our own name.]] 160 __vki_sighandler_t ksa_handler; 161 unsigned long sa_flags; 162 __vki_sigrestore_t sa_restorer; 163 vki_sigset_t sa_mask; /* mask last for extensibility */ 164 }; 165 166 /* On Linux we use the same type for passing sigactions to 167 and from the kernel. Hence: */ 168 typedef struct vki_sigaction_base vki_sigaction_toK_t; 169 typedef struct vki_sigaction_base vki_sigaction_fromK_t; 170 171 172 typedef struct vki_sigaltstack { 173 void __user *ss_sp; 174 int ss_flags; 175 vki_size_t ss_size; 176 } vki_stack_t; 177 178 //---------------------------------------------------------------------- 179 // From tilegx linux/include/asm_generic/sigcontext.h 180 //---------------------------------------------------------------------- 181 182 // Tilegx has no FP registers. 183 struct _vki_fpstate { 184 185 }; 186 187 struct vki_sigcontext { 188 unsigned long gregs[53]; 189 unsigned long tp; 190 unsigned long sp; 191 unsigned long lr; 192 unsigned long pc; 193 unsigned long ics; 194 unsigned long faultnum; 195 unsigned long pad[5]; 196 }; 197 198 //---------------------------------------------------------------------- 199 // From tilegx linux/include/asm_generic/mman.h 200 //---------------------------------------------------------------------- 201 202 #define VKI_PROT_READ 0x1 /* page can be read */ 203 #define VKI_PROT_WRITE 0x2 /* page can be written */ 204 #define VKI_PROT_EXEC 0x4 /* page can be executed */ 205 #define VKI_PROT_NONE 0x0 /* page can not be accessed */ 206 #define VKI_PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 207 #define VKI_PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 208 209 #define VKI_MAP_SHARED 0x01 /* Share changes */ 210 #define VKI_MAP_PRIVATE 0x02 /* Changes are private */ 211 #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ 212 #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */ 213 #define VKI_MAP_HUGETLB 0x4000 /* Use HUGETLB */ 214 215 //---------------------------------------------------------------------- 216 // From tilegx linux/include/asm_generic/fcntl.h 217 //---------------------------------------------------------------------- 218 219 #define VKI_O_RDONLY 00 220 #define VKI_O_WRONLY 01 221 #define VKI_O_RDWR 02 222 #define VKI_O_ACCMODE 03 223 #define VKI_O_CREAT 0100 /* not fcntl */ 224 #define VKI_O_EXCL 0200 /* not fcntl */ 225 #define VKI_O_TRUNC 01000 /* not fcntl */ 226 #define VKI_O_APPEND 02000 227 #define VKI_O_NONBLOCK 04000 228 #define VKI_O_LARGEFILE 0100000 229 230 #define VKI_AT_FDCWD -100 231 232 #define VKI_F_DUPFD 0 /* dup */ 233 #define VKI_F_GETFD 1 /* get close_on_exec */ 234 #define VKI_F_SETFD 2 /* set/clear close_on_exec */ 235 #define VKI_F_GETFL 3 /* get file->f_flags */ 236 #define VKI_F_SETFL 4 /* set file->f_flags */ 237 #define VKI_F_GETLK 5 238 #define VKI_F_SETLK 6 239 #define VKI_F_SETLKW 7 240 241 #define VKI_F_SETOWN 8 /* for sockets. */ 242 #define VKI_F_GETOWN 9 /* for sockets. */ 243 #define VKI_F_SETSIG 10 /* for sockets. */ 244 #define VKI_F_GETSIG 11 /* for sockets. */ 245 246 #define VKI_F_SETOWN_EX 15 247 #define VKI_F_GETOWN_EX 16 248 #define VKI_F_GETLK64 12 249 #define VKI_F_SETLK64 13 250 #define VKI_F_SETLKW64 14 251 252 #define VKI_F_OFD_GETLK -1 253 #define VKI_F_OFD_SETLK -2 254 #define VKI_F_OFD_SETLKW -3 255 256 #define VKI_FD_CLOEXEC 1 /* actually anything with low bit set goes */ 257 258 #define VKI_F_LINUX_SPECIFIC_BASE 1024 259 260 struct vki_f_owner_ex { 261 int type; 262 __vki_kernel_pid_t pid; 263 }; 264 265 //---------------------------------------------------------------------- 266 // From tilegx linux/include/asm_generic/resource.h 267 //---------------------------------------------------------------------- 268 269 #define VKI_RLIMIT_DATA 2 /* max data size */ 270 #define VKI_RLIMIT_STACK 3 /* max stack size */ 271 #define VKI_RLIMIT_CORE 4 /* max core file size */ 272 #define VKI_RLIMIT_NOFILE 7 /* max number of open files */ 273 274 //---------------------------------------------------------------------- 275 // From tilegx linux/include/asm_generic/socket.h 276 //---------------------------------------------------------------------- 277 278 #define VKI_SOL_SOCKET 1 279 #define VKI_SO_TYPE 3 280 #define VKI_SO_ATTACH_FILTER 26 281 282 //---------------------------------------------------------------------- 283 // From tilegx linux/include/asm_generic/sockios.h 284 //---------------------------------------------------------------------- 285 286 #define VKI_SIOCSPGRP 0x8902 287 #define VKI_SIOCGPGRP 0x8904 288 #define VKI_SIOCATMARK 0x8905 289 #define VKI_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ 290 #define VKI_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ 291 292 //---------------------------------------------------------------------- 293 // From tilegx linux/include/asm_generic/stat.h 294 //---------------------------------------------------------------------- 295 296 struct vki_stat { 297 unsigned long st_dev; /* Device. */ 298 unsigned long st_ino; /* File serial number. */ 299 unsigned int st_mode; /* File mode. */ 300 unsigned int st_nlink; /* Link count. */ 301 unsigned int st_uid; /* User ID of the file's owner. */ 302 unsigned int st_gid; /* Group ID of the file's group. */ 303 unsigned long st_rdev; /* Device number, if device. */ 304 unsigned long __pad1; 305 long st_size; /* Size of file, in bytes. */ 306 int st_blksize; /* Optimal block size for I/O. */ 307 int __pad2; 308 long st_blocks; /* Number 512-byte blocks allocated. */ 309 long st_atime; /* Time of last access. */ 310 unsigned long st_atime_nsec; 311 long st_mtime; /* Time of last modification. */ 312 unsigned long st_mtime_nsec; 313 long st_ctime; /* Time of last status change. */ 314 unsigned long st_ctime_nsec; 315 unsigned int __unused4; 316 unsigned int __unused5; 317 }; 318 319 struct vki_stat64 { 320 unsigned long st_dev; /* Device. */ 321 unsigned long st_ino; /* File serial number. */ 322 unsigned int st_mode; /* File mode. */ 323 unsigned int st_nlink; /* Link count. */ 324 unsigned int st_uid; /* User ID of the file's owner. */ 325 unsigned int st_gid; /* Group ID of the file's group. */ 326 unsigned long st_rdev; /* Device number, if device. */ 327 unsigned long __pad1; 328 long st_size; /* Size of file, in bytes. */ 329 int st_blksize; /* Optimal block size for I/O. */ 330 int __pad2; 331 long st_blocks; /* Number 512-byte blocks allocated. */ 332 long st_atime; /* Time of last access. */ 333 unsigned long st_atime_nsec; 334 long st_mtime; /* Time of last modification. */ 335 unsigned long st_mtime_nsec; 336 long st_ctime; /* Time of last status change. */ 337 unsigned long st_ctime_nsec; 338 unsigned int __unused4; 339 unsigned int __unused5; 340 }; 341 342 //---------------------------------------------------------------------- 343 // From tilegx linux/include/asm_generic/statfs.h 344 //---------------------------------------------------------------------- 345 346 struct vki_statfs { 347 long f_type; 348 long f_bsize; 349 long f_blocks; 350 long f_bfree; 351 long f_bavail; 352 long f_files; 353 long f_ffree; 354 __vki_kernel_fsid_t f_fsid; 355 long f_namelen; 356 long f_frsize; 357 long f_flags; 358 long f_spare[4]; 359 }; 360 361 //---------------------------------------------------------------------- 362 // From tilegx linux/include/asm_generic/termios.h 363 //---------------------------------------------------------------------- 364 365 struct vki_winsize { 366 unsigned short ws_row; 367 unsigned short ws_col; 368 unsigned short ws_xpixel; 369 unsigned short ws_ypixel; 370 }; 371 372 #define VKI_NCC 8 373 struct vki_termio { 374 unsigned short c_iflag; /* input mode flags */ 375 unsigned short c_oflag; /* output mode flags */ 376 unsigned short c_cflag; /* control mode flags */ 377 unsigned short c_lflag; /* local mode flags */ 378 unsigned char c_line; /* line discipline */ 379 unsigned char c_cc[VKI_NCC]; /* control characters */ 380 }; 381 382 //---------------------------------------------------------------------- 383 // From tilegx linux/include/asm_generic/termbits.h 384 //---------------------------------------------------------------------- 385 386 typedef unsigned char vki_cc_t; 387 typedef unsigned int vki_tcflag_t; 388 389 #define VKI_NCCS 19 390 struct vki_termios { 391 vki_tcflag_t c_iflag; /* input mode flags */ 392 vki_tcflag_t c_oflag; /* output mode flags */ 393 vki_tcflag_t c_cflag; /* control mode flags */ 394 vki_tcflag_t c_lflag; /* local mode flags */ 395 vki_cc_t c_line; /* line discipline */ 396 vki_cc_t c_cc[VKI_NCCS]; /* control characters */ 397 }; 398 399 400 //---------------------------------------------------------------------- 401 // From tilegx linux/include/asm_generic/ioctl.h 402 //---------------------------------------------------------------------- 403 404 #define _VKI_IOC_NRBITS 8 405 #define _VKI_IOC_TYPEBITS 8 406 #define _VKI_IOC_SIZEBITS 14 407 #define _VKI_IOC_DIRBITS 2 408 409 #define _VKI_IOC_SIZEMASK ((1 << _VKI_IOC_SIZEBITS)-1) 410 #define _VKI_IOC_DIRMASK ((1 << _VKI_IOC_DIRBITS)-1) 411 412 #define _VKI_IOC_NRSHIFT 0 413 #define _VKI_IOC_TYPESHIFT (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS) 414 #define _VKI_IOC_SIZESHIFT (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS) 415 #define _VKI_IOC_DIRSHIFT (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS) 416 417 #define _VKI_IOC_NONE 0U 418 #define _VKI_IOC_WRITE 1U 419 #define _VKI_IOC_READ 2U 420 421 #define _VKI_IOC(dir,type,nr,size) \ 422 (((dir) << _VKI_IOC_DIRSHIFT) | \ 423 ((type) << _VKI_IOC_TYPESHIFT) | \ 424 ((nr) << _VKI_IOC_NRSHIFT) | \ 425 ((size) << _VKI_IOC_SIZESHIFT)) 426 427 #define _VKI_IO(type,nr) _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0) 428 #define _VKI_IOR(type,nr,size) _VKI_IOC(_VKI_IOC_READ,(type),(nr),sizeof(size)) 429 #define _VKI_IOW(type,nr,size) _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),sizeof(size)) 430 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),sizeof(size)) 431 432 #define _VKI_IOC_DIR(nr) (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK) 433 #define _VKI_IOC_SIZE(nr) (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK) 434 435 //---------------------------------------------------------------------- 436 // From tilegx linux/include/asm_generic/ioctls.h 437 //---------------------------------------------------------------------- 438 439 #define VKI_TCGETS 0x5401 440 #define VKI_TCSETS 0x5402 441 #define VKI_TCSETSW 0x5403 442 #define VKI_TCSETSF 0x5404 443 #define VKI_TCGETA 0x5405 444 #define VKI_TCSETA 0x5406 445 #define VKI_TCSETAW 0x5407 446 #define VKI_TCSETAF 0x5408 447 #define VKI_TCSBRK 0x5409 448 #define VKI_TCXONC 0x540A 449 #define VKI_TCFLSH 0x540B 450 #define VKI_TIOCEXCL 0x540C 451 #define VKI_TIOCNXCL 0x540D 452 #define VKI_TIOCSCTTY 0x540E 453 #define VKI_TIOCGPGRP 0x540F 454 #define VKI_TIOCSPGRP 0x5410 455 #define VKI_TIOCOUTQ 0x5411 456 #define VKI_TIOCSTI 0x5412 457 #define VKI_TIOCGWINSZ 0x5413 458 #define VKI_TIOCSWINSZ 0x5414 459 #define VKI_TIOCMGET 0x5415 460 #define VKI_TIOCMBIS 0x5416 461 #define VKI_TIOCMBIC 0x5417 462 #define VKI_TIOCMSET 0x5418 463 #define VKI_TIOCGSOFTCAR 0x5419 464 #define VKI_TIOCSSOFTCAR 0x541A 465 #define VKI_FIONREAD 0x541B 466 #define VKI_TIOCINQ VKI_FIONREAD 467 #define VKI_TIOCLINUX 0x541C 468 #define VKI_TIOCCONS 0x541D 469 #define VKI_TIOCGSERIAL 0x541E 470 #define VKI_TIOCSSERIAL 0x541F 471 #define VKI_TIOCPKT 0x5420 472 #define VKI_FIONBIO 0x5421 473 #define VKI_TIOCNOTTY 0x5422 474 #define VKI_TIOCSETD 0x5423 475 #define VKI_TIOCGETD 0x5424 476 #define VKI_TCSBRKP 0x5425 477 #define VKI_TIOCGPTN _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 478 #define VKI_TIOCSPTLCK _VKI_IOW('T',0x31, int) /* Lock/unlock Pty */ 479 480 #define VKI_FIONCLEX 0x5450 481 #define VKI_FIOCLEX 0x5451 482 #define VKI_FIOASYNC 0x5452 483 #define VKI_TIOCSERGETLSR 0x5459 /* Get line status register */ 484 #define VKI_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 485 486 // X86_64 define above, assume tilegx need no more than that. --FIXME 487 488 #define VKI_TIOCGPTN _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 489 #define VKI_TIOCSPTLCK _VKI_IOW('T',0x31, int) /* Lock/unlock Pty */ 490 491 #define VKI_FIOASYNC 0x5452 492 #define VKI_TIOCSERGETLSR 0x5459 /* Get line status register */ 493 #define VKI_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 494 495 //---------------------------------------------------------------------- 496 // From tilegx linux/include/asm_generic/poll.h 497 //---------------------------------------------------------------------- 498 499 #define VKI_POLLIN 0x0001 500 501 struct vki_pollfd { 502 int fd; 503 short events; 504 short revents; 505 }; 506 507 //---------------------------------------------------------------------- 508 // From tilegx linux/include/asm_generic/user.h 509 //---------------------------------------------------------------------- 510 511 //---------------------------------------------------------------------- 512 // From tilegx linux/include/asm_generic/ucontext.h 513 //---------------------------------------------------------------------- 514 515 struct vki_ucontext { 516 unsigned long uc_flags; 517 struct vki_ucontext *uc_link; 518 vki_stack_t uc_stack; 519 struct vki_sigcontext uc_mcontext; 520 vki_sigset_t uc_sigmask; /* mask last for extensibility */ 521 }; 522 523 //---------------------------------------------------------------------- 524 // From tilegx linux/include/asm_generic/segment.h 525 //---------------------------------------------------------------------- 526 // NA 527 //---------------------------------------------------------------------- 528 // From tilegx linux/include/asm-generic/prctl.h 529 //---------------------------------------------------------------------- 530 // NA 531 //---------------------------------------------------------------------- 532 // From tilegx linux/include/asm_generic/ldt.h 533 //---------------------------------------------------------------------- 534 535 // NA 536 537 //---------------------------------------------------------------------- 538 // From linux-2.6.11.2/include/asm-x86_64/ipcbuf.h 539 //---------------------------------------------------------------------- 540 541 struct vki_ipc64_perm 542 { 543 __vki_kernel_key_t key; 544 __vki_kernel_uid32_t uid; 545 __vki_kernel_gid32_t gid; 546 __vki_kernel_uid32_t cuid; 547 __vki_kernel_gid32_t cgid; 548 __vki_kernel_mode_t mode; 549 unsigned char __pad1[4 - sizeof(__vki_kernel_mode_t)]; 550 unsigned short seq; 551 unsigned short __pad2; 552 unsigned long __unused1; 553 unsigned long __unused2; 554 }; 555 556 //---------------------------------------------------------------------- 557 // From linux-2.6.11.2/include/asm-x86_64/sembuf.h 558 //---------------------------------------------------------------------- 559 560 struct vki_semid64_ds { 561 struct vki_ipc64_perm sem_perm; /* permissions .. see ipc.h */ 562 __vki_kernel_time_t sem_otime; /* last semop time */ 563 __vki_kernel_time_t sem_ctime; /* last change time */ 564 unsigned long sem_nsems; /* no. of semaphores in array */ 565 unsigned long __unused3; 566 unsigned long __unused4; 567 }; 568 569 //---------------------------------------------------------------------- 570 // From linux-2.6.11.2/include/asm-x86_64/msgbuf.h 571 //---------------------------------------------------------------------- 572 573 struct vki_msqid64_ds { 574 struct vki_ipc64_perm msg_perm; 575 __vki_kernel_time_t msg_stime; /* last msgsnd time */ 576 __vki_kernel_time_t msg_rtime; /* last msgrcv time */ 577 __vki_kernel_time_t msg_ctime; /* last change time */ 578 unsigned long msg_cbytes; /* current number of bytes on queue */ 579 unsigned long msg_qnum; /* number of messages in queue */ 580 unsigned long msg_qbytes; /* max number of bytes on queue */ 581 __vki_kernel_pid_t msg_lspid; /* pid of last msgsnd */ 582 __vki_kernel_pid_t msg_lrpid; /* last receive pid */ 583 unsigned long __unused4; 584 unsigned long __unused5; 585 }; 586 587 //---------------------------------------------------------------------- 588 // From linux-2.6.11.2/include/asm-x86_64/shmbuf.h 589 //---------------------------------------------------------------------- 590 591 struct vki_shmid64_ds { 592 struct vki_ipc64_perm shm_perm; /* operation perms */ 593 vki_size_t shm_segsz; /* size of segment (bytes) */ 594 __vki_kernel_time_t shm_atime; /* last attach time */ 595 __vki_kernel_time_t shm_dtime; /* last detach time */ 596 __vki_kernel_time_t shm_ctime; /* last change time */ 597 __vki_kernel_pid_t shm_cpid; /* pid of creator */ 598 __vki_kernel_pid_t shm_lpid; /* pid of last operator */ 599 unsigned long shm_nattch; /* no. of current attaches */ 600 unsigned long __unused4; 601 unsigned long __unused5; 602 }; 603 604 struct vki_shminfo64 { 605 unsigned long shmmax; 606 unsigned long shmmin; 607 unsigned long shmmni; 608 unsigned long shmseg; 609 unsigned long shmall; 610 unsigned long __unused1; 611 unsigned long __unused2; 612 unsigned long __unused3; 613 unsigned long __unused4; 614 }; 615 616 //---------------------------------------------------------------------- 617 // From tilegx linux/include/asm-tile/ptrace.h 618 //---------------------------------------------------------------------- 619 620 struct vki_pt_regs { 621 622 unsigned long regs[53]; 623 unsigned long tp; 624 unsigned long sp; 625 unsigned long lr; 626 unsigned long pc; 627 unsigned long ex1; 628 unsigned long faultnum; 629 unsigned long orig_r0; 630 unsigned long flags; 631 unsigned long pad[3]; 632 }; 633 634 #ifndef user_pt_regs 635 #define user_pt_regs vki_pt_regs 636 #endif 637 638 // Tile has no fp registers. Just make gcc happy. 639 struct tilegx_elf_fpregset {}; 640 typedef struct tilegx_elf_fpregset vki_elf_fpregset_t; 641 642 #define vki_user_regs_struct vki_pt_regs 643 644 #define TILEGX_r56 regs[56] 645 #define TILEGX_r55 regs[55] 646 #define TILEGX_r54 regs[54] 647 #define TILEGX_r53 regs[53] 648 #define TILEGX_r52 regs[52] 649 #define TILEGX_r51 regs[51] 650 #define TILEGX_r50 regs[50] 651 #define TILEGX_r49 regs[49] 652 #define TILEGX_r48 regs[48] 653 #define TILEGX_r47 regs[47] 654 #define TILEGX_r46 regs[46] 655 #define TILEGX_r45 regs[45] 656 #define TILEGX_r44 regs[44] 657 #define TILEGX_r43 regs[43] 658 #define TILEGX_r42 regs[42] 659 #define TILEGX_r41 regs[41] 660 #define TILEGX_r40 regs[40] 661 #define TILEGX_r39 regs[39] 662 #define TILEGX_r38 regs[38] 663 #define TILEGX_r37 regs[37] 664 #define TILEGX_r36 regs[36] 665 #define TILEGX_r35 regs[35] 666 #define TILEGX_r34 regs[34] 667 #define TILEGX_r33 regs[33] 668 #define TILEGX_r32 regs[32] 669 #define TILEGX_r31 regs[31] 670 #define TILEGX_r30 regs[30] 671 #define TILEGX_r29 regs[29] 672 #define TILEGX_r28 regs[28] 673 #define TILEGX_r27 regs[27] 674 #define TILEGX_r26 regs[26] 675 #define TILEGX_r25 regs[25] 676 #define TILEGX_r24 regs[24] 677 #define TILEGX_r23 regs[23] 678 #define TILEGX_r22 regs[22] 679 #define TILEGX_r21 regs[21] 680 #define TILEGX_r20 regs[20] 681 #define TILEGX_r19 regs[19] 682 #define TILEGX_r18 regs[18] 683 #define TILEGX_r17 regs[17] 684 #define TILEGX_r16 regs[16] 685 #define TILEGX_r15 regs[15] 686 #define TILEGX_r14 regs[14] 687 #define TILEGX_r13 regs[13] 688 #define TILEGX_r12 regs[12] 689 #define TILEGX_r11 regs[11] 690 #define TILEGX_r10 regs[10] 691 #define TILEGX_r9 regs[9] 692 #define TILEGX_r8 regs[8] 693 #define TILEGX_r7 regs[7] 694 #define TILEGX_r6 regs[6] 695 #define TILEGX_r5 regs[5] 696 #define TILEGX_r4 regs[4] 697 #define TILEGX_r3 regs[3] 698 #define TILEGX_r2 regs[2] 699 #define TILEGX_r1 regs[1] 700 #define TILEGX_r0 regs[0] 701 702 #define TILEGX_lr TILEGX_r55 703 #define TILEGX_sp TILEGX_r54 704 #define TILEGX_tp TILEGX_r53 705 #define TILEGX_pc TILEGX_r56 706 707 #define VKI_PTRACE_GETREGS 12 708 #define VKI_PTRACE_SETREGS 13 709 #define VKI_PTRACE_GETFPREGS 14 710 #define VKI_PTRACE_SETFPREGS 15 711 712 713 //---------------------------------------------------------------------- 714 // From tilegx linux/include/asm_generic/elf.h 715 //---------------------------------------------------------------------- 716 717 typedef unsigned long vki_elf_greg_t; 718 719 #define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t)) 720 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG]; 721 722 723 struct tilegx_dirent64 { 724 long d_ino; 725 long d_off; 726 unsigned short d_reclen; 727 unsigned char d_type; 728 char d_name[256]; 729 }; 730 731 //---------------------------------------------------------------------- 732 // From tilegx linux/include/asm-generic/errno.h 733 //---------------------------------------------------------------------- 734 735 #define VKI_ENOSYS 38 /* Function not implemented */ 736 #define VKI_EOVERFLOW 75 /* Value too large for defined data type */ 737 738 //---------------------------------------------------------------------- 739 // And that's it! 740 //---------------------------------------------------------------------- 741 742 #endif // __VKI_TILEGX_LINUX_H 743 744 /*--------------------------------------------------------------------*/ 745 /*--- end ---*/ 746 /*--------------------------------------------------------------------*/ 747