Home | History | Annotate | Download | only in m_mach
      1 /*--------------------------------------------------------------------*/
      2 /*--- Basic Mach traps.                  mach_traps-amd64-darwin.S ---*/
      3 /*--------------------------------------------------------------------*/
      4 
      5 /*
      6    This file is part of Valgrind, a dynamic binary instrumentation
      7    framework.
      8 
      9    Copyright (C) 2007-2013 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_amd64_darwin)
     31 
     32 #include "vki/vki-scnums-darwin.h"
     33 
     34 	// mach_port_name_t task_self_trap(void)
     35 	.text
     36 	.align 4
     37 	.globl _task_self_trap
     38 _task_self_trap:
     39 	movq	$__NR_task_self_trap, %rax
     40 	movq	%rcx, %r10
     41 	syscall
     42 	ret
     43 
     44 // DDD: doesn't get used...
     45 //	// mach_port_name_t host_self_trap(void)
     46 //	.text
     47 //	.align 4
     48 //	.globl _host_self_trap
     49 //_host_self_trap:
     50 //	movq	$__NR_host_self_trap, %rax
     51 //	movq	%rcx, %r10
     52 //	syscall
     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 	movq	$__NR_thread_self_trap, %rax
     61 	movq	%rcx, %r10
     62 	syscall
     63 	ret
     64 
     65 	// mach_msg_return_t mach_msg_trap(...)
     66 	.text
     67 	.align 4
     68 	.globl _mach_msg_trap
     69 _mach_msg_trap:
     70 	movq	$__NR_mach_msg_trap, %rax
     71 	movq	%rcx, %r10
     72 	syscall
     73 	ret
     74 
     75 	// mach_port_t mach_reply_port(...)
     76 	.text
     77 	.align 4
     78 	.globl _mach_reply_port
     79 _mach_reply_port:
     80 	movq	$__NR_mach_reply_port, %rax
     81 	movq	%rcx, %r10
     82 	syscall
     83 	ret
     84 
     85 	// boolean_t swtch_pri(int)
     86 	.text
     87 	.align 4
     88 	.globl _swtch_pri
     89 _swtch_pri:
     90 	movq	$__NR_swtch_pri, %rax
     91 	movq	%rcx, %r10
     92 	syscall
     93 	ret
     94 
     95 	// kern_return_t semaphore_wait(semaphore_t)
     96 	.text
     97 	.align 4
     98 	.globl _semaphore_wait
     99 _semaphore_wait:
    100 	movq	$__NR_semaphore_wait_trap, %rax
    101 	movq	%rcx, %r10
    102 	syscall
    103 	ret
    104 
    105 	// kern_return_t semaphore_signal(semaphore_t)
    106 	.text
    107 	.align 4
    108 	.globl _semaphore_signal
    109 _semaphore_signal:
    110 	movq	$__NR_semaphore_signal_trap, %rax
    111 	movq	%rcx, %r10
    112 	syscall
    113 	ret
    114 
    115 	// kern_return_t semaphore_signal_thread(semaphore_t, thread_t)
    116 	.text
    117 	.align 4
    118 	.globl _semaphore_signal_thread
    119 _semaphore_signal_thread:
    120 	movq	$__NR_semaphore_signal_thread_trap, %rax
    121 	movq	%rcx, %r10
    122 	syscall
    123 	ret
    124 
    125 	// kern_return_t semaphore_wait_signal(semaphore_t, semaphore_t)
    126 	.text
    127 	.align 4
    128 	.globl _semaphore_wait_signal
    129 _semaphore_wait_signal:
    130 	movq	$__NR_semaphore_wait_signal_trap, %rax
    131 	movq	%rcx, %r10
    132 	syscall
    133 	ret
    134 
    135 #endif // defined(VGP_amd64_darwin)
    136 
    137 /*--------------------------------------------------------------------*/
    138 /*--- end                                                          ---*/
    139 /*--------------------------------------------------------------------*/
    140