Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* vremap and memcpy_to_fs in 2.2.x?
@ 1999-03-31 18:15 AARON MARKS
  1999-04-07  3:26 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: AARON MARKS @ 1999-03-31 18:15 UTC (permalink / raw)
  To: linux-kernel, axp-list

I'm porting a PCI card driver from 2.0.x to 2.2.x -- on an Alpha -- and
I have two questions:

What are the equivalent functions for vremap() and memcpy_to_fs().
From what I can find:

vremap() -> ioremap() However, on an alpha kernel, ioremap just
returns                       the passed-in address. I've tried
phys_to_virt,                       but I'm not sure that it gives me
what vremap did.

memcpy_to_fs -> copy_to_user() I tried this also, but I get a virt
page                                fault.

Thanks,
-A.

-- 
Aaron J. Marks		       Communications and Computing Systems Lab
Assoc. Member Tech Staff       Advanced Networks and Computation Group
amarks@sarnoff.com	       Sarnoff Corporation


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

* Re: vremap and memcpy_to_fs in 2.2.x?
  1999-03-31 18:15 vremap and memcpy_to_fs in 2.2.x? AARON MARKS
@ 1999-04-07  3:26 ` Richard Henderson
  1999-04-07 18:15   ` AARON MARKS
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 1999-04-07  3:26 UTC (permalink / raw)
  To: amarks, linux-kernel, axp-list

On Wed, Mar 31, 1999 at 01:15:21PM -0500, AARON MARKS wrote:
> I'm porting a PCI card driver from 2.0.x to 2.2.x -- on an Alpha -- and
> I have two questions:
> 
> What are the equivalent functions for vremap() and memcpy_to_fs().
> >From what I can find:
> 
> vremap() -> ioremap()

This is correct.

> memcpy_to_fs -> copy_to_user()

This is also correct.

> I tried this also, but I get a virt page fault.

Um..  You weren't by chance trying to use the output of ioremap
with this were you?  Or were these two questions unrelated?


r~


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

* Re: vremap and memcpy_to_fs in 2.2.x?
  1999-04-07  3:26 ` Richard Henderson
@ 1999-04-07 18:15   ` AARON MARKS
  1999-04-07 20:07     ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: AARON MARKS @ 1999-04-07 18:15 UTC (permalink / raw)
  To: Richard Henderson; +Cc: linux-kernel, axp-list

Richard Henderson wrote:
> 
> On Wed, Mar 31, 1999 at 01:15:21PM -0500, AARON MARKS wrote:
> > I'm porting a PCI card driver from 2.0.x to 2.2.x -- on an Alpha -- and
> > I have two questions:
> >
> > What are the equivalent functions for vremap() and memcpy_to_fs().
> > >From what I can find:
> >
> > vremap() -> ioremap()
> 
> This is correct.

I ended up using phys_to_virt() instead.

> 
> > memcpy_to_fs -> copy_to_user()
> 
> This is also correct.

And for this, I just did a straight assignment:

This:
memcpy_tofs(out, &si, sizeof(si));

Became this:
*out = si;

All seems to be sane so far...
Thanks for your help.

-A.

-- 
Aaron J. Marks		       Communications and Computing Systems Lab
Assoc. Member Tech Staff       Advanced Networks and Computation Group
amarks@sarnoff.com	       Sarnoff Corporation


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

* Re: vremap and memcpy_to_fs in 2.2.x?
  1999-04-07 18:15   ` AARON MARKS
@ 1999-04-07 20:07     ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 1999-04-07 20:07 UTC (permalink / raw)
  To: amarks; +Cc: linux-kernel, axp-list

On Wed, Apr 07, 1999 at 02:15:19PM -0400, AARON MARKS wrote:
> > > vremap() -> ioremap()
> > 
> > This is correct.
> 
> I ended up using phys_to_virt() instead.

These are very different things, and are not interchangeable.
What do you think you are doing?

> And for this, I just did a straight assignment:
> 
> This:
> memcpy_tofs(out, &si, sizeof(si));
> 
> Became this:
> *out = si;

Wrong wrong wrong wrong wrong!

DO USE copy_to_user or put_user.  First, it plugs big oops leaks.
Second, nice systems like m68k or Sparc64 put userland in a 
completely different address space, so assignment won't even
pretend to begin to work.



r~


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

end of thread, other threads:[~1999-04-07 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-03-31 18:15 vremap and memcpy_to_fs in 2.2.x? AARON MARKS
1999-04-07  3:26 ` Richard Henderson
1999-04-07 18:15   ` AARON MARKS
1999-04-07 20:07     ` Richard Henderson

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