xref: /netbsd-src/sys/lib/libkern/arch/i386/skpc.S (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin/*	$NetBSD: skpc.S,v 1.6 2008/04/28 20:24:06 martin Exp $	*/
2aa9eacddScgd
3df9baf23Smycroft/*-
4df9baf23Smycroft * Copyright (c) 1998 The NetBSD Foundation, Inc.
5df9baf23Smycroft * All rights reserved.
6df9baf23Smycroft *
7df9baf23Smycroft * This code is derived from software contributed to The NetBSD Foundation
8df9baf23Smycroft * by Charles M. Hannum.
9afe588b9Smycroft *
10afe588b9Smycroft * Redistribution and use in source and binary forms, with or without
11afe588b9Smycroft * modification, are permitted provided that the following conditions
12afe588b9Smycroft * are met:
13afe588b9Smycroft * 1. Redistributions of source code must retain the above copyright
14afe588b9Smycroft *    notice, this list of conditions and the following disclaimer.
15afe588b9Smycroft * 2. Redistributions in binary form must reproduce the above copyright
16afe588b9Smycroft *    notice, this list of conditions and the following disclaimer in the
17afe588b9Smycroft *    documentation and/or other materials provided with the distribution.
18afe588b9Smycroft *
19df9baf23Smycroft * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20df9baf23Smycroft * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21df9baf23Smycroft * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22df9baf23Smycroft * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23df9baf23Smycroft * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24df9baf23Smycroft * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25df9baf23Smycroft * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26df9baf23Smycroft * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27df9baf23Smycroft * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28df9baf23Smycroft * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29df9baf23Smycroft * POSSIBILITY OF SUCH DAMAGE.
30afe588b9Smycroft */
31afe588b9Smycroft
32ff171dfbSdrochner#include <machine/asm.h>
33afe588b9Smycroft
34afe588b9SmycroftENTRY(skpc)
35afe588b9Smycroft	pushl	%edi
36afe588b9Smycroft	movl	16(%esp),%edi
37afe588b9Smycroft	movl	12(%esp),%ecx
38afe588b9Smycroft	movl	8(%esp),%eax
39afe588b9Smycroft	cld
40afe588b9Smycroft	repe
41afe588b9Smycroft	scasb
42afe588b9Smycroft	je	1f
43afe588b9Smycroft	incl	%ecx
44afe588b9Smycroft1:
45afe588b9Smycroft	movl	%ecx,%eax
46afe588b9Smycroft	popl	%edi
47afe588b9Smycroft	ret
48