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 #ifdef VGO_darwin
     24 	pushl   $0			# we return 0
     25 	xor	%eax,%eax
     26 	inc	%eax	 		# put exit syscall number (1) in eax
     27 	int     $0x80             	# and exit
     28 #else
     29 	xor     %ebx,%ebx		# we return 0
     30 	xor	%eax,%eax
     31 	inc	%eax	 		# put exit syscall number (1) in eax
     32 	int     $0x80             	# and exit
     33 #endif
     34