1
2/*--------------------------------------------------------------------*/
3/*--- Solaris-specific syscalls stuff.      priv_syswrap-solaris.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7   This file is part of Valgrind, a dynamic binary instrumentation
8   framework.
9
10   Copyright (C) 2011-2017 Petr Pavlu
11      setup@dagobah.cz
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 __PRIV_SYSWRAP_SOLARIS_H
32#define __PRIV_SYSWRAP_SOLARIS_H
33
34#include "pub_core_basics.h"        // VG_ macro
35#include "priv_types_n_macros.h"    // DECL_TEMPLATE
36#include "pub_core_tooliface.h"     // CorePart
37
38/* Macro to join a syscall name with a syscall variant. */
39#define SC2(name, subname) \
40   name "_" subname
41
42/* Macro to join a syscall name with its variant and sub-variant. */
43#define SC3(name, subname, subsubname) \
44   name "_" subname "_" subsubname
45
46extern void ML_(call_on_new_stack_0_1)(Addr stack, Addr retaddr,
47                                       void (*f)(Word), Word arg1);
48extern Word ML_(start_thread_NORETURN)(void *arg);
49extern Addr ML_(allocstack)           (ThreadId tid);
50extern void ML_(setup_start_thread_context)(ThreadId tid, vki_ucontext_t *uc);
51
52extern UInt ML_(fletcher32)(UShort *buf, SizeT blocks);
53extern ULong ML_(fletcher64)(UInt *buf, SizeT blocks);
54extern void ML_(save_machine_context)(ThreadId tid, vki_ucontext_t *uc,
55                                      CorePart part);
56extern void ML_(restore_machine_context)(ThreadId tid, vki_ucontext_t *uc,
57                                         CorePart part, Bool esp_is_thrptr);
58
59#if defined(VGP_x86_solaris)
60
61extern void ML_(setup_gdt)(VexGuestX86State *vex);
62extern void ML_(cleanup_gdt)(VexGuestX86State *vex);
63extern void ML_(update_gdt_lwpgs)(ThreadId tid);
64
65/* prototypes */
66DECL_TEMPLATE(x86_solaris, sys_fstatat64);
67DECL_TEMPLATE(x86_solaris, sys_openat64);
68DECL_TEMPLATE(x86_solaris, sys_llseek32);
69DECL_TEMPLATE(x86_solaris, sys_mmap64);
70DECL_TEMPLATE(x86_solaris, sys_stat64);
71DECL_TEMPLATE(x86_solaris, sys_lstat64);
72DECL_TEMPLATE(x86_solaris, sys_fstat64);
73DECL_TEMPLATE(x86_solaris, sys_statvfs64);
74DECL_TEMPLATE(x86_solaris, sys_fstatvfs64);
75DECL_TEMPLATE(x86_solaris, sys_setrlimit64);
76DECL_TEMPLATE(x86_solaris, sys_getrlimit64);
77DECL_TEMPLATE(x86_solaris, sys_pread64);
78DECL_TEMPLATE(x86_solaris, sys_pwrite64);
79DECL_TEMPLATE(x86_solaris, sys_open64);
80
81#elif defined(VGP_amd64_solaris)
82/* Nothing yet. */
83
84#else
85#  error "Unknown platform"
86#endif
87
88#endif   // __PRIV_SYSWRAP_SOLARIS_H
89
90/*--------------------------------------------------------------------*/
91/*--- end                                                          ---*/
92/*--------------------------------------------------------------------*/
93