From: Xavier Leroy <xavier.leroy@inria.fr>
To: Gerd Stolpmann <info@gerd-stolpmann.de>
Cc: Fernando Alegre <fernando@cc.gatech.edu>, caml-list@inria.fr
Subject: Re: [Caml-list] camlimages and kernel memory
Date: Sat, 8 Jun 2002 15:36:14 +0200 [thread overview]
Message-ID: <20020608153614.A12902@pauillac.inria.fr> (raw)
In-Reply-To: <20020606230826.C616@ice.gerd-stolpmann.de>; from info@gerd-stolpmann.de on Thu, Jun 06, 2002 at 11:08:26PM +0200
> For example, Linux (but other OS, too) allow userland processes to access the
> kernel memory by opening and mmapping the file /dev/kmem. This effects that
> kernel memory is mapped into the userland address space. However, mmap is
> usually restricted to 4k blocks, i.e. you can mmap only a whole number of
> 4k blocks.
>
> O'Caml can handle pointers to blocks that are outside of the region that is
> managed by its own routines. The blocks must have the right format, of course,
> i.e. strings must have the right O'Caml header. I suppose this header is not
> in the ringbuffer.
>
> If the ringbuffer happens to begin at a 4k boundary, you have won, because you
> can manage that there is such a header without modifying kernel memory, i.e.
> if the mmaped buffer begins at address A, just allocate anonymous memory in the
> 4k block before A and write the needed header into it.
This is the hard way :-) A simpler way to memory map files or devices
in a Caml program is to use the function "map_file" from the Bigarray
library. However, it currently always map the file from offset 0,
which is probably not appropriate for /dev/kmem... I'll have to look
into this limitation.
> The other problem is whether camlimages can handle data that is
> organized as ring. I don't have any ideas.
The type Image.t is a relatively complex data structure, so some work
is definitely needed to go from a raw string or bigarray
(corresponding to the memory-mapped file) to a value of type Image.t.
I'll let the authors of CamlImages comment on that.
- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2002-06-08 13:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-05 23:48 Fernando Alegre
2002-06-06 21:08 ` Gerd Stolpmann
2002-06-08 13:36 ` Xavier Leroy [this message]
2002-06-12 16:20 ` Jun P.FURUSE
2002-06-12 22:09 ` Fernando Alegre
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=20020608153614.A12902@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=fernando@cc.gatech.edu \
--cc=info@gerd-stolpmann.de \
/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