Home | History | Annotate | Download | only in x86
      1 		# many thanks to David Fang
      2 		# for providing an OSX 10.5 machine to test on
      3 
      4      	     # count for 1 million instructions
      5 	     #   total is 1 + 1 + 499997*2 + 4
      6 
      7 	.globl _start
      8 _start:
      9 	xor	%ecx,%ecx		# not needed, pads total to 1M
     10 	mov	$499997,%ecx		# load counter
     11 test_loop:
     12 	dec	%ecx			# repeat count times
     13 	jnz	test_loop
     14 
     15 	#================================
     16 	# Exit
     17 	#================================
     18 
     19 	# syscall numbers in /usr/include/sys/syscall.h on OSX
     20 	#                 in arc/x86/include/asm/unistd_32.h on Linux
     21 	# disassemble on OSX otool -tV
     22 exit:
     23 	xor	%eax,%eax
     24 	inc	%eax	 		# put exit syscall number (1) in eax
     25 #if defined(VGO_darwin)
     26 	pushl	$0			# we return 0
     27 	int     $0x80			# and exit
     28 #elif defined(VGO_linux)
     29 	xor     %ebx,%ebx		# we return 0
     30 	int     $0x80			# and exit
     31 #elif defined(VGO_solaris)
     32 	pushl	$0			# we return 0
     33 	int     $0x91			# and exit
     34 #else
     35 #  error "Unknown OS"
     36 #endif
     37