lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0707102022400.11053@fbirervta.pbzchgretzou.qr>
Date:	Tue, 10 Jul 2007 20:25:16 +0200 (CEST)
From:	Jan Engelhardt <jengelh@...putergmbh.de>
To:	"H. Peter Anvin" <hpa@...or.com>
cc:	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
	andi@...stfloor.org, akpm@...ux-foundation.org
Subject: Re: [x86 setup 16/33] String-handling functions for the new x86
 setup code.


On Jul 9 2007 19:51, H. Peter Anvin wrote:
>
>strcmp(), memcpy(), memset(), as well as routines to copy to and from
>other segments (as pointed to by fs and gs).

I wonder, strcmp() is the only one not done in assembler.
Is there a particular reason? (Or the other way around, why
is memcpy/memset not C.) The opcode is rep[n]z cmps[bl];

Would perhaps using __builtin_memset
and whatever GCC provides also work in 16-bit mode (would save
implementing it again).

>+/*
>+ * arch/i386/boot/string.c
>+ *
>+ * Very basic string functions
>+ */
>+
>+#include "boot.h"
>+#include <linux/edd.h>

What's edd good for here?

>+int strcmp(const char *str1, const char *str2)
>+{
>+	const unsigned char *s1 = (const unsigned char *)str1;
>+	const unsigned char *s2 = (const unsigned char *)str2;
>+	int delta = 0;
>+
>+	while (*s1 || *s2) {
>+		delta = *s2 - *s1;
>+		if (delta)
>+			return delta;
>+		s1++;
>+		s2++;
>+	}
>+	return 0;
>+}



	Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ