On Tuesday 24 April 2001 04:29, you wrote:
> I need ~2MB memory buffer to shared data between the rtl and linux
> process. I need the virtual address returned by mbuff to be the same to
> all task gaining access to my mbuff() memory. How can this be done?

We just had a thread on this, and the conclusion was basically that it's not 
possible to do without some more or less deep kernel hacking.

In short, the problem is that it's the standard Linux code that manages the 
page tables, which means that RTL threads cannot safely access any pages that 
might have to be mapped into the current address space first. The "current 
address space" in kernel context - whether RTL or standard Linux context, 
depends on which user space task you happen to preempt.


To reiterate some tech stuff; the only area that can always be accessed 
without adjusting the page tables are is the high GB, where Linux keeps it's 
memory and hardware interfacing stuff mapped. It *might* be possible to map 
memory in this area so that it can be accessed by user space code as well, 
but in it's simplest form, that hack would affect *all* user space tasks. 
This may or may not be acceptable from a security POV, depending on the 
application.


> I have an existing real-time application which uses it own memory
> allocation lib. It uses the 2MB chunk, allocates a structure of pointer,
> then allocates many data buffer(s). So my mbuff() memory fill with
> pointer. I need to have other task (RT and non-RT) be able to follow the
> pointers.

Well, the simplest, most reliable and most portable solution is probably to 
use offsets instead of pointers. Two ways, basically:

        1. Use offsets from a common base address, like the start address
           of the shared area.

        2. Use offsets relative to the address of the offset itself.

The first option is probably nicer and cleaner, as you need to have the base 
address handy all the time, which may slow things down if you do a lot of 
operations on offsets.

The second option could be faster at times, but can be a bit cumbersome in 
that you can't just copy an offset as you can do with a pointer; you have to 
transform the offset value so that it's based on the address of the new 
offset variable. Obviously, you can't store an offset in a register variable, 
as it looses it's meaning as soon as you forget from which address you read 
it... *heh*


> If mbuff() can't, is there another way?

Kernel hacking; possibly non-trivial. (Don't remember if someone actually 
tried it.)


//David

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to