Re: ioremap() address alignment problem

Martin Mares (mj@atrey.karlin.mff.cuni.cz)
Fri, 18 Dec 1998 13:36:08 +0100


Hello,

> When I do vremap(0xf420 1400), I get an error. So I try a range of addresses
> around (from 0xf420 1000 to 0xf420 1000 + 5000), and it seems like vremap()
> only works for page aligned addresses. Is it normal ?

In 2.0.x kernels vremap() works only for page-aligned addresses (2.1.x
ioremap() has been patched recently to allow non-aligned ones). Either
call turn vremap(x) to (x & (PAGE_SIZE-1)) | vremap(x & ~(PAGE_SIZE-1))
or modify vremap() to do this automatically.

[Note to Alan: I think we should modify vremap() in 2.0 to handle
this automatically since there are BIOSes which don't page-align
base addresses (not a bug, only a rare feature) and it could bite
even for usual devices.]

Have a nice fortnight

-- 
Martin `MJ' Mares   <mj@ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"The number of UNIX installations has grown to 10, with more expected.  (6/72)"

- 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/