1/*--------------------------------------------------------------------*/
2/*--- Basic Mach traps.                    mach_traps-x86-darwin.S ---*/
3/*--------------------------------------------------------------------*/
4
5/*
6   This file is part of Valgrind, a dynamic binary instrumentation
7   framework.
8
9   Copyright (C) 2006-2017 Apple Inc.
10      Greg Parker  gparker@apple.com
11
12   This program is free software; you can redistribute it and/or
13   modify it under the terms of the GNU General Public License as
14   published by the Free Software Foundation; either version 2 of the
15   License, or (at your option) any later version.
16
17   This program is distributed in the hope that it will be useful, but
18   WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20   General Public License for more details.
21
22   You should have received a copy of the GNU General Public License
23   along with this program; if not, write to the Free Software
24   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25   02111-1307, USA.
26
27   The GNU General Public License is contained in the file COPYING.
28*/
29
30#include "pub_core_basics_asm.h"
31
32#if defined(VGP_x86_darwin)
33
34// DDD: should use __NR_ constants in here instead of the trap numbers
35// directly!
36
37	// mach_port_name_t task_self_trap(void)
38	.text
39	.align 4
40	.globl _task_self_trap
41_task_self_trap:
42	mov	$-28, %eax
43	int	$0x81
44	ret
45
46	// mach_port_name_t host_self_trap(void)
47	.text
48	.align 4
49	.globl _host_self_trap
50_host_self_trap:
51	mov	$-29, %eax
52	int	$0x81
53	ret
54
55	// mach_port_name_t thread_self_trap(void)
56	.text
57	.align 4
58	.globl _thread_self_trap
59_thread_self_trap:
60	mov	$-27, %eax
61	int	$0x81
62	ret
63
64	// mach_msg_return_t mach_msg_trap(...)
65	.text
66	.align 4
67	.globl _mach_msg_trap
68_mach_msg_trap:
69	mov	$-31, %eax
70	int	$0x81
71	ret
72
73	// mach_port_t mach_reply_port(...)
74	.text
75	.align 4
76	.globl _mach_reply_port
77_mach_reply_port:
78	mov	$-26, %eax
79	int	$0x81
80	ret
81
82	// boolean_t swtch_pri(int)
83	.text
84	.align 4
85	.globl _swtch_pri
86_swtch_pri:
87	mov	$-59, %eax
88	int	$0x81
89	ret
90
91	// kern_return_t semaphore_wait(semaphore_t)
92	.text
93	.align 4
94	.globl _semaphore_wait
95_semaphore_wait:
96	mov	$-36, %eax
97	int	$0x81
98	ret
99
100	// kern_return_t semaphore_signal(semaphore_t)
101	.text
102	.align 4
103	.globl _semaphore_signal
104_semaphore_signal:
105	mov	$-33, %eax
106	int	$0x81
107	ret
108
109	// kern_return_t semaphore_signal_thread(semaphore_t, thread_t)
110	.text
111	.align 4
112	.globl _semaphore_signal_thread
113_semaphore_signal_thread:
114	mov	$-35, %eax
115	int	$0x81
116	ret
117
118	// kern_return_t semaphore_wait_signal(semaphore_t, semaphore_t)
119	.text
120	.align 4
121	.globl _semaphore_wait_signal
122_semaphore_wait_signal:
123	mov	$-37, %eax
124	int	$0x81
125	ret
126
127#endif // defined(VGP_x86_darwin)
128
129/* Let the linker know we don't need an executable stack */
130MARK_STACK_NO_EXEC
131
132/*--------------------------------------------------------------------*/
133/*--- end                                                          ---*/
134/*--------------------------------------------------------------------*/
135