Re: [x86 setup 16/33] String-handling functions for the new x86 setup code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux