amd64 insn selector: improved handling of Or1/And1 trees.
[valgrind.git] / coregrind / pub_core_syscall.h
blob49b8586a80c68e1ea6185d8308940473fab389b3
2 /*--------------------------------------------------------------------*/
3 /*--- Doing system calls. pub_core_syscall.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2017 Julian Seward
11 jseward@acm.org
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.
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.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_SYSCALL_H
30 #define __PUB_CORE_SYSCALL_H
32 #include "pub_core_basics.h" // VG_ macro
34 //--------------------------------------------------------------------
35 // PURPOSE: This module contains the code for actually executing syscalls.
36 //--------------------------------------------------------------------
38 /* Do a syscall on this platform, with 8 args, and return the result
39 in canonical format in a SysRes value. */
41 // We use a full prototype for VG_(do_syscall) rather than "..." to ensure
42 // that all arguments get converted to a UWord appropriately. Not doing so
43 // can cause problems when passing 32-bit integers on 64-bit platforms,
44 // because the top 32-bits might not be zeroed appropriately, eg. as would
45 // happen with the 6th arg on AMD64 which is passed on the stack.
47 extern SysRes VG_(do_syscall) ( UWord sysno,
48 RegWord, RegWord, RegWord,
49 RegWord, RegWord, RegWord,
50 RegWord, RegWord );
52 /* Macros make life easier. */
54 #define vgPlain_do_syscall0(s) VG_(do_syscall)((s),0,0,0,0,0,0,0,0)
55 #define vgPlain_do_syscall1(s,a) VG_(do_syscall)((s),(a),\
56 0,0,0,0,0,0,0)
57 #define vgPlain_do_syscall2(s,a,b) VG_(do_syscall)((s),(a),(b),\
58 0,0,0,0,0,0)
59 #define vgPlain_do_syscall3(s,a,b,c) VG_(do_syscall)((s),(a),(b),(c),\
60 0,0,0,0,0)
61 #define vgPlain_do_syscall4(s,a,b,c,d) VG_(do_syscall)((s),(a),(b),(c),\
62 (d),0,0,0,0)
63 #define vgPlain_do_syscall5(s,a,b,c,d,e) VG_(do_syscall)((s),(a),(b),(c),\
64 (d),(e),0,0,0)
65 #define vgPlain_do_syscall6(s,a,b,c,d,e,f) VG_(do_syscall)((s),(a),(b),(c),\
66 (d),(e),(f),0,0)
67 #define vgPlain_do_syscall7(s,a,b,c,d,e,f,g) VG_(do_syscall)((s),(a),(b),(c),\
68 (d),(e),(f),(g),0)
69 #define vgPlain_do_syscall8(s,a,b,c,d,e,f,g,h) VG_(do_syscall)((s),(a),(b),(c),\
70 (d),(e),(f),(g),(h))
72 extern SysRes VG_(mk_SysRes_x86_linux) ( Int val );
73 extern SysRes VG_(mk_SysRes_amd64_linux) ( Long val );
74 extern SysRes VG_(mk_SysRes_ppc32_linux) ( UInt val, UInt cr0so );
75 extern SysRes VG_(mk_SysRes_ppc64_linux) ( ULong val, ULong cr0so );
76 extern SysRes VG_(mk_SysRes_arm_linux) ( Int val );
77 extern SysRes VG_(mk_SysRes_arm64_linux) ( Long val );
78 extern SysRes VG_(mk_SysRes_x86_darwin) ( UChar scclass, Bool isErr,
79 UInt wHI, UInt wLO );
80 extern SysRes VG_(mk_SysRes_amd64_darwin)( UChar scclass, Bool isErr,
81 ULong wHI, ULong wLO );
82 extern SysRes VG_(mk_SysRes_s390x_linux) ( Long val );
83 extern SysRes VG_(mk_SysRes_mips32_linux)( UWord v0, UWord v1,
84 UWord a3 );
85 extern SysRes VG_(mk_SysRes_mips64_linux)( ULong v0, ULong v1,
86 ULong a3 );
87 extern SysRes VG_(mk_SysRes_nanomips_linux)( UWord a0);
88 extern SysRes VG_(mk_SysRes_x86_solaris) ( Bool isErr, UInt val, UInt val2 );
89 extern SysRes VG_(mk_SysRes_amd64_solaris) ( Bool isErr, ULong val, ULong val2 );
90 extern SysRes VG_(mk_SysRes_Error) ( UWord val );
91 extern SysRes VG_(mk_SysRes_Success) ( UWord val );
93 #if defined(VGP_mips32_linux) || defined(VGP_mips64_linux) \
94 || defined(VGP_nanomips_linux)
95 /* On Linux/MIPS, VG_(mk_SysRes_Success) sets the second result word
96 to zero. Here is a version that allows setting both values. */
97 extern SysRes VG_(mk_SysRes_SuccessEx) ( UWord val, UWord valEx );
98 #endif
101 /* Return a string which gives the name of an error value. Note,
102 unlike the standard C syserror fn, the returned string is not
103 malloc-allocated or writable -- treat it as a constant. */
105 extern const HChar* VG_(strerror) ( UWord errnum );
108 #endif // __PUB_CORE_SYSCALL_H
110 /*--------------------------------------------------------------------*/
111 /*--- end ---*/
112 /*--------------------------------------------------------------------*/