Messages in this thread | | | Date | Tue, 16 Apr 1996 17:30:41 +0300 (EET DST) | From | Linus Torvalds <> | Subject | Re: vremap() of non-page-aligned memory |
| |
> > I'm working on a driver for an ATM adapter that insists on > having 0x70 bytes of port memory at 0xfffdff80. > > Does anybody know whether there is a more elegant way (aka. > another function than vremap()) of mapping this into kernel > memory space? The obvious solution is remapping the physical > page that contains the memory chunk, but that appears to > be a somewhat non-portable solution since it relies on a > preset page size etc.
You have to map in the thing in chunks (it's not only the way it works, it's the only way it can ever work). However, it's not too hard to do this as portably as anything else in the kernel:
void * addr = vremap(0xfffdff80 & PAGE_MASK, PAGE_SIZE);
If you want to make _really_ sure, you actually map two pages (in case the 0x70 bytes could possibly be in two different pages, but that's not possible in this case unless the page-size ridiculously small). The you need to do some "offset within area" stuff, but that's easy enough by using PAGE_MASK/PAGE_SIZE.
Linus
| |