From: Christoph Rohland <cr@sap.com>
To: Matan Ziv-Av <matan@svgalib.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] svgalib error in mmap documentation
Date: 07 Jan 2001 10:16:49 +0100 [thread overview]
Message-ID: <m3ofxjivx9.fsf@linux.local> (raw)
In-Reply-To: <Pine.LNX.4.21_heb2.09.0101062320210.808-100000@matan.home>
In-Reply-To: <Pine.LNX.4.21_heb2.09.0101062320210.808-100000@matan.home>
Matan Ziv-Av <matan@svgalib.org> writes:
> I hope it is reasonable to ask, how?
>
> What I need is to allocate a big amount of memory (say 1MB, for
> example), copy the video memory to it, and then have fixed 64K of
> virutal address of the process point to any 64K window of the large
> allocated memory. How can I do it?
fd = shm_open("vidmem-filename", O_CREAT,...);
ftruncate(fd, 1<<20);
ptr = mmap(0, 64 * 1<<10, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
to remap another area:
if (mmap(ptr, 64 * 1<<10, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED,
fd, blocknr * 64 * 1<<10) != ptr)
error();
On exit:
munmap(ptr, 64 * 1<<10);
shm_unlink ("vidmem-filename");
Note the MAP_FIXED argument to the remap operation. You do not need to
unmap on Linux to remap an area when giving MAP_FIXED. (So MAP_FIXED
can to really bad things to your program...)
Greetings
Christoph
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
prev parent reply other threads:[~2001-01-07 9:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-06 8:33 [PATCH] svgalib error in mmap documentation Matan Ziv-Av
2001-01-06 15:42 ` Alan Cox
2001-01-06 21:22 ` Matan Ziv-Av
2001-01-06 21:50 ` Alan Cox
2001-01-07 9:16 ` Christoph Rohland [this message]
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=m3ofxjivx9.fsf@linux.local \
--to=cr@sap.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=matan@svgalib.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