[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4693D183.9060604@zytor.com>
Date: Tue, 10 Jul 2007 11:35:47 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Jan Engelhardt <jengelh@...putergmbh.de>
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.
Jan Engelhardt wrote:
> 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];
BZZT, wrong. repz cmpsb is memcmp(), not strcmp(). The reason is
simply that memset and memcpy are in assembly is that they are simple
wrappers around string instructions, plus the need to provide the
other-segment copy functions -- it was cleaner to do them as an assembly
file.
This is not the case for strcmp(), nor for any other string functions
that may want to be used in the future.
> Would perhaps using __builtin_memset
> and whatever GCC provides also work in 16-bit mode (would save
> implementing it again).
Nope. The builtins not only vary between gcc versions, but they also
have a nasty tendency to generate calls to library functions, sometimes
libgcc functions. Hence -ffreestanding.
>> +/*
>> + * arch/i386/boot/string.c
>> + *
>> + * Very basic string functions
>> + */
>> +
>> +#include "boot.h"
>> +#include <linux/edd.h>
>
> What's edd good for here?
It's a copy-and-paste accident; already fixed in the tree.
-hpa
-
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