From 1ed239e88a57ca7211745ceff4e0d6e365ca1426 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 30 Apr 2000 18:48:59 +0000 Subject: Add memcpy() and memcmp() emulation by swapping the first 2 args and then calling the b* routine. This code only gets call when the kernel is build w/o -O* since otherwise gcc uses its own inline routines. --- sys/arch/i386/i386/locore.s | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'sys/arch/i386') diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s index 78ff759f110..d02dfe137aa 100644 --- a/sys/arch/i386/i386/locore.s +++ b/sys/arch/i386/i386/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.48 1999/03/08 23:47:26 downsj Exp $ */ +/* $OpenBSD: locore.s,v 1.49 2000/04/30 18:48:58 millert Exp $ */ /* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */ /*- @@ -891,6 +891,32 @@ ENTRY(bcopy) cld ret +/* + * Emulate memcpy() by swapping the first two arguments and calling bcopy() + */ +ENTRY(memcpy) + pushl %esi + movl 12(%esp),%ecx + movl 16(%esp),%esi + movl %esi,12(%esp) + movl %ecx,16(%esp) + call _bcopy + popl %esi + ret + +/* + * Emulate memcmp() by swapping the first two arguments and calling bcmp() + */ +ENTRY(memcmp) + pushl %esi + movl 12(%esp),%ecx + movl 16(%esp),%esi + movl %esi,12(%esp) + movl %ecx,16(%esp) + call _bcmp + popl %esi + ret + /*****************************************************************************/ /* -- cgit v1.2.3