Re: 2.1.109 on Alpha UDB

Steven N. Hirsch (shirsch@adelphia.net)
Fri, 17 Jul 1998 20:07:51 -0400 (EDT)


On Fri, 17 Jul 1998, Quant-X Alpha Linux Support wrote:

> Hi Steven !
>
> > memsetw
> > memsetw_io
> >
> > referred to in include/asm-alpha/vga.h are still missing from the kernel
> > sources. And, no, they are not builtins for egcs either. I just
> > downloaded and built the latest pre-1.1 snapshot; no joy.
> >
> > I'd be delighted to pound on it, but I have to be able to build it first.
>
> I've reported this to Linus && Alan for 2 weeks or so.
> I'm sorry because I didn't have a solution for you (and me
> of course, too) ;-(

Ok, I just spent about a half-hour figuring out the intended semantics for
memsetw and memsetw_io. This is what I came up with (building slowly on
my UDB as I speak..).

I'm fairly comfortable with memsetw_io. For the "standard" flavor of
memset, I erred on the side of caution and coded it to (hopefully) handle
counts which do not divide evenly into quadword increments. I'm not sure
if this is necessary.

In keeping with the finest of traditions, this code is completely
untested and may not even compile...

Steve

--- linux/include/asm-alpha/io.h.orig Wed Jun 24 17:30:11 1998
+++ linux/include/asm-alpha/io.h Fri Jul 17 19:53:37 1998
@@ -228,6 +228,8 @@
#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len))
#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len))
#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len))
+#define memsetw_io(addr, c,len) _memsetw_io((u16 *)(addr),(u16)(c),(len))
+#define memsetw(addr, c, len) _memsetw((u16 *)(addr),(u16)(c),(len))

/*
* String versions of in/out ops:
--- linux/arch/alpha/lib/io.c.orig Tue Aug 20 09:57:15 1996
+++ linux/arch/alpha/lib/io.c Fri Jul 17 19:53:50 1998
@@ -399,3 +399,29 @@
dst++;
}
}
+
+void _memsetw_io(u16 *dst, u16 c, unsigned long count)
+{
+ while (count) {
+ count--;
+ _writew(c, dst);
+ dst++;
+ }
+}
+
+void _memsetw(u16 *dst, u16 c, unsigned long count)
+{
+ unsigned long lc = c;
+ unsigned long quadword = lc<<24 | lc<<16 | lc<<8 | lc;
+ unsigned long quadcount = count / 4;
+ unsigned long wordcount = (count % 4) / 2;
+
+ memset(dst, quadword, quadcount);
+ dst += quadcount;
+
+ while (wordcount)
+ {
+ wordcount--;
+ *((u16)dst)++ = c;
+ }
+}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html