Re: Weirdnes!

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Mon, 6 Oct 1997 12:17:31 +0200


On Oct 06, Martynas Kunigelis wrote:

> I have noticed that SVGAlib programs lock my system with a 430FX chipset
> and a 2MB S3 Trio64V+. All I get is a blank screen and a locked machine
> (not just the console!). I thought it was an SVGAlib problem first, but my
> friend has a 99% identical system (same mobo, same CPU, same video card,
> same amount of mem, same kernel etc.) and SVGAlib works on his machine!
> I tracked down the code that triggers the lockup. Boy is it weird! Here it
> is:
>
> void main()
> {
> int fd, i;
> char *mem;
>
> fd = open("/dev/mem", O_RDWR);
>
> /* map the last page of video RAM */
> mem = mmap(0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xbf000);
>
> for (i = 0; i < 0x1000; i++)
> mem[i] = 0;
>
> /* NOTE: no lockup so far! */
>
> memset(mem, 0, 0x1000); /* TOTAL MACHINE LOCKUP!!! */
> }
>
> Gosh, just how on earth is the 'for' loop different from memset in
> functionality?

memset() uses optimized 32bit access whereas your for-loop does byte accesses.

> Do I have faulty hardware?

maybe

> DOS, Windows and the XFree86 S3
> server all work w/o problems. The kernel is 2.1.57, but earlier 2.1.x and
> even 2.0.x behave the same.

DOS and WinXY probably don't use 32bit access and at least XFree86 and
probably Win use the S3 chip in "enhanced" mode where DRAM access is
pretty different (and maybe don't cause lockups like in text mode)...

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^