Home | History | Annotate | Download | only in tests
      1 	;; library functions for rdtmain - test of rdx linking and execution
      2 
      3 	;; library function = _strcmp, defined as in C
      4 
      5 [SECTION .text]
      6 [BITS 32]
      7 
      8 [GLOBAL _strcmp]
      9 _strcmp:
     10 	push ebp
     11 	mov ebp,esp
     12 
     13 	;; ebp+8 = first paramater, ebp+12 = second
     14 
     15 	mov esi,[ebp+8]
     16 	mov edi,[ebp+12]
     17 
     18 .loop:
     19 	mov cl,byte [esi]
     20 	mov dl,byte [edi]
     21 	cmp cl,dl
     22 	jb .below
     23 	ja .above
     24 	or cl,cl
     25 	jz .match
     26 	inc esi
     27 	inc edi
     28 	jmp .loop
     29 
     30 .below:	
     31 	mov eax,-1
     32 	pop ebp
     33 	ret
     34 	
     35 .above:
     36 	mov eax,1
     37 	pop ebp
     38 	ret
     39 
     40 .match:
     41 	xor eax,eax
     42 	pop ebp
     43 	ret
     44 
     45 [SECTION .data]
     46 [GLOBAL _message]
     47 
     48 _message:	db 'hello',0