* Re: A Question on Physical Memory Access from Applications
@ 2001-08-09 5:55 eejape
0 siblings, 0 replies; 4+ messages in thread
From: eejape @ 2001-08-09 5:55 UTC (permalink / raw)
To: Rabeeh Khoury, linuxppc-embedded
Hi!
Could you make a "short" example of this?
Thanks
----- Alkuperäinen viesti -----
Lähettäjä: Rabeeh Khoury <rabeeh@galileo.co.il>
Päiväys: Torstai, Elokuu 9, 2001 0:24
Aihe: Re: A Question on Physical Memory Access from Applications
>
> Hi,
>
> We had such a problem few months ago ; what we've done is allocating
> contigious physical memory using kmalloc in kernel space.
> From the pointer that you get from kmalloc remove the 4 MSB bits
> (usually 0xc) and pass it (some how) to the user space application.
> The user space application map the address that was passed from the
> kernel, and it will get another virtual contigious memory space.
>
> Now the memory area that you have in user space is contigious AND the
> physical memory that the page tables points to is contigious
> (because it
> was allocated in kernel space using kmalloc), therfore it is
> enough that
> your ADA applications just refer to the allocated memory using a
> pointerto the virtual memory.
>
> Regards,
> Rabeeh
>
>
> Karaaslan, Utku wrote:
>
> >I have ported the Linux bootloader/kernel to our home-made boards
> >(Motorola 860) and they have been running well up to now. However,
> >I have a problem: we've got a number of ADA applications which are
> >using direct memory access to certain hardware registers. Under
> >VxWorks, this is not a problem as it lacks kernelspace/userspace
> >separation. Under Linux, I know I can do direct memory access
> (through>/dev/mem), but in this case I want to use the
> applications as they are,
> >with no change to the ADA code. Is there any way to do physical
> memory>access transparently wrt the application? Many thanks in
> advance.
>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* A Question on Physical Memory Access from Applications
@ 2001-08-08 13:38 Karaaslan, Utku
2001-08-08 14:32 ` Andrew Johnson
2001-08-08 21:24 ` Rabeeh Khoury
0 siblings, 2 replies; 4+ messages in thread
From: Karaaslan, Utku @ 2001-08-08 13:38 UTC (permalink / raw)
To: 'linuxppc-embedded@lists.linuxppc.org'
Hello All,
I have ported the Linux bootloader/kernel to our home-made boards
(Motorola 860) and they have been running well up to now. However,
I have a problem: we've got a number of ADA applications which are
using direct memory access to certain hardware registers. Under
VxWorks, this is not a problem as it lacks kernelspace/userspace
separation. Under Linux, I know I can do direct memory access (through
/dev/mem), but in this case I want to use the applications as they are,
with no change to the ADA code. Is there any way to do physical memory
access transparently wrt the application? Many thanks in advance.
Regards,
Utku
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: A Question on Physical Memory Access from Applications
2001-08-08 13:38 Karaaslan, Utku
@ 2001-08-08 14:32 ` Andrew Johnson
2001-08-08 21:24 ` Rabeeh Khoury
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Johnson @ 2001-08-08 14:32 UTC (permalink / raw)
To: Karaaslan, Utku; +Cc: 'linuxppc-embedded@lists.linuxppc.org'
"Karaaslan, Utku" wrote:
>
> I have a problem: we've got a number of ADA applications which are
> using direct memory access to certain hardware registers. Under
> VxWorks, this is not a problem as it lacks kernelspace/userspace
> separation. Under Linux, I know I can do direct memory access (through
> /dev/mem), but in this case I want to use the applications as they are,
> with no change to the ADA code. Is there any way to do physical memory
> access transparently wrt the application? Many thanks in advance.
If you don't mind inserting some code into the application startup then
you could probably do something with mmap(), either with /dev/mem or
(safer) by writing your own kernel driver for the relevent hardware that
supports mmap()ing just the relevent physical range into user-space (and
makes it non-cacheable). It might be possible to use LD_PRELOAD to do
this at startup without changing the application at all, although I
suspect you might have to make some changes to get the address of the
mmapped region - I'm not sure that you could guarantee to place it where
you want in virtual memory.
HTH,
- Andrew
--
The world is such a cheerful place when viewed from upside-down
It makes a rise of every fall, a smile of every frown
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: A Question on Physical Memory Access from Applications
2001-08-08 13:38 Karaaslan, Utku
2001-08-08 14:32 ` Andrew Johnson
@ 2001-08-08 21:24 ` Rabeeh Khoury
1 sibling, 0 replies; 4+ messages in thread
From: Rabeeh Khoury @ 2001-08-08 21:24 UTC (permalink / raw)
To: Karaaslan, Utku; +Cc: 'linuxppc-embedded@lists.linuxppc.org'
Hi,
We had such a problem few months ago ; what we've done is allocating
contigious physical memory using kmalloc in kernel space.
From the pointer that you get from kmalloc remove the 4 MSB bits
(usually 0xc) and pass it (some how) to the user space application.
The user space application map the address that was passed from the
kernel, and it will get another virtual contigious memory space.
Now the memory area that you have in user space is contigious AND the
physical memory that the page tables points to is contigious (because it
was allocated in kernel space using kmalloc), therfore it is enough that
your ADA applications just refer to the allocated memory using a pointer
to the virtual memory.
Regards,
Rabeeh
Karaaslan, Utku wrote:
>I have ported the Linux bootloader/kernel to our home-made boards
>(Motorola 860) and they have been running well up to now. However,
>I have a problem: we've got a number of ADA applications which are
>using direct memory access to certain hardware registers. Under
>VxWorks, this is not a problem as it lacks kernelspace/userspace
>separation. Under Linux, I know I can do direct memory access (through
>/dev/mem), but in this case I want to use the applications as they are,
>with no change to the ADA code. Is there any way to do physical memory
>access transparently wrt the application? Many thanks in advance.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-08-09 5:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-09 5:55 A Question on Physical Memory Access from Applications eejape
-- strict thread matches above, loose matches on Subject: below --
2001-08-08 13:38 Karaaslan, Utku
2001-08-08 14:32 ` Andrew Johnson
2001-08-08 21:24 ` Rabeeh Khoury
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).