Add DRD suppression patterns for races triggered by std::ostream
[valgrind.git] / coregrind / m_mach / mach_basics.c
blobbabcd65e99dca98daf874f0bb134bf2bf79f9eda
2 /*--------------------------------------------------------------------*/
3 /*--- Basic Mach interface functions mach_basics.c ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2005-2017 Apple Inc.
11 Greg Parker gparker@apple.com
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, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
28 The GNU General Public License is contained in the file COPYING.
31 #if defined(VGO_darwin)
33 #include "pub_core_basics.h"
34 #include "pub_core_mach.h"
36 #include <mach/mach.h>
37 #include <mach/machine/ndr_def.h>
39 /* From mach_traps-<arch>-darwin.S */
40 //extern mach_port_name_t host_self_trap(void);
41 extern mach_port_name_t thread_self_trap(void);
42 extern mach_port_t mach_reply_port(void);
44 /* Global variables set in mach_init() */
45 vm_size_t vm_page_size = 0;
46 mach_port_name_t mach_task_self_ = 0;
49 mach_port_name_t mach_thread_self(void)
51 return thread_self_trap();
54 static mach_port_t reply = 0;
56 mach_port_t mig_get_reply_port(void)
58 if (!reply) reply = mach_reply_port();
59 return reply;
60 // GrP fixme is just one enough for valgrind's own use?
61 // might work if valgrind never blocks in mig calls on
62 // its own behalf, and doesn't call mig outside the semaphore
66 void mig_dealloc_reply_port(mach_port_t reply_port)
71 void mig_put_reply_port(mach_port_t reply_port)
76 /* Initialize Mach global data.
77 Should be called early in main(). */
78 void VG_(mach_init)(void)
80 reply = 0;
81 mach_task_self_ = task_self_trap();
83 // GrP fixme host_page_size(host_self_trap(), &vm_page_size);
84 vm_page_size = 4096;
87 #endif // defined(VGO_darwin)
89 /*--------------------------------------------------------------------*/
90 /*--- end ---*/
91 /*--------------------------------------------------------------------*/