diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-03-23 17:14:47 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-03-23 17:14:47 +0000 |
commit | 5aecb361f2d546ff790f3fc50f308d086f054543 (patch) | |
tree | 0bd0c877a6bc2500bfe5f76e4272a332ff367a70 /sys/arch | |
parent | 7e37f85873601447a5ddb4cc23df988d09ee2e7d (diff) |
Move wzero() and wcopy() from machdep.c to where they are really used.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc/dev/if_ie.c | 75 | ||||
-rw-r--r-- | sys/arch/sparc/include/cpu.h | 5 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/machdep.c | 72 |
3 files changed, 76 insertions, 76 deletions
diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index c6e15657f30..c8117b5844b 100644 --- a/sys/arch/sparc/dev/if_ie.c +++ b/sys/arch/sparc/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.29 2005/01/15 05:24:10 brad Exp $ */ +/* $OpenBSD: if_ie.c,v 1.30 2005/03/23 17:14:43 miod Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -332,6 +332,9 @@ static void chan_attn_timeout(void *); static void run_tdr(struct ie_softc *, struct ie_tdr_cmd *); static void iestop(struct ie_softc *); +void wzero(void *, u_int); +void wcopy(const void *, void *, u_int); + #ifdef IEDEBUG void print_rbd(volatile struct ie_recv_buf_desc *); @@ -2091,3 +2094,73 @@ print_rbd(rbd) rbd->mbz); } #endif + +void +wzero(vb, l) + void *vb; + u_int l; +{ + u_char *b = vb; + u_char *be = b + l; + u_short *sp; + + if (l == 0) + return; + + /* front, */ + if ((u_long)b & 1) + *b++ = 0; + + /* back, */ + if (b != be && ((u_long)be & 1) != 0) { + be--; + *be = 0; + } + + /* and middle. */ + sp = (u_short *)b; + while (sp != (u_short *)be) + *sp++ = 0; +} + +void +wcopy(vb1, vb2, l) + const void *vb1; + void *vb2; + u_int l; +{ + const u_char *b1e, *b1 = vb1; + u_char *b2 = vb2; + u_short *sp; + int bstore = 0; + + if (l == 0) + return; + + /* front, */ + if ((u_long)b1 & 1) { + *b2++ = *b1++; + l--; + } + + /* middle, */ + sp = (u_short *)b1; + b1e = b1 + l; + if (l & 1) + b1e--; + bstore = (u_long)b2 & 1; + + while (sp < (u_short *)b1e) { + if (bstore) { + b2[1] = *sp & 0xff; + b2[0] = *sp >> 8; + } else + *((short *)b2) = *sp; + sp++; + b2 += 2; + } + + /* and back. */ + if (l & 1) + *b2 = *b1e; +} diff --git a/sys/arch/sparc/include/cpu.h b/sys/arch/sparc/include/cpu.h index 5227cce8606..37ae52d7a88 100644 --- a/sys/arch/sparc/include/cpu.h +++ b/sys/arch/sparc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.23 2004/09/29 07:35:13 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.24 2005/03/23 17:14:45 miod Exp $ */ /* $NetBSD: cpu.h,v 1.24 1997/03/15 22:25:15 pk Exp $ */ /* @@ -256,8 +256,5 @@ struct trapvec { }; extern struct trapvec *trapbase; /* the 256 vectors */ -extern void wzero(void *, u_int); -extern void wcopy(const void *, void *, u_int); - #endif /* _KERNEL */ #endif /* _SPARC_CPU_H_ */ diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 22fc4e63285..693e6725b00 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.103 2005/03/23 17:12:26 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.104 2005/03/23 17:14:46 miod Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -1092,73 +1092,3 @@ caddr_t addr; splx(s); return (res); } - -void -wzero(vb, l) - void *vb; - u_int l; -{ - u_char *b = vb; - u_char *be = b + l; - u_short *sp; - - if (l == 0) - return; - - /* front, */ - if ((u_long)b & 1) - *b++ = 0; - - /* back, */ - if (b != be && ((u_long)be & 1) != 0) { - be--; - *be = 0; - } - - /* and middle. */ - sp = (u_short *)b; - while (sp != (u_short *)be) - *sp++ = 0; -} - -void -wcopy(vb1, vb2, l) - const void *vb1; - void *vb2; - u_int l; -{ - const u_char *b1e, *b1 = vb1; - u_char *b2 = vb2; - u_short *sp; - int bstore = 0; - - if (l == 0) - return; - - /* front, */ - if ((u_long)b1 & 1) { - *b2++ = *b1++; - l--; - } - - /* middle, */ - sp = (u_short *)b1; - b1e = b1 + l; - if (l & 1) - b1e--; - bstore = (u_long)b2 & 1; - - while (sp < (u_short *)b1e) { - if (bstore) { - b2[1] = *sp & 0xff; - b2[0] = *sp >> 8; - } else - *((short *)b2) = *sp; - sp++; - b2 += 2; - } - - /* and back. */ - if (l & 1) - *b2 = *b1e; -} |