1
2/*--------------------------------------------------------------------*/
3/*--- ARM64/Linux-specific kernel interface.     vki-arm64-linux.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7   This file is part of Valgrind, a dynamic binary instrumentation
8   framework.
9
10   Copyright (C) 2013-2017 OpenWorks
11      info@open-works.net
12
13   This program is free software; you can redistribute it and/or
14   modify it under the terms of the GNU General Public License as
15   published by the Free Software Foundation; either version 2 of the
16   License, or (at your option) any later version.
17
18   This program is distributed in the hope that it will be useful, but
19   WITHOUT ANY WARRANTY; without even the implied warranty of
20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21   General Public License for more details.
22
23   You should have received a copy of the GNU General Public License
24   along with this program; if not, write to the Free Software
25   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26   02111-1307, USA.
27
28   The GNU General Public License is contained in the file COPYING.
29*/
30
31#ifndef __VKI_ARM64_LINUX_H
32#define __VKI_ARM64_LINUX_H
33
34// ARM64 is little-endian.
35#define VKI_LITTLE_ENDIAN  1
36
37//----------------------------------------------------------------------
38// From linux-3.9.9/include/uapi/asm-generic/int-ll64.h
39//----------------------------------------------------------------------
40
41typedef unsigned char __vki_u8;
42
43typedef __signed__ short __vki_s16;
44typedef unsigned short __vki_u16;
45
46typedef __signed__ int __vki_s32;
47typedef unsigned int __vki_u32;
48
49typedef __signed__ long long __vki_s64;
50typedef unsigned long long __vki_u64;
51
52typedef unsigned short vki_u16;
53
54typedef unsigned int vki_u32;
55
56//----------------------------------------------------------------------
57// From linux-3.9.9/arch/arm64/include/asm/page.h
58//----------------------------------------------------------------------
59
60/* Looks like arm64 can do both 4k and 64k pages, so we
61   use the at-startup detection scheme that ppc32/64 do. */
62extern UWord VKI_PAGE_SHIFT;
63extern UWord VKI_PAGE_SIZE;
64#define VKI_MAX_PAGE_SHIFT	16
65#define VKI_MAX_PAGE_SIZE	(1UL << VKI_MAX_PAGE_SHIFT)
66
67//----------------------------------------------------------------------
68// From linux-3.10.5/arch/arm64/include/asm/shmparam.h
69//----------------------------------------------------------------------
70
71// Trying to make sense of this .. it seems as if, for doing
72// shared memory with 64 bit processes, VKI_PAGE_SIZE is good
73// enough.  But if sharing with a 32 bit process then we need
74// the old-style 16k value (4 * VKI_PAGE_SIZE) to be safe.
75// (From reading between the lines of arch/arm64/include/asm/shmparam.h)
76#define VKI_SHMLBA  (4 * VKI_PAGE_SIZE)
77
78//----------------------------------------------------------------------
79// From linux-3.10.5/include/uapi/asm-generic/signal.h
80//----------------------------------------------------------------------
81
82#define _VKI_NSIG	64
83#define _VKI_NSIG_BPW	64
84#define _VKI_NSIG_WORDS	(_VKI_NSIG / _VKI_NSIG_BPW)
85
86typedef unsigned long vki_old_sigset_t;
87
88typedef struct {
89	unsigned long sig[_VKI_NSIG_WORDS];
90} vki_sigset_t;
91
92#define VKI_SIGHUP		 1
93#define VKI_SIGINT		 2
94#define VKI_SIGQUIT		 3
95#define VKI_SIGILL		 4
96#define VKI_SIGTRAP		 5
97#define VKI_SIGABRT		 6
98#define VKI_SIGBUS		 7
99#define VKI_SIGFPE		 8
100#define VKI_SIGKILL		 9
101#define VKI_SIGUSR1		10
102#define VKI_SIGSEGV		11
103#define VKI_SIGUSR2		12
104#define VKI_SIGPIPE		13
105#define VKI_SIGALRM		14
106#define VKI_SIGTERM		15
107#define VKI_SIGSTKFLT		16
108#define VKI_SIGCHLD		17
109#define VKI_SIGCONT		18
110#define VKI_SIGSTOP		19
111#define VKI_SIGTSTP		20
112#define VKI_SIGTTIN		21
113#define VKI_SIGTTOU		22
114#define VKI_SIGURG		23
115#define VKI_SIGXCPU		24
116#define VKI_SIGXFSZ		25
117#define VKI_SIGVTALRM		26
118#define VKI_SIGPROF		27
119#define VKI_SIGWINCH		28
120#define VKI_SIGIO		29
121#define VKI_SIGPWR		30
122#define VKI_SIGSYS		31
123#define	VKI_SIGUNUSED		31
124
125#define VKI_SIGRTMIN		32
126#define VKI_SIGRTMAX		_VKI_NSIG
127
128#define VKI_SA_NOCLDSTOP	0x00000001
129#define VKI_SA_NOCLDWAIT	0x00000002
130#define VKI_SA_SIGINFO		0x00000004
131#define VKI_SA_ONSTACK		0x08000000
132#define VKI_SA_RESTART		0x10000000
133#define VKI_SA_NODEFER		0x40000000
134#define VKI_SA_RESETHAND	0x80000000
135
136#define VKI_SA_NOMASK	VKI_SA_NODEFER
137#define VKI_SA_ONESHOT	VKI_SA_RESETHAND
138
139// This is obsolete and should not be defined for new archs
140#define VKI_SA_RESTORER	0x04000000
141
142#define VKI_SS_ONSTACK	1
143#define VKI_SS_DISABLE	2
144
145#define VKI_MINSIGSTKSZ	2048
146
147#define VKI_SIG_BLOCK          0	/* for blocking signals */
148#define VKI_SIG_UNBLOCK        1	/* for unblocking signals */
149#define VKI_SIG_SETMASK        2	/* for setting the signal mask */
150
151typedef void __vki_signalfn_t(int);
152typedef __vki_signalfn_t __user *__vki_sighandler_t;
153
154typedef void __vki_restorefn_t(void);
155typedef __vki_restorefn_t __user *__vki_sigrestore_t;
156
157#define VKI_SIG_DFL	((__vki_sighandler_t)0)	/* default signal handling */
158#define VKI_SIG_IGN	((__vki_sighandler_t)1)	/* ignore signal */
159
160struct vki_sigaction_base {
161        // [[Nb: a 'k' prefix is added to "sa_handler" because
162        // bits/sigaction.h (which gets dragged in somehow via signal.h)
163        // #defines it as something else.  Since that is done for glibc's
164        // purposes, which we don't care about here, we use our own name.]]
165	__vki_sighandler_t ksa_handler;
166	unsigned long sa_flags;
167        __vki_sigrestore_t sa_restorer; // I don't think arm64 has this
168	vki_sigset_t sa_mask;		/* mask last for extensibility */
169};
170
171/* On Linux we use the same type for passing sigactions to
172   and from the kernel.  Hence: */
173typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
174typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
175
176
177typedef struct vki_sigaltstack {
178	void __user *ss_sp;
179	int ss_flags;
180	vki_size_t ss_size;
181} vki_stack_t;
182
183//----------------------------------------------------------------------
184// From linux-3.10.5/arch/arm64/include/uapi/asm/sigcontext.h
185//----------------------------------------------------------------------
186
187struct vki_sigcontext {
188        __vki_u64 fault_address;
189        /* AArch64 registers */
190        __vki_u64 regs[31];
191        __vki_u64 sp;
192        __vki_u64 pc;
193        __vki_u64 pstate;
194        /* 4K reserved for FP/SIMD state and future expansion */
195        __vki_u8 __reserved[4096] __attribute__((__aligned__(16)));
196};
197
198//----------------------------------------------------------------------
199// From linux-3.10.5/uapi/include/asm-generic/mman-common.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_NORESERVE       0x4000  /* don't check for reservations */
214
215//----------------------------------------------------------------------
216// From linux-3.10.5/uapi/include/asm-generic/fcntl.h
217//----------------------------------------------------------------------
218
219#define VKI_O_ACCMODE	     03
220#define VKI_O_RDONLY	     00
221#define VKI_O_WRONLY	     01
222#define VKI_O_RDWR	     02
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
249#define VKI_F_OFD_GETLK		36
250#define VKI_F_OFD_SETLK		37
251#define VKI_F_OFD_SETLKW	38
252
253#define VKI_F_OWNER_TID		0
254#define VKI_F_OWNER_PID		1
255#define VKI_F_OWNER_PGRP	2
256
257struct vki_f_owner_ex {
258	int	type;
259	__vki_kernel_pid_t	pid;
260};
261
262#define VKI_FD_CLOEXEC	1	/* actually anything with low bit set goes */
263
264#define VKI_F_LINUX_SPECIFIC_BASE	1024
265
266//----------------------------------------------------------------------
267// From linux-3.10.5/include/uapi/asm-generic/resource.h
268//----------------------------------------------------------------------
269
270#define VKI_RLIMIT_DATA		2	/* max data size */
271#define VKI_RLIMIT_STACK	3	/* max stack size */
272#define VKI_RLIMIT_CORE		4	/* max core file size */
273#define VKI_RLIMIT_NOFILE	7	/* max number of open files */
274
275//----------------------------------------------------------------------
276// From linux-3.10.5/include/uapi/asm-generic/socket.h
277//----------------------------------------------------------------------
278
279#define VKI_SOL_SOCKET	1
280
281#define VKI_SO_TYPE	3
282
283#define VKI_SO_ATTACH_FILTER	26
284
285//----------------------------------------------------------------------
286// From linux-3.10.5/include/uapi/asm-generic/sockios.h
287//----------------------------------------------------------------------
288
289#define VKI_SIOCSPGRP		0x8902
290#define VKI_SIOCGPGRP		0x8904
291#define VKI_SIOCATMARK		0x8905
292#define VKI_SIOCGSTAMP		0x8906		/* Get stamp (timeval) */
293#define VKI_SIOCGSTAMPNS	0x8907		/* Get stamp (timespec) */
294
295//----------------------------------------------------------------------
296// From linux-3.10.5/include/uapi/asm-generic/stat.h
297//----------------------------------------------------------------------
298
299struct vki_stat {
300        unsigned long   st_dev;
301        unsigned long   st_ino;
302        unsigned int    st_mode;
303        unsigned int    st_nlink;
304        unsigned int    st_uid;
305        unsigned int    st_gid;
306        unsigned long   st_rdev;
307        unsigned long   __pad1;
308        long            st_size;
309        int             st_blksize;
310        int             __pad2;
311        long            st_blocks;
312        long            st_atime;
313        unsigned long   st_atime_nsec;
314        long            st_mtime;
315        unsigned long   st_mtime_nsec;
316        long            st_ctime;
317        unsigned long   st_ctime_nsec;
318        unsigned int    __unused4;
319        unsigned int    __unused5;
320};
321
322//----------------------------------------------------------------------
323// From linux-3.10.5/include/uapi/asm-generic/statfs.h
324//----------------------------------------------------------------------
325
326struct vki_statfs {
327	long f_type;
328	long f_bsize;
329	long f_blocks;
330	long f_bfree;
331	long f_bavail;
332	long f_files;
333	long f_ffree;
334	__vki_kernel_fsid_t f_fsid;
335	long f_namelen;
336	long f_frsize;
337	long f_flags;
338	long f_spare[4];
339};
340
341//----------------------------------------------------------------------
342// From linux-3.10.5/include/uapi/asm-generic/termios.h
343//----------------------------------------------------------------------
344
345struct vki_winsize {
346	unsigned short ws_row;
347	unsigned short ws_col;
348	unsigned short ws_xpixel;
349	unsigned short ws_ypixel;
350};
351
352#define VKI_NCC 8
353struct vki_termio {
354	unsigned short c_iflag;		/* input mode flags */
355	unsigned short c_oflag;		/* output mode flags */
356	unsigned short c_cflag;		/* control mode flags */
357	unsigned short c_lflag;		/* local mode flags */
358	unsigned char c_line;		/* line discipline */
359	unsigned char c_cc[VKI_NCC];	/* control characters */
360};
361
362//----------------------------------------------------------------------
363// From linux-3.10.5/include/uapi/asm-generic/termbits.h
364//----------------------------------------------------------------------
365
366typedef unsigned char	vki_cc_t;
367typedef unsigned int	vki_tcflag_t;
368
369#define VKI_NCCS 19
370struct vki_termios {
371	vki_tcflag_t c_iflag;		/* input mode flags */
372	vki_tcflag_t c_oflag;		/* output mode flags */
373	vki_tcflag_t c_cflag;		/* control mode flags */
374	vki_tcflag_t c_lflag;		/* local mode flags */
375	vki_cc_t c_line;		/* line discipline */
376	vki_cc_t c_cc[VKI_NCCS];	/* control characters */
377};
378
379//----------------------------------------------------------------------
380// From linux-3.9.9/include/uapi/asm-generic/ioctl.h
381//----------------------------------------------------------------------
382
383#define _VKI_IOC_NRBITS		8
384#define _VKI_IOC_TYPEBITS	8
385#define _VKI_IOC_SIZEBITS	14
386#define _VKI_IOC_DIRBITS	2
387
388#define _VKI_IOC_SIZEMASK	((1 << _VKI_IOC_SIZEBITS)-1)
389#define _VKI_IOC_DIRMASK	((1 << _VKI_IOC_DIRBITS)-1)
390
391#define _VKI_IOC_NRSHIFT	0
392#define _VKI_IOC_TYPESHIFT	(_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
393#define _VKI_IOC_SIZESHIFT	(_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
394#define _VKI_IOC_DIRSHIFT	(_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
395
396#define _VKI_IOC_NONE	0U
397#define _VKI_IOC_WRITE	1U
398#define _VKI_IOC_READ	2U
399
400#define _VKI_IOC(dir,type,nr,size) \
401	(((dir)  << _VKI_IOC_DIRSHIFT) | \
402	 ((type) << _VKI_IOC_TYPESHIFT) | \
403	 ((nr)   << _VKI_IOC_NRSHIFT) | \
404	 ((size) << _VKI_IOC_SIZESHIFT))
405
406#define _VKI_IO(type,nr)	_VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
407#define _VKI_IOR(type,nr,size)	_VKI_IOC(_VKI_IOC_READ,(type),(nr),sizeof(size))
408#define _VKI_IOW(type,nr,size)	_VKI_IOC(_VKI_IOC_WRITE,(type),(nr),sizeof(size))
409#define _VKI_IOWR(type,nr,size)	_VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),sizeof(size))
410
411#define _VKI_IOC_DIR(nr)		(((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
412#define _VKI_IOC_SIZE(nr)		(((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
413
414//----------------------------------------------------------------------
415// From linux-3.10.5/include/uapi/asm-generic/ioctls.h
416//----------------------------------------------------------------------
417
418#define VKI_TCGETS	0x5401
419#define VKI_TCSETS	0x5402
420#define VKI_TCSETSW	0x5403
421#define VKI_TCSETSF	0x5404
422#define VKI_TCGETA	0x5405
423#define VKI_TCSETA	0x5406
424#define VKI_TCSETAW	0x5407
425#define VKI_TCSETAF	0x5408
426#define VKI_TCSBRK	0x5409
427#define VKI_TCXONC	0x540A
428#define VKI_TCFLSH	0x540B
429#define VKI_TIOCSCTTY	0x540E
430#define VKI_TIOCGPGRP	0x540F
431#define VKI_TIOCSPGRP	0x5410
432#define VKI_TIOCOUTQ	0x5411
433#define VKI_TIOCGWINSZ	0x5413
434#define VKI_TIOCSWINSZ	0x5414
435#define VKI_TIOCMGET	0x5415
436#define VKI_TIOCMBIS	0x5416
437#define VKI_TIOCMBIC	0x5417
438#define VKI_TIOCMSET	0x5418
439#define VKI_FIONREAD	0x541B
440#define VKI_TIOCLINUX	0x541C
441#define VKI_FIONBIO	0x5421
442#define VKI_TIOCNOTTY	0x5422
443#define VKI_TCSBRKP	0x5425
444#define VKI_TIOCGPTN	_VKI_IOR('T',0x30, unsigned int)
445#define VKI_TIOCSPTLCK	_VKI_IOW('T',0x31, int)
446
447#define VKI_FIONCLEX    0x5450
448#define VKI_FIOCLEX     0x5451
449#define VKI_FIOASYNC	0x5452
450#define VKI_TIOCSERGETLSR   0x5459
451
452#define VKI_TIOCGICOUNT	0x545D
453
454//----------------------------------------------------------------------
455// From linux-3.9.9/include/uapi/asm-generic/poll.h
456//----------------------------------------------------------------------
457
458#define VKI_POLLIN		0x0001
459
460struct vki_pollfd {
461	int fd;
462	short events;
463	short revents;
464};
465
466//----------------------------------------------------------------------
467// From linux-3.10.5/arch/arm64/include/uapi/asm/ptrace.h
468//----------------------------------------------------------------------
469
470//ZZ struct vki_user_i387_struct {
471//ZZ 	unsigned short	cwd;
472//ZZ 	unsigned short	swd;
473//ZZ 	unsigned short	twd; /* Note this is not the same as the 32bit/x87/FSAVE twd */
474//ZZ 	unsigned short	fop;
475//ZZ 	__vki_u64	rip;
476//ZZ 	__vki_u64	rdp;
477//ZZ 	__vki_u32	mxcsr;
478//ZZ 	__vki_u32	mxcsr_mask;
479//ZZ 	__vki_u32	st_space[32];	/* 8*16 bytes for each FP-reg = 128 bytes */
480//ZZ 	__vki_u32	xmm_space[64];	/* 16*16 bytes for each XMM-reg = 256 bytes */
481//ZZ 	__vki_u32	padding[24];
482//ZZ };
483//ZZ
484//ZZ struct vki_user_regs_struct {
485//ZZ 	unsigned long r15,r14,r13,r12,rbp,rbx,r11,r10;
486//ZZ 	unsigned long r9,r8,rax,rcx,rdx,rsi,rdi,orig_rax;
487//ZZ 	unsigned long rip,cs,eflags;
488//ZZ 	unsigned long rsp,ss;
489//ZZ   	unsigned long fs_base, gs_base;
490//ZZ 	unsigned long ds,es,fs,gs;
491//ZZ };
492
493struct vki_user_pt_regs {
494        __vki_u64           regs[31];
495        __vki_u64           sp;
496        __vki_u64           pc;
497        __vki_u64           pstate;
498};
499
500/* I think that the new name in the kernel for these is "user_pt_regs"
501   and the old name is "user_regs_struct".  Unfortunately can't clone
502   a 'struct' type using 'typedef' and still have a 'struct' type, so
503   use a blunter instrument instead. */
504#define vki_user_regs_struct vki_user_pt_regs
505
506struct vki_user_fpsimd_state {
507        __uint128_t     vregs[32];
508        __vki_u32           fpsr;
509        __vki_u32           fpcr;
510};
511
512//----------------------------------------------------------------------
513// From linux-3.9.9/arch/arm64/include/asm/elf.h
514//----------------------------------------------------------------------
515
516typedef unsigned long vki_elf_greg_t;
517
518#define VKI_ELF_NGREG (sizeof (struct vki_user_pt_regs) / sizeof(vki_elf_greg_t))
519typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
520
521typedef struct vki_user_fpsimd_state vki_elf_fpregset_t;
522
523//----------------------------------------------------------------------
524// From linux-3.10.5/arch/arm64/include/asm/ucontext.h
525//----------------------------------------------------------------------
526
527struct vki_ucontext {
528        unsigned long           uc_flags;
529        struct vki_ucontext    *uc_link;
530        vki_stack_t             uc_stack;
531        vki_sigset_t            uc_sigmask;
532        /* glibc uses a 1024-bit sigset_t */
533        __vki_u8                __unused0[1024 / 8 - sizeof(vki_sigset_t)];
534        /* last for future expansion */
535        struct vki_sigcontext   uc_mcontext;
536};
537
538//ZZ //----------------------------------------------------------------------
539//ZZ // From linux-2.6.9/include/asm-x86_64/segment.h
540//ZZ //----------------------------------------------------------------------
541//ZZ
542//ZZ #define VKI_GDT_ENTRY_TLS_ENTRIES 3
543//ZZ
544//ZZ #define VKI_GDT_ENTRY_TLS_MIN 11
545//ZZ #define VKI_GDT_ENTRY_TLS_MAX 13
546//ZZ
547//ZZ //----------------------------------------------------------------------
548//ZZ // From linux-2.6.11.9/include/asm-x86_64/prctl.h
549//ZZ //----------------------------------------------------------------------
550//ZZ
551//ZZ #define VKI_ARCH_SET_GS 0x1001
552//ZZ #define VKI_ARCH_SET_FS 0x1002
553//ZZ #define VKI_ARCH_GET_FS 0x1003
554//ZZ #define VKI_ARCH_GET_GS 0x1004
555//ZZ
556//ZZ //----------------------------------------------------------------------
557//ZZ // From linux-2.6.9/include/asm-x86_64/ldt.h
558//ZZ //----------------------------------------------------------------------
559//ZZ
560//ZZ // I think this LDT stuff will have to be reinstated for amd64, but I'm not
561//ZZ // certain.  (Nb: The sys_arch_prctl seems to have replaced
562//ZZ // [gs]et_thread_area syscalls.)
563//ZZ //
564//ZZ // Note that the type here is very slightly different to the
565//ZZ // type for x86 (the final 'lm' field is added);  I'm not sure about the
566//ZZ // significance of that... --njn
567//ZZ
568//ZZ /* [[Nb: This is the structure passed to the modify_ldt syscall.  Just so as
569//ZZ    to confuse and annoy everyone, this is _not_ the same as an
570//ZZ    VgLdtEntry and has to be translated into such.  The logic for doing
571//ZZ    so, in vg_ldt.c, is copied from the kernel sources.]] */
572//ZZ /* Note also that a comment in ldt.h indicates that the below
573//ZZ    contains several fields ignored on 64bit, and that modify_ldt
574//ZZ    is rather for 32bit. */
575//ZZ struct vki_user_desc {
576//ZZ 	unsigned int  entry_number;
577//ZZ 	unsigned long base_addr;
578//ZZ 	unsigned int  limit;
579//ZZ 	unsigned int  seg_32bit:1;
580//ZZ 	unsigned int  contents:2;
581//ZZ 	unsigned int  read_exec_only:1;
582//ZZ 	unsigned int  limit_in_pages:1;
583//ZZ 	unsigned int  seg_not_present:1;
584//ZZ 	unsigned int  useable:1;
585//ZZ         unsigned int  lm:1;
586//ZZ };
587//ZZ
588//ZZ // [[Nb: for our convenience within Valgrind, use a more specific name]]
589
590typedef char vki_modify_ldt_t;
591
592//----------------------------------------------------------------------
593// From linux-3.10.5/include/asm-generic/ipcbuf.h
594//----------------------------------------------------------------------
595
596struct vki_ipc64_perm
597{
598	__vki_kernel_key_t	key;
599	__vki_kernel_uid32_t	uid;
600	__vki_kernel_gid32_t	gid;
601	__vki_kernel_uid32_t	cuid;
602	__vki_kernel_gid32_t	cgid;
603	__vki_kernel_mode_t	mode;
604        unsigned char           __pad1[4 - sizeof(__vki_kernel_mode_t)];
605	unsigned short		seq;
606	unsigned short		__pad2;
607	unsigned long		__unused1;
608	unsigned long		__unused2;
609};
610
611//----------------------------------------------------------------------
612// From linux-3.10.5/include/uapi/asm-generic/sembuf.h
613//----------------------------------------------------------------------
614
615struct vki_semid64_ds {
616	struct vki_ipc64_perm sem_perm;		/* permissions .. see ipc.h */
617	__vki_kernel_time_t	sem_otime;		/* last semop time */
618	__vki_kernel_time_t	sem_ctime;		/* last change time */
619	unsigned long	sem_nsems;		/* no. of semaphores in array */
620	unsigned long	__unused3;
621	unsigned long	__unused4;
622};
623
624//----------------------------------------------------------------------
625// From linux-3.10.5/include/uapi/asm-generic/msgbuf.h
626//----------------------------------------------------------------------
627
628struct vki_msqid64_ds {
629	struct vki_ipc64_perm msg_perm;
630	__vki_kernel_time_t msg_stime;	/* last msgsnd time */
631	__vki_kernel_time_t msg_rtime;	/* last msgrcv time */
632	__vki_kernel_time_t msg_ctime;	/* last change time */
633	unsigned long  msg_cbytes;	/* current number of bytes on queue */
634	unsigned long  msg_qnum;	/* number of messages in queue */
635	unsigned long  msg_qbytes;	/* max number of bytes on queue */
636	__vki_kernel_pid_t msg_lspid;	/* pid of last msgsnd */
637	__vki_kernel_pid_t msg_lrpid;	/* last receive pid */
638	unsigned long  __unused4;
639	unsigned long  __unused5;
640};
641
642//----------------------------------------------------------------------
643// From linux-3.10.5/include/uapi/asm-generic/shmbuf.h
644//----------------------------------------------------------------------
645
646struct vki_shmid64_ds {
647	struct vki_ipc64_perm	shm_perm;	/* operation perms */
648	vki_size_t		shm_segsz;	/* size of segment (bytes) */
649	__vki_kernel_time_t	shm_atime;	/* last attach time */
650	__vki_kernel_time_t	shm_dtime;	/* last detach time */
651	__vki_kernel_time_t	shm_ctime;	/* last change time */
652	__vki_kernel_pid_t	shm_cpid;	/* pid of creator */
653	__vki_kernel_pid_t	shm_lpid;	/* pid of last operator */
654	unsigned long		shm_nattch;	/* no. of current attaches */
655	unsigned long		__unused4;
656	unsigned long		__unused5;
657};
658
659struct vki_shminfo64 {
660	unsigned long	shmmax;
661	unsigned long	shmmin;
662	unsigned long	shmmni;
663	unsigned long	shmseg;
664	unsigned long	shmall;
665	unsigned long	__unused1;
666	unsigned long	__unused2;
667	unsigned long	__unused3;
668	unsigned long	__unused4;
669};
670
671//----------------------------------------------------------------------
672// From linux-3.9.9/arch/arm64/include/asm/ptrace.h
673//----------------------------------------------------------------------
674
675#define VKI_PTRACE_GETREGS            12
676#define VKI_PTRACE_SETREGS            13
677//#define VKI_PTRACE_GETFPREGS          14
678//#define VKI_PTRACE_SETFPREGS          15
679
680//----------------------------------------------------------------------
681// From linux-2.6.8.1/include/asm-generic/errno.h
682//----------------------------------------------------------------------
683
684#define	VKI_ENOSYS       38  /* Function not implemented */
685#define	VKI_EOVERFLOW    75  /* Value too large for defined data type */
686
687//----------------------------------------------------------------------
688// From linux-3.19.0/include/uapi/asm-generic/ioctls.h
689//----------------------------------------------------------------------
690
691#define VKI_TIOCGSERIAL     0x541E
692#define VKI_TIOCSSERIAL     0x541F
693
694//----------------------------------------------------------------------
695// And that's it!
696//----------------------------------------------------------------------
697
698#endif // __VKI_ARM64_LINUX_H
699
700/*--------------------------------------------------------------------*/
701/*--- end                                                          ---*/
702/*--------------------------------------------------------------------*/
703