]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/coregrind/pub_core_syscall.h
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / coregrind / pub_core_syscall.h
1
2 /*--------------------------------------------------------------------*/
3 /*--- Doing system calls.                       pub_core_syscall.h ---*/
4 /*--------------------------------------------------------------------*/
5
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9
10    Copyright (C) 2000-2010 Julian Seward
11       jseward@acm.org
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 __PUB_CORE_SYSCALL_H
32 #define __PUB_CORE_SYSCALL_H
33
34 #if defined(VGO_l4re)
35 #include "pub_core_threadstate.h"
36 #include "coregrind/m_syswrap/priv_types_n_macros.h"
37 #include <l4re_helper.h>
38 #endif
39
40 //--------------------------------------------------------------------
41 // PURPOSE: This module contains the code for actually executing syscalls.
42 //--------------------------------------------------------------------
43
44 /* Do a syscall on this platform, with 8 args, and return the result
45    in canonical format in a SysRes value. */
46
47 // We use a full prototype for VG_(do_syscall) rather than "..." to ensure
48 // that all arguments get converted to a UWord appropriately.  Not doing so
49 // can cause problems when passing 32-bit integers on 64-bit platforms,
50 // because the top 32-bits might not be zeroed appropriately, eg. as would
51 // happen with the 6th arg on AMD64 which is passed on the stack.
52
53 extern SysRes VG_(do_syscall) ( UWord sysno, 
54                                 UWord, UWord, UWord, 
55                                 UWord, UWord, UWord, 
56                                 UWord, UWord );
57
58 #if defined(VGO_l4re)
59 extern SysRes VG_(do_l4re_syscall) ( SyscallArgs *args, ThreadId tid);
60 #endif
61
62 /* Macros make life easier. */
63
64 #define vgPlain_do_syscall0(s)             VG_(do_syscall)((s),0,0,0,0,0,0,0,0)
65 #define vgPlain_do_syscall1(s,a)           VG_(do_syscall)((s),(a),\
66                                                            0,0,0,0,0,0,0)
67 #define vgPlain_do_syscall2(s,a,b)         VG_(do_syscall)((s),(a),(b),\
68                                                            0,0,0,0,0,0)
69 #define vgPlain_do_syscall3(s,a,b,c)       VG_(do_syscall)((s),(a),(b),(c),\
70                                                            0,0,0,0,0)
71 #define vgPlain_do_syscall4(s,a,b,c,d)     VG_(do_syscall)((s),(a),(b),(c),\
72                                                            (d),0,0,0,0)
73 #define vgPlain_do_syscall5(s,a,b,c,d,e)   VG_(do_syscall)((s),(a),(b),(c),\
74                                                            (d),(e),0,0,0)
75 #define vgPlain_do_syscall6(s,a,b,c,d,e,f) VG_(do_syscall)((s),(a),(b),(c),\
76                                                            (d),(e),(f),0,0)
77 #define vgPlain_do_syscall7(s,a,b,c,d,e,f,g) VG_(do_syscall)((s),(a),(b),(c),\
78                                                            (d),(e),(f),(g),0)
79 #define vgPlain_do_syscall8(s,a,b,c,d,e,f,g,h) VG_(do_syscall)((s),(a),(b),(c),\
80                                                            (d),(e),(f),(g),(h))
81
82 extern SysRes VG_(mk_SysRes_x86_linux)   ( Int  val );
83 extern SysRes VG_(mk_SysRes_amd64_linux) ( Long val );
84 extern SysRes VG_(mk_SysRes_ppc32_linux) ( UInt  val, UInt  cr0so );
85 extern SysRes VG_(mk_SysRes_ppc64_linux) ( ULong val, ULong cr0so );
86 extern SysRes VG_(mk_SysRes_arm_linux)   ( Int val );
87 extern SysRes VG_(mk_SysRes_ppc32_aix5)  ( UInt val, UInt err );
88 extern SysRes VG_(mk_SysRes_ppc64_aix5)  ( ULong val, ULong err );
89 extern SysRes VG_(mk_SysRes_x86_darwin)  ( UChar scclass, Bool isErr,
90                                            UInt wHI, UInt wLO );
91 extern SysRes VG_(mk_SysRes_amd64_darwin)( UChar scclass, Bool isErr,
92                                            ULong wHI, ULong wLO );
93 extern SysRes VG_(mk_SysRes_x86_l4re)    ( UInt  val );
94 extern SysRes VG_(mk_SysRes_Error)       ( UWord val );
95 extern SysRes VG_(mk_SysRes_Success)     ( UWord val );
96
97
98
99 /* Return a string which gives the name of an error value.  Note,
100    unlike the standard C syserror fn, the returned string is not
101    malloc-allocated or writable -- treat it as a constant. */
102
103 extern const HChar* VG_(strerror) ( UWord errnum );
104
105
106 #endif   // __PUB_CORE_SYSCALL_H
107
108 /*--------------------------------------------------------------------*/
109 /*--- end                                                          ---*/
110 /*--------------------------------------------------------------------*/