	.section	.text
	.intel_syntax
	.global	zstr_len
	.type	zstr_len, @function
zstr_len:
	push	%edi
	mov	%edi, [%esp + 8]	# Address of string to search
	mov	%al, 0
	mov	%ecx, 65535		# Limit search to 65535 bytes
	cld				# Set search direction to up-memory
	repne	scasb			# Search for null (0) in string at %edi
	sub	%edi, [%esp + 8]	# Subtract position from string
	sub	%edi, 1			# Don't count the null byte
	mov	%eax, %edi		# Return the result in %eax
	pop	%edi
	ret
