On Wed, Nov 30, 2016 at 8:49 AM, PX <[email protected]> wrote:
> I want to allocate a contiguous physical memory block (larger than a
> physical page) and map it to contiguous virtual addresses in the vspace,
> what's the best way to do it? Are there existing libraries allowing me to
> do that?
>
Not super familiar with the library sitch, but at a fundamental level:
- First you need an untyped of the correct size (and possibly at the
correct position in physical memory), which may be available to you
immediately, or you'll need to retype a larger one.
- Then you can retype it into page objects. A single seL4_UntypedRetype
call can give you many pages, so you just need to choose the appropriate
page size. If you wanted a 4MB contiguous block on x86_64, you could retype
a 4MB untyped into two 2MB pages. If you wanted a 1MB contiguous block, you
could retype a 1MB untyped into 256 4KB pages (as it happens, 256 is the
default maximum number of objects you can make in an UntypedRetype call).
- Then you can seL4_$ARCH_{PageDirectory/Table/PDPT/etc}_Map and ultimately
seL4_$ARCH_Page_Map them into contiguous virtual addresses.
(libsimple / vka / allocman are the things to look at in the seL4 userland
stack, and there's a bit of this sort of stuff in the tutorial on the wiki.)
Thanks,
Jeff
_______________________________________________
Devel mailing list
[email protected]
https://sel4.systems/lists/listinfo/devel