diff options
author | bencollins <tailor@grayson> | 2003-04-14 03:24:43 -0400 |
---|---|---|
committer | Ben Collins <bcollins@ubuntu.com> | 2006-06-01 13:18:26 -0400 |
commit | e65277d105b1518b08d2989041023937ad345f44 (patch) | |
tree | bb6278974d97d8bd711d5335eecee493fc971ee0 | |
parent | 16ab86b1b368a8c7e6bac27c63d16cd45cab1af6 (diff) | |
download | silo-e65277d105b1518b08d2989041023937ad345f44.tar.gz |
[silo @ 61]
Move some things around. Rock.h goes in include now. rem/sdiv can be
shared in common. Move some things in stringsops to seperate them out.#
-rw-r--r-- | common/Makefile | 3 | ||||
-rw-r--r-- | common/rem.S (renamed from second/rem.S) | 2 | ||||
-rw-r--r-- | common/sdiv.S (renamed from second/sdiv.S) | 2 | ||||
-rw-r--r-- | common/stringops1.c | 38 | ||||
-rw-r--r-- | common/stringops2.c | 39 | ||||
-rw-r--r-- | common/tree.c | 5 | ||||
-rw-r--r-- | include/rock.h (renamed from second/fs/rock.h) | 8 | ||||
-rw-r--r-- | include/stringops.h | 2 | ||||
-rw-r--r-- | second/Makefile | 2 | ||||
-rw-r--r-- | second/disk.c | 2 |
10 files changed, 56 insertions, 47 deletions
diff --git a/common/Makefile b/common/Makefile index 9f914a5..a184716 100644 --- a/common/Makefile +++ b/common/Makefile @@ -10,7 +10,8 @@ include ../Rules.make .S.o: $(CC) $(CFLAGS) -c $*.S -OBJS = udiv.o urem.o jmp.o printf.o console.o prom.o tree.o stringops2.o stringops1.o ffs.o +OBJS = sdiv.o rem.o udiv.o urem.o jmp.o printf.o console.o prom.o tree.o stringops2.o\ + stringops1.o ffs.o PROGRAMS = bin2h all: $(OBJS) $(PROGRAMS) diff --git a/second/rem.S b/common/rem.S index 64b019b..b037334 100644 --- a/second/rem.S +++ b/common/rem.S @@ -1,4 +1,4 @@ -/* $Id: rem.S,v 1.2 2001/06/06 17:04:50 bencollins Exp $ +/* $Id: rem.S,v 1.1 2003/04/14 03:24:43 bencollins Exp $ * rem.S: This routine was taken from glibc-1.09 and is covered * by the GNU Library General Public License Version 2. */ diff --git a/second/sdiv.S b/common/sdiv.S index 3211144..8a12fad 100644 --- a/second/sdiv.S +++ b/common/sdiv.S @@ -1,4 +1,4 @@ -/* $Id: sdiv.S,v 1.2 2001/06/06 17:04:50 bencollins Exp $ +/* $Id: sdiv.S,v 1.1 2003/04/14 03:24:43 bencollins Exp $ * sdiv.S: This routine was taken from glibc-1.09 and is covered * by the GNU Library General Public License Version 2. */ diff --git a/common/stringops1.c b/common/stringops1.c index c74f9f0..08ed4be 100644 --- a/common/stringops1.c +++ b/common/stringops1.c @@ -61,3 +61,41 @@ void *memmove(void *dest,const void *src,size_t count) } return dest; } + +char *strchr(const char *s, int c) +{ + for(; *s != (char) c; ++s) + if (*s == '\0') + return 0; + return (char *) s; +} + +int strlen(const char *s) +{ + const char *sc; + for (sc = s; *sc != '\0'; ++sc); + return sc - s; +} + +int strncmp(const char *cs, const char *ct, size_t count) +{ + register signed char __res = 0; + while (count) { + if ((__res = *cs - *ct++) != 0 || !*cs++) + break; + count--; + } + return __res; +} + +int memcmp(const void *cs, const void *ct, size_t count) +{ + const unsigned char *su1, *su2; + signed char res = 0; + + for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) + if ((res = *su1 - *su2) != 0) + break; + return res; +} + diff --git a/common/stringops2.c b/common/stringops2.c index 761450c..dbb29a1 100644 --- a/common/stringops2.c +++ b/common/stringops2.c @@ -33,25 +33,6 @@ char *strncat(char *dest, const char *src, size_t n) return tmp; } -int strncmp(const char *cs, const char *ct, size_t count) -{ - register signed char __res = 0; - while (count) { - if ((__res = *cs - *ct++) != 0 || !*cs++) - break; - count--; - } - return __res; -} - -char *strchr(const char *s, int c) -{ - for(; *s != (char) c; ++s) - if (*s == '\0') - return 0; - return (char *) s; -} - char * strrchr(const char * s, int c) { const char *p = s + strlen(s); @@ -62,14 +43,6 @@ char * strrchr(const char * s, int c) return 0; } - -int strlen(const char *s) -{ - const char *sc; - for (sc = s; *sc != '\0'; ++sc); - return sc - s; -} - char *strdup(const char *str) { extern void *malloc(int); @@ -103,18 +76,6 @@ int strncasecmp(const char *cs,const char *ct,size_t n) return __res; } -__inline__ int memcmp(const void *cs, const void *ct, size_t count) -{ - const unsigned char *su1, *su2; - signed char res = 0; - - for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) - if ((res = *su1 - *su2) != 0) - break; - return res; -} - - char * strstr(const char * s1,const char * s2) { int l1, l2; diff --git a/common/tree.c b/common/tree.c index c4483fd..56da8b8 100644 --- a/common/tree.c +++ b/common/tree.c @@ -1,4 +1,4 @@ -/* $Id: tree.c,v 1.2 2001/06/16 06:35:24 bencollins Exp $ +/* $Id: tree.c,v 1.3 2003/04/14 03:24:43 bencollins Exp $ * tree.c: Basic device tree traversal/scanning for the Linux * prom library. * @@ -145,7 +145,8 @@ int prom_searchsiblings(int node_start, char *nodename) sizeof(promlib_buf)); /* Should this ever happen? */ if(error == -1) continue; - if(strcmp(nodename, promlib_buf)==0) return thisnode; + if (strcmp(nodename, promlib_buf) == 0) + return thisnode; } return 0; diff --git a/second/fs/rock.h b/include/rock.h index 36057b8..7fd78c4 100644 --- a/second/fs/rock.h +++ b/include/rock.h @@ -3,6 +3,14 @@ extensions are present on the disk, and this is fine as long as they all use SUSP */ +#define SIG(A,B) ((A << 8) | B) + +#define CHECK_CE \ + {cont_extent = isonum_733(rr->u.CE.extent); \ + cont_offset = isonum_733(rr->u.CE.offset); \ + cont_size = isonum_733(rr->u.CE.size);} + + struct SU_SP{ unsigned char magic[2]; unsigned char skip; diff --git a/include/stringops.h b/include/stringops.h index 3df17a8..5d113a0 100644 --- a/include/stringops.h +++ b/include/stringops.h @@ -18,8 +18,8 @@ void *memset(void *, int, size_t); void __bzero(void *, size_t); void *memcpy(void *, const void *, size_t); void *memmove(void *, const void *, size_t); +int strlen(const char *s); -/* stringops2.c */ char *strcat(char *, const char *); char *strncat(char *, const char *, size_t); int strncmp(const char *, const char *, size_t); diff --git a/second/Makefile b/second/Makefile index 7285df9..1a16ec7 100644 --- a/second/Makefile +++ b/second/Makefile @@ -40,7 +40,7 @@ OBJS3 = ../common/console.o ../common/printf.o malloc.o ../common/jmp.o \ OBJS4 = main.o OBJS4N = mainnet.o OBJS5 = cmdline.o disk.o file.o misc.o cfg.o strtol.o ranges.o timer.o \ - memory.o fs/libfs.a divdi3.o mul.o rem.o sdiv.o umul.o \ + memory.o fs/libfs.a divdi3.o mul.o ../common/rem.o ../common/sdiv.o umul.o \ ../common/stringops2.o ls.o muldi3.o OBJS = $(OBJS1) $(OBJS2) $(OBJS3) bmark.o $(OBJS4) $(OBJS5) OBJSNET = $(OBJS1) $(OBJS2N) $(OBJS3) bmark.o $(OBJS4N) $(OBJS5) diff --git a/second/disk.c b/second/disk.c index a5c8e4a..637d8e9 100644 --- a/second/disk.c +++ b/second/disk.c @@ -290,7 +290,7 @@ int read (char *buff, int size, unsigned long long offset) if (((romvec->pv_printrev >> 16) < 2 || ((romvec->pv_printrev >> 16) == 2 && (romvec->pv_printrev && 0xffff) < 6)) && offset >= 0x40000000) { - printf ("Buggy old PROMs don't allow reading past 1GB from start of the disk. Send complains to SMCC\n"); + printf ("Buggy old PROMs don't allow reading past 1GB from start of the disk. Send complaints to SMCC\n"); return -1; } } |