* why volatile on vgacon.c?
@ 2000-11-29 16:24 Santiago Garcia Mantinan
2000-11-29 17:42 ` Vojtech Pavlik
2000-11-29 17:51 ` Andries Brouwer
0 siblings, 2 replies; 4+ messages in thread
From: Santiago Garcia Mantinan @ 2000-11-29 16:24 UTC (permalink / raw)
To: linux-kernel
Hi!
I used to be able to run my 12 ethernet ports pentium based bridge without
vga card, but with tty1, tty2, ... still working, as the kernel used to
recognice a kind of a cga card on my machine even though there was none. But
the kernel could write to the memory were the card was supposed to be, and
so it worked.
That was on 2.2 series, but since I moved it to 2.4 series I don't have that
cga card found anymore. I have looked on the kernel code and followed it to
the __init function in vgacon.c, more concretely this piece of code...
scr_writew(0xAA55, p);
scr_writew(0x55AA, p + 1);
if (scr_readw(p) != 0xAA55 || scr_readw(p + 1) != 0x55AA) {
Well, the thing is that this code and the code in this function is almost
the same in 2.4 as in 2.2, however reading returns the written values on 2.2
and different ones (0xffff) on 2.4
This is caused by the volatile declaration of *p on 2.4, so the questions
are:
was the old (I have found a CGA) behaviour considered a bug and is the
volatile declaration its fix?
If so, is there any way to have /dev/tty1 on a no graphic card i386 machine?
(besides unvolatilizating *p wich works for me)
Regards...
--
Manty/BestiaTester -> http://manty.net
PS: Please cc me, as I'm not on the list.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: why volatile on vgacon.c?
2000-11-29 16:24 why volatile on vgacon.c? Santiago Garcia Mantinan
@ 2000-11-29 17:42 ` Vojtech Pavlik
2000-11-29 17:51 ` Andries Brouwer
1 sibling, 0 replies; 4+ messages in thread
From: Vojtech Pavlik @ 2000-11-29 17:42 UTC (permalink / raw)
To: Santiago Garcia Mantinan; +Cc: linux-kernel
On Wed, Nov 29, 2000 at 05:24:15PM +0100, Santiago Garcia Mantinan wrote:
> Hi!
>
> I used to be able to run my 12 ethernet ports pentium based bridge without
> vga card, but with tty1, tty2, ... still working, as the kernel used to
> recognice a kind of a cga card on my machine even though there was none. But
> the kernel could write to the memory were the card was supposed to be, and
> so it worked.
>
> That was on 2.2 series, but since I moved it to 2.4 series I don't have that
> cga card found anymore. I have looked on the kernel code and followed it to
> the __init function in vgacon.c, more concretely this piece of code...
>
> scr_writew(0xAA55, p);
> scr_writew(0x55AA, p + 1);
> if (scr_readw(p) != 0xAA55 || scr_readw(p + 1) != 0x55AA) {
>
> Well, the thing is that this code and the code in this function is almost
> the same in 2.4 as in 2.2, however reading returns the written values on 2.2
> and different ones (0xffff) on 2.4
>
> This is caused by the volatile declaration of *p on 2.4, so the questions
> are:
>
> was the old (I have found a CGA) behaviour considered a bug and is the
> volatile declaration its fix?
Yes. The compiler was optimizing too much.
> If so, is there any way to have /dev/tty1 on a no graphic card i386 machine?
> (besides unvolatilizating *p wich works for me)
I think you can use serial console instead, if you have serial ports in
the machine.
--
Vojtech Pavlik
SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: why volatile on vgacon.c?
2000-11-29 16:24 why volatile on vgacon.c? Santiago Garcia Mantinan
2000-11-29 17:42 ` Vojtech Pavlik
@ 2000-11-29 17:51 ` Andries Brouwer
2000-12-02 11:20 ` Jeff Garzik
1 sibling, 1 reply; 4+ messages in thread
From: Andries Brouwer @ 2000-11-29 17:51 UTC (permalink / raw)
To: Santiago Garcia Mantinan; +Cc: linux-kernel
On Wed, Nov 29, 2000 at 05:24:15PM +0100, Santiago Garcia Mantinan wrote:
> I used to be able to run my 12 ethernet ports pentium based bridge without
> vga card, but with tty1, tty2, ... still working, as the kernel used to
> recognice a kind of a cga card on my machine even though there was none. But
> the kernel could write to the memory were the card was supposed to be, and
> so it worked.
>
> That was on 2.2 series, but since I moved it to 2.4 series I don't have that
> cga card found anymore. I have looked on the kernel code and followed it to
> the __init function in vgacon.c, more concretely this piece of code...
>
> scr_writew(0xAA55, p);
> scr_writew(0x55AA, p + 1);
> if (scr_readw(p) != 0xAA55 || scr_readw(p + 1) != 0x55AA) {
>
> Well, the thing is that this code and the code in this function is almost
> the same in 2.4 as in 2.2, however reading returns the written values on 2.2
> and different ones (0xffff) on 2.4
Probably without the volatile the compiler optimizes the entire
if statement away because it very well knows that it just wrote
these values there. With the volatile it has to check, and finds
that there is nothing there.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: why volatile on vgacon.c?
2000-11-29 17:51 ` Andries Brouwer
@ 2000-12-02 11:20 ` Jeff Garzik
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2000-12-02 11:20 UTC (permalink / raw)
To: Andries Brouwer; +Cc: Santiago Garcia Mantinan, linux-kernel
On Wed, 29 Nov 2000, Andries Brouwer wrote:
> On Wed, Nov 29, 2000 at 05:24:15PM +0100, Santiago Garcia Mantinan wrote:
> > That was on 2.2 series, but since I moved it to 2.4 series I don't have that
> > cga card found anymore. I have looked on the kernel code and followed it to
> > the __init function in vgacon.c, more concretely this piece of code...
> > scr_writew(0xAA55, p);
> > scr_writew(0x55AA, p + 1);
> > if (scr_readw(p) != 0xAA55 || scr_readw(p + 1) != 0x55AA) {
> > Well, the thing is that this code and the code in this function is almost
> > the same in 2.4 as in 2.2, however reading returns the written values on 2.2
> > and different ones (0xffff) on 2.4
> Probably without the volatile the compiler optimizes the entire
> if statement away because it very well knows that it just wrote
> these values there. With the volatile it has to check, and finds
> that there is nothing there.
hmmm. That's why barriers exist, right?
Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-12-02 11:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-29 16:24 why volatile on vgacon.c? Santiago Garcia Mantinan
2000-11-29 17:42 ` Vojtech Pavlik
2000-11-29 17:51 ` Andries Brouwer
2000-12-02 11:20 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox