Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Sep 2006 17:34:39 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 106158 for review
Message-ID:  <200609151734.k8FHYdlQ021772@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106158

Change 106158 by imp@imp_lighthouse on 2006/09/15 17:33:51

	Migrate more functions into their own file.  This helps get another
	48 bytes from boot2

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#21 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#22 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#30 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#19 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/memcmp.c#1 add
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/memcpy.c#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/memset.c#1 add
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/p_string.c#13 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/strcmp.c#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/strcpy.c#1 add

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#21 (text+ko) ====

@@ -243,7 +243,7 @@
 
     /* Present the user with the boot2 prompt. */
 
-    p_strcpy(kname, PATH_KERNEL);
+    strcpy(kname, PATH_KERNEL);
     for (;;) {
 	printf("\nDefault: %s\nboot: ", kname);
 	if (!autoboot || (c = getc(2)) != -1)

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#22 (text+ko) ====

@@ -5,8 +5,9 @@
 LIB=		at91
 INTERNALLIB=
 SRCS=at91rm9200_lowlevel.c delay.c eeprom.c emac.c emac_init.c fpga.c getc.c \
-	p_string.c putchar.c printf.c reset.c spi_flash.c xmodem.c \
-	sd-card.c mci_device.c strcvt.c strlen.c
+	putchar.c printf.c reset.c spi_flash.c xmodem.c \
+	sd-card.c mci_device.c strcvt.c strlen.c strcmp.c memcpy.c strcpy.c \
+	memset.c memcmp.c
 SRCS+=ashldi3.c divsi3.S
 NO_MAN=
 

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#30 (text+ko) ====

@@ -176,8 +176,8 @@
 
 	cPtr = (char*)&(tftpHeader.block_num);
 
-	ePtr = p_strcpy(cPtr, filename);
-	mPtr = p_strcpy(ePtr, "octet");
+	ePtr = strcpy(cPtr, filename);
+	mPtr = strcpy(ePtr, "octet");
 
 	length = mPtr - cPtr;
 	length += 2;

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#19 (text) ====

@@ -57,7 +57,7 @@
 
 void p_memset(char *buffer, char value, int size);
 int p_strlen(const char *buffer);
-char *p_strcpy(char *to, const char *from);
+char *strcpy(char *to, const char *from);
 void memcpy(void *to, const void *from, unsigned size);
 int p_memcmp(const char *to, const char *from, unsigned size);
 int strcmp(const char *to, const char *from);

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/memcpy.c#2 (text+ko) ====

@@ -1,61 +1,6 @@
-/******************************************************************************
- *
- * Filename: p_string.c
- *
- * Instantiation of basic string operations to prevent inclusion of full
- * string library.  These are simple implementations not necessarily optimized
- * for speed, but rather to show intent.
- *
- * Revision information:
- *
- * 20AUG2004	kb_admin	initial creation
- * 12JAN2005	kb_admin	minor updates
- *
- * BEGIN_KBDD_BLOCK
- * No warranty, expressed or implied, is included with this software.  It is
- * provided "AS IS" and no warranty of any kind including statutory or aspects
- * relating to merchantability or fitness for any purpose is provided.  All
- * intellectual property rights of others is maintained with the respective
- * owners.  This software is not copyrighted and is intended for reference
- * only.
- * END_BLOCK
- *
- * $FreeBSD: src/sys/boot/arm/at91/libat91/p_string.c,v 1.2 2006/08/10 18:07:49 imp Exp $
- *****************************************************************************/
-
 #include "lib.h"
 
-/*
- * .KB_C_FN_DEFINITION_START
- * void p_memset(char *buffer, char value, int size)
- *  This global function sets memory at the pointer for the specified
- * number of bytes to value.
- * .KB_C_FN_DEFINITION_END
- */
 void
-p_memset(char *buffer, char value, int size)
-{
-	while (size--)
-		*buffer++ = value;
-}
-
-/*
- * .KB_C_FN_DEFINITION_START
- * char *p_strcpy(char *to, char *from)
- *  This global function returns a pointer to the end of the destination string
- * after the copy operation (after the '/0').
- * .KB_C_FN_DEFINITION_END
- */
-char *
-p_strcpy(char *to, const char *from)
-{
-	while (*from)
-		*to++ = *from++;
-	*to++ = '\0';
-	return (to);
-}
-
-void
 memcpy(void *dst, const void *src, unsigned len)
 {
     const char *s = src;
@@ -64,35 +9,3 @@
     while (len--)
         *d++ = *s++;
 }
-
-/*
- * .KB_C_FN_DEFINITION_START
- * int p_memcmp(char *to, char *from, unsigned size)
- *  This global function compares data at to against data at from for
- * size bytes.  Returns 0 if the locations are equal.  size must be
- * greater than 0.
- * .KB_C_FN_DEFINITION_END
- */
-int
-p_memcmp(const char *to, const char *from, unsigned size)
-{
-	while ((--size) && (*to++ == *from++))
-		continue;
-
-	return (*to != *from);
-}
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * int strcmp(char *to, char *from)
- *  This global function compares string at to against string at from.
- * Returns 0 if the locations are equal.
- * .KB_C_FN_DEFINITION_END
- */
-int
-strcmp(const char *s1, const char *s2)
-{
-    for (; *s1 == *s2 && *s1; s1++, s2++);
-    return (unsigned char)*s1 - (unsigned char)*s2;
-}

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/p_string.c#13 (text+ko) ====

@@ -41,32 +41,6 @@
 
 /*
  * .KB_C_FN_DEFINITION_START
- * char *p_strcpy(char *to, char *from)
- *  This global function returns a pointer to the end of the destination string
- * after the copy operation (after the '/0').
- * .KB_C_FN_DEFINITION_END
- */
-char *
-p_strcpy(char *to, const char *from)
-{
-	while (*from)
-		*to++ = *from++;
-	*to++ = '\0';
-	return (to);
-}
-
-void
-memcpy(void *dst, const void *src, unsigned len)
-{
-    const char *s = src;
-    char *d = dst;
-
-    while (len--)
-        *d++ = *s++;
-}
-
-/*
- * .KB_C_FN_DEFINITION_START
  * int p_memcmp(char *to, char *from, unsigned size)
  *  This global function compares data at to against data at from for
  * size bytes.  Returns 0 if the locations are equal.  size must be
@@ -81,18 +55,3 @@
 
 	return (*to != *from);
 }
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * int strcmp(char *to, char *from)
- *  This global function compares string at to against string at from.
- * Returns 0 if the locations are equal.
- * .KB_C_FN_DEFINITION_END
- */
-int
-strcmp(const char *s1, const char *s2)
-{
-    for (; *s1 == *s2 && *s1; s1++, s2++);
-    return (unsigned char)*s1 - (unsigned char)*s2;
-}

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/strcmp.c#2 (text+ko) ====

@@ -1,95 +1,5 @@
-/******************************************************************************
- *
- * Filename: p_string.c
- *
- * Instantiation of basic string operations to prevent inclusion of full
- * string library.  These are simple implementations not necessarily optimized
- * for speed, but rather to show intent.
- *
- * Revision information:
- *
- * 20AUG2004	kb_admin	initial creation
- * 12JAN2005	kb_admin	minor updates
- *
- * BEGIN_KBDD_BLOCK
- * No warranty, expressed or implied, is included with this software.  It is
- * provided "AS IS" and no warranty of any kind including statutory or aspects
- * relating to merchantability or fitness for any purpose is provided.  All
- * intellectual property rights of others is maintained with the respective
- * owners.  This software is not copyrighted and is intended for reference
- * only.
- * END_BLOCK
- *
- * $FreeBSD: src/sys/boot/arm/at91/libat91/p_string.c,v 1.2 2006/08/10 18:07:49 imp Exp $
- *****************************************************************************/
-
 #include "lib.h"
 
-/*
- * .KB_C_FN_DEFINITION_START
- * void p_memset(char *buffer, char value, int size)
- *  This global function sets memory at the pointer for the specified
- * number of bytes to value.
- * .KB_C_FN_DEFINITION_END
- */
-void
-p_memset(char *buffer, char value, int size)
-{
-	while (size--)
-		*buffer++ = value;
-}
-
-/*
- * .KB_C_FN_DEFINITION_START
- * char *p_strcpy(char *to, char *from)
- *  This global function returns a pointer to the end of the destination string
- * after the copy operation (after the '/0').
- * .KB_C_FN_DEFINITION_END
- */
-char *
-p_strcpy(char *to, const char *from)
-{
-	while (*from)
-		*to++ = *from++;
-	*to++ = '\0';
-	return (to);
-}
-
-void
-memcpy(void *dst, const void *src, unsigned len)
-{
-    const char *s = src;
-    char *d = dst;
-
-    while (len--)
-        *d++ = *s++;
-}
-
-/*
- * .KB_C_FN_DEFINITION_START
- * int p_memcmp(char *to, char *from, unsigned size)
- *  This global function compares data at to against data at from for
- * size bytes.  Returns 0 if the locations are equal.  size must be
- * greater than 0.
- * .KB_C_FN_DEFINITION_END
- */
-int
-p_memcmp(const char *to, const char *from, unsigned size)
-{
-	while ((--size) && (*to++ == *from++))
-		continue;
-
-	return (*to != *from);
-}
-
-
-/*
- * .KB_C_FN_DEFINITION_START
- * int strcmp(char *to, char *from)
- *  This global function compares string at to against string at from.
- * Returns 0 if the locations are equal.
- * .KB_C_FN_DEFINITION_END
- */
 int
 strcmp(const char *s1, const char *s2)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609151734.k8FHYdlQ021772>