Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* bug in fbmem.c,
@ 1999-06-22  8:57 Vignaud Jean-Baptiste
       [not found] ` <3770E2AF.4BC00019@pobox.com>
       [not found] ` <376F7E90.B2646D23@pobox.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Vignaud Jean-Baptiste @ 1999-06-22  8:57 UTC (permalink / raw)
  To: axp-list, FrameBuffer; +Cc: Linux kernel, Bibek Sahu, Adam C. Powell IV

Hi,

I'v traced a little bug in the fbmem code. i don't know if it's the right
way to
correct it, but on my SX164 alpha this seems to work.

before the patch: cat /dev/fb0 > foo end with an execption.
after the patch: cat /dev/fb0 > foo ; cat foo > /dev/fb0 work.

There are others problems with the fbdriver on alpha:
mmapping the /dev/fb0 and writing to it give me a *RANDOM* 'PYXIS machine
check NOT expected'
with no effect on the screen.
Maybe someone have an idea?


Jean-Baptiste Vignaud.

--- fbmem.c     Wed Mar 17 18:17:22 1999
+++ fbmem.c.new Tue Jun 22 11:04:03 1999
@@ -30,7 +30,7 @@
 #if defined(__mc68000__) || defined(CONFIG_APUS)
 #include <asm/setup.h>
 #endif
-#ifdef __powerpc__
+#if defined(__powerpc__) || defined(__alpha__)
 #include <asm/io.h>
 #endif
 #include <asm/uaccess.h>
@@ -251,8 +251,7 @@
        fb->fb_get_fix(&fix,PROC_CONSOLE(), info);
        base_addr=info->disp->screen_base;
        copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
-       if (copy_to_user(buf, base_addr+p, copy_size))
-           return -EFAULT;
+       memcpy_fromio(buf, base_addr+p, copy_size);
        *ppos += copy_size;
        return copy_size;
 }
@@ -275,8 +274,7 @@
        fb->fb_get_fix(&fix, PROC_CONSOLE(), info);
        base_addr=info->disp->screen_base;
        copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
-       if (copy_from_user(base_addr+p, buf, copy_size))
-           return -EFAULT;
+       memcpy_toio(base_addr+p, buf, copy_size);
        file->f_pos += copy_size;
        return copy_size;
 }



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug in fbmem.c,
       [not found] ` <3770E2AF.4BC00019@pobox.com>
@ 1999-06-28 19:55   ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 1999-06-28 19:55 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Vignaud Jean-Baptiste, axp-list, FrameBuffer, Linux kernel,
	Bibek Sahu, Adam C. Powell IV

On Wed, Jun 23, 1999 at 09:35:43AM -0400, Jeff Garzik wrote:
> +	if (copy_size > 0) {
> +		char tmpbuf [copy_size];

You can't do dynamic stack allocation in the kernel.
You'll have to use kmalloc or get_free_page or something.


r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-fbdev] Re: bug in fbmem.c,
       [not found] ` <376F7E90.B2646D23@pobox.com>
@ 1999-07-08 17:46   ` Jes Sorensen
  1999-07-08 17:46     ` Jes Sorensen
  0 siblings, 1 reply; 4+ messages in thread
From: Jes Sorensen @ 1999-07-08 17:46 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Vignaud Jean-Baptiste, axp-list, FrameBuffer, Linux kernel,
	Bibek Sahu, Adam C. Powell IV

>>>>> "Jeff" == Jeff Garzik <jgarzik@pobox.com> writes:

Jeff> Vignaud Jean-Baptiste wrote:
>> I'v traced a little bug in the fbmem code. i don't know if it's the
>> right way to correct it, but on my SX164 alpha this seems to work.

Jeff> Good catch!  I guess I shouldn't only use the sight of a penguin
Jeff> and running XF86_FBDev as tests.  ;-)

Jeff> You cannot eliminate the copy_to_user() and copy_from_user()
Jeff> calls.  I don't recall what type of addresses copy_xxx_user()
Jeff> wants, but I suspect you either need a copy buffer

Jeff> 	memcpy_fromio (bufruf, base_addr+p, copy_size); if
Jeff> (copy_to_user(buf, bufruf, copy_size)) ...

Jeff> or maybe you can get away with some variant of

Jeff> 	if (copy_to_user(buf, __phys_to_virt (base_addr+p), copy_size)
Jeff> ...

You generally cannot apply phys_to_virt to frame buffer memory
addresses, you are not guaranteed a 1->1 mapping of it.

Jes


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-fbdev] Re: bug in fbmem.c,
  1999-07-08 17:46   ` [linux-fbdev] " Jes Sorensen
@ 1999-07-08 17:46     ` Jes Sorensen
  0 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 1999-07-08 17:46 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Vignaud Jean-Baptiste, axp-list, FrameBuffer, Linux kernel,
	Bibek Sahu, Adam C. Powell IV


>>>>> "Jeff" == Jeff Garzik <jgarzik@pobox.com> writes:

Jeff> Vignaud Jean-Baptiste wrote:
>> I'v traced a little bug in the fbmem code. i don't know if it's the
>> right way to correct it, but on my SX164 alpha this seems to work.

Jeff> Good catch!  I guess I shouldn't only use the sight of a penguin
Jeff> and running XF86_FBDev as tests.  ;-)

Jeff> You cannot eliminate the copy_to_user() and copy_from_user()
Jeff> calls.  I don't recall what type of addresses copy_xxx_user()
Jeff> wants, but I suspect you either need a copy buffer

Jeff> 	memcpy_fromio (bufruf, base_addr+p, copy_size); if
Jeff> (copy_to_user(buf, bufruf, copy_size)) ...

Jeff> or maybe you can get away with some variant of

Jeff> 	if (copy_to_user(buf, __phys_to_virt (base_addr+p), copy_size)
Jeff> ...

You generally cannot apply phys_to_virt to frame buffer memory
addresses, you are not guaranteed a 1->1 mapping of it.

Jes

-
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.tux.org/lkml/


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-07-23 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-06-22  8:57 bug in fbmem.c, Vignaud Jean-Baptiste
     [not found] ` <3770E2AF.4BC00019@pobox.com>
1999-06-28 19:55   ` Richard Henderson
     [not found] ` <376F7E90.B2646D23@pobox.com>
1999-07-08 17:46   ` [linux-fbdev] " Jes Sorensen
1999-07-08 17:46     ` Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox