Home | History | Annotate | Download | only in m_mach
      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-2012 Apple Inc.
     10       Greg Parker  gparker (at) 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 #if defined(VGP_x86_darwin)
     31 
     32 // DDD: should use __NR_ constants in here instead of the trap numbers
     33 // directly!
     34 
     35 	// mach_port_name_t task_self_trap(void)
     36 	.text
     37 	.align 4
     38 	.globl _task_self_trap
     39 _task_self_trap:
     40 	mov	$-28, %eax
     41 	int	$0x81
     42 	ret
     43 
     44 	// mach_port_name_t host_self_trap(void)
     45 	.text
     46 	.align 4
     47 	.globl _host_self_trap
     48 _host_self_trap:
     49 	mov	$-29, %eax
     50 	int	$0x81
     51 	ret
     52 
     53 	// mach_port_name_t thread_self_trap(void)
     54 	.text
     55 	.align 4
     56 	.globl _thread_self_trap
     57 _thread_self_trap:
     58 	mov	$-27, %eax
     59 	int	$0x81
     60 	ret
     61 
     62 	// mach_msg_return_t mach_msg_trap(...)
     63 	.text
     64 	.align 4
     65 	.globl _mach_msg_trap
     66 _mach_msg_trap:
     67 	mov	$-31, %eax
     68 	int	$0x81
     69 	ret
     70 
     71 	// mach_port_t mach_reply_port(...)
     72 	.text
     73 	.align 4
     74 	.globl _mach_reply_port
     75 _mach_reply_port:
     76 	mov	$-26, %eax
     77 	int	$0x81
     78 	ret
     79 
     80 	// boolean_t swtch_pri(int)
     81 	.text
     82 	.align 4
     83 	.globl _swtch_pri
     84 _swtch_pri:
     85 	mov	$-59, %eax
     86 	int	$0x81
     87 	ret
     88 
     89 	// kern_return_t semaphore_wait(semaphore_t)
     90 	.text
     91 	.align 4
     92 	.globl _semaphore_wait
     93 _semaphore_wait:
     94 	mov	$-36, %eax
     95 	int	$0x81
     96 	ret
     97 
     98 	// kern_return_t semaphore_signal(semaphore_t)
     99 	.text
    100 	.align 4
    101 	.globl _semaphore_signal
    102 _semaphore_signal:
    103 	mov	$-33, %eax
    104 	int	$0x81
    105 	ret
    106 
    107 	// kern_return_t semaphore_signal_thread(semaphore_t, thread_t)
    108 	.text
    109 	.align 4
    110 	.globl _semaphore_signal_thread
    111 _semaphore_signal_thread:
    112 	mov	$-35, %eax
    113 	int	$0x81
    114 	ret
    115 
    116 	// kern_return_t semaphore_wait_signal(semaphore_t, semaphore_t)
    117 	.text
    118 	.align 4
    119 	.globl _semaphore_wait_signal
    120 _semaphore_wait_signal:
    121 	mov	$-37, %eax
    122 	int	$0x81
    123 	ret
    124 
    125 #endif // defined(VGP_x86_darwin)
    126 
    127 /*--------------------------------------------------------------------*/
    128 /*--- end                                                          ---*/
    129 /*--------------------------------------------------------------------*/
    130