From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: mmap not working?
Date: 16 Nov 2001 14:10:04 -0800 [thread overview]
Message-ID: <9t42rs$5vd$1@cesium.transmeta.com> (raw)
In-Reply-To: <200111162134.WAA22927@cave.bitwizard.nl>
Followup to: <200111162134.WAA22927@cave.bitwizard.nl>
By author: R.E.Wolff@BitWizard.nl (Rogier Wolff)
In newsgroup: linux.dev.kernel
>
>
> Hi,
>
> I want to mmap a device in an application, so I do:
>
> base = mmap(NULL , DEV_LENGTH, myprot , flags, kmem, dev_base);
>
> Turns out that some BIOSs put my device at an address like
>
> 0xdffffc00
>
> whereas others put it at 0xfa000000 . In the latter case, mmap works
> as expected. However in the first case I get EINVAL: The base is
> not page-aligned.
>
> However, in the latter case I get my requested 1k of memory, and the
> following 3k for free. In the first case I'd want "3k for free,
> followed by the 1k I requested".
>
> effectively, provided "start" equals NULL, the kernel IMHO should:
>
> offset = dev_base & PAGE_MASK;
> return mmap (NULL, length+offset, prot, flags, base - offset) + offset;
> Comments?
>
> The "failure" was observed on 2.4.14 and/or 2.4.9.
>
> Roger.
>
>
> P.S. I end up not being able to closely follow linux-kernel
> lately. CCs to me appreciated.
>
Sorry, what you're asking for the TLB to do something it simply cannot
do -- there is no way for the TLB to remap the bottom 12 bits since it
doesn't control them.
What you'd have to do is to make your device driver move the device to
a different address.
-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com>
next prev parent reply other threads:[~2001-11-16 22:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-16 21:34 mmap not working? Rogier Wolff
2001-11-16 22:10 ` H. Peter Anvin [this message]
[not found] <3BF623B7.1050607@zytor.com>
2001-11-17 9:07 ` Rogier Wolff
2001-11-17 18:38 ` Rik van Riel
2001-11-17 18:47 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='9t42rs$5vd$1@cesium.transmeta.com' \
--to=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox