Hi all,
I've been using a common library linked between three tasks in L4. I need to link this library with an application in L4Linux too also share info like the three L4 tasks has been doing.
I've tried almost every variation off the Makefile I could think off, but the compiler always complain about stuff regarding library L4RM and L4DM_[MEM/PHYS] which I must include. The library also uses Semaphore- and Threads libraries.
Any suggestions/reference/examples as to what to do to change a complex L4 library to be linked into a Linux application would be appreciated.
Thanx Leon
On Tue Feb 22, 2005 at 10:21:23 +0200, Leon Brits wrote:
I've been using a common library linked between three tasks in L4. I need to link this library with an application in L4Linux too also share info like the three L4 tasks has been doing.
I've tried almost every variation off the Makefile I could think off, but the compiler always complain about stuff regarding library L4RM and L4DM_[MEM/PHYS] which I must include. The library also uses Semaphore- and Threads libraries.
Any suggestions/reference/examples as to what to do to change a complex L4 library to be linked into a Linux application would be appreciated.
Did you have a look at one of the examples, e.g. l4/pkg/loader/examples/dump-l4? There are some dummy implementations.
Does your program actually really use the thread and semaphore functionality? If you do, you should know very well what this is all doing. L4Linux programs are Linux programs that can use some amount of L4 services, not the other way around.
Adam
On Tue, 2005-02-22 at 13:55 +0100, Adam Lackorzynski wrote:
On Tue Feb 22, 2005 at 10:21:23 +0200, Leon Brits wrote:
I've been using a common library linked between three tasks in L4. I need to link this library with an application in L4Linux too also share info like the three L4 tasks has been doing.
I've tried almost every variation off the Makefile I could think off, but the compiler always complain about stuff regarding library L4RM and L4DM_[MEM/PHYS] which I must include. The library also uses Semaphore- and Threads libraries.
Any suggestions/reference/examples as to what to do to change a complex L4 library to be linked into a Linux application would be appreciated.
Did you have a look at one of the examples, e.g. l4/pkg/loader/examples/dump-l4? There are some dummy implementations.
Does your program actually really use the thread and semaphore functionality? If you do, you should know very well what this is all doing. L4Linux programs are Linux programs that can use some amount of L4 services, not the other way around.
Hi Adam,
Thanks for your reply as always.
My library calls l4_ipc_wait() a few times and fprov-l4/dump-l4 only makes IPC calls. I can port my library to to use the standard Linux semaphore and thread libraries but I still need to receive IPC calls.
Any suggestions for L4Linux app example code that waits for an IPC?
Thanks Leon
On Tue Feb 22, 2005 at 17:25:43 +0200, Leon Brits wrote:
My library calls l4_ipc_wait() a few times and fprov-l4/dump-l4 only makes IPC calls. I can port my library to to use the standard Linux semaphore and thread libraries but I still need to receive IPC calls.
Any suggestions for L4Linux app example code that waits for an IPC?
Doing ipc-wait is no problem. It's just e.g. when creating threads one should make sure that Linux won't be using this thread for Linux threads. And that this thread does not cause page faults and similar. It's better to take the Linux way here.
Adam
On Tue, 2005-02-22 at 16:34 +0100, Adam Lackorzynski wrote:
On Tue Feb 22, 2005 at 17:25:43 +0200, Leon Brits wrote:
My library calls l4_ipc_wait() a few times and fprov-l4/dump-l4 only makes IPC calls. I can port my library to to use the standard Linux semaphore and thread libraries but I still need to receive IPC calls.
Any suggestions for L4Linux app example code that waits for an IPC?
Hi Adam,
Doing ipc-wait is no problem. It's just e.g. when creating threads one should make sure that Linux won't be using this thread for Linux threads.
I do not understand your example - can you please elaborate. [example code will be great!]
I am currently looking at "pkg/con/example/linux_stub_lib", it builds a Linux library which I assume I can link into a Linux app but it calls the function "l4lx_thread_create()" for which I do not seem to find any docs. Can you please point me in the right direction to find the info.
Thanks Leon
Hi,
On Wed, Feb 23, 2005 at 08:04:50AM +0200, Leon Brits wrote:
On Tue, 2005-02-22 at 16:34 +0100, Adam Lackorzynski wrote:
Doing ipc-wait is no problem. It's just e.g. when creating threads one should make sure that Linux won't be using this thread for Linux threads.
I do not understand your example - can you please elaborate. [example code will be great!]
I am currently looking at "pkg/con/example/linux_stub_lib", it builds a Linux library which I assume I can link into a Linux app but it calls the function "l4lx_thread_create()" for which I do not seem to find any docs. Can you please point me in the right direction to find the info.
linux_stub_lib is no (L4)Linux application library - it's the in-kernel equivalent to a Linux kernel module (That's why it's called "library" ;-). The real code is in "pkg/con/example/linux_stub", which builds a Linux kernel module for the DROPS console system.
AFAIK doing IPC under L4Linux <= 2.4 is as easy as including <l4/sys/ipc.h> and calling the IPC bindings. You need no library for that purpose. The Makefile mode is "mode=l4linux".
Hope it helps
Hi Christian,
linux_stub_lib is no (L4)Linux application library - it's the in-kernel equivalent to a Linux kernel module (That's why it's called "library" ;-). The real code is in "pkg/con/example/linux_stub", which builds a Linux kernel module for the DROPS console system.
Sorry, I've mistakenly add the "_lib". It seems that I may need to add this library to both an app and a kernel module.
AFAIK doing IPC under L4Linux <= 2.4 is as easy as including <l4/sys/ipc.h> and calling the IPC bindings. You need no library for that purpose. The Makefile mode is "mode=l4linux".
This is what I am trying... I wrote a simple Linux app (MODE=l4linux) that compiles with the existing library source files directly (no lib). My library starts some l4threads which does some IPC and receives dataspaces which is attached to the apps VM. As you know the compile fails. So, to debug I have commented out all source code in the library source files and started to selectively uncomment sections and functions. Every time I uncomment a section I compile and run it. The compiles succeeds until I added the section that attaches the received dataspace to the app's VM with l4rm_attach().
I get the following compile error:
==> Linking msgsrv ../../../../../lib/x86_586/l4v2/libdm_generic.a(map.o)(.text+0x1a0): In function `l4dm_map': /root/DROPS/l4/pkg/dm_generic/lib/clientlib/src/map.c:251: undefined reference to `l4rm_lookup' ../../../../../lib/x86_586/l4v2/libl4env.a(environment.o)(.text+0x17f): In function `l4env_get_default_dsm': /root/DROPS/l4/pkg/l4env/lib/src/environment.c:251: undefined reference to `names_waitfor_name' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text+0x6): In function `__startup_main': /root/DROPS/l4/pkg/l4env/lib/src/startup.c:59: undefined reference to `crt0_construction' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text+0x32): In function `__setup_fixed': /root/DROPS/l4/pkg/l4env/lib/src/startup.c:74: undefined reference to `_prog_img_start' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text +0x39):/root/DROPS/l4/pkg/l4env/lib/src/startup.c:75: undefined reference to `_prog_img_end' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text +0x78):/root/DROPS/l4/pkg/l4env/lib/src/startup.c:80: undefined reference to `crt0_tramppage' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text+0x191): In function `__main': /root/DROPS/l4/pkg/l4env/lib/src/startup.c:136: undefined reference to `crt0_multiboot_info' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text +0x1a5):/root/DROPS/l4/pkg/l4env/lib/src/startup.c:136: undefined reference to `crt0_multiboot_flag' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text +0x1b7):/root/DROPS/l4/pkg/l4env/lib/src/startup.c:139: undefined reference to `crt0_multiboot_info' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text+0x27d): In function `__main': /root/DROPS/l4/pkg/l4env/lib/src/OBJ-x86_586-l4v2/../../../../../include/l4/l4rm/l4rm.h:1037: undefined reference to `l4rm_do_area_setup' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text+0x2af): In function `__main': /root/DROPS/l4/pkg/l4env/lib/src/OBJ-x86_586-l4v2/../../../../../include/x86/l4v2/l4/sys/syscalls-l42-gcc3-nopic.h:39: undefined reference to `crt0_stack_high' ../../../../../lib/x86_586/l4v2/libl4env.a(startup.o)(.text +0x2b4):/root/DROPS/l4/pkg/l4env/lib/src/OBJ-x86_586-l4v2/../../../../../include/x86/l4v2/l4/sys/syscalls-l42-gcc3-nopic.h:39: undefined reference to `crt0_stack_low' collect2: ld returned 1 exit status make[1]: *** [msgsrv] Error 1
The MODE setting in the Makefile includes the libraries: dm_generic, dm_mem, names, l4util, loaderif, l4env, l4env_err, slab, l4sys. I added libraries: thread_linux, semaphore, loglinux, l4rm
I am aware of the problem which Adam mentioned that the L4Linux server may overmap the attached memory but at the moment I can not even map the dataspace due to this compile error.
Any suggestions to solve this compile problem.
Thanks again for all your time! Leon
On Wed Feb 23, 2005 at 08:04:50 +0200, Leon Brits wrote:
On Tue, 2005-02-22 at 16:34 +0100, Adam Lackorzynski wrote:
Doing ipc-wait is no problem. It's just e.g. when creating threads one should make sure that Linux won't be using this thread for Linux threads.
I do not understand your example - can you please elaborate.
I just wanted to make clear, that a hybrid program is doing stuff that the Linux server knows nothing about. So e.g. if you start mapping pages in the Linux address spaces from somewhere else, Linux may just overmap them. On the other side if you exactly know what Linux is doing with its programs and how it's handling their address space you can of course do your own thing. But that's fragile.
I am currently looking at "pkg/con/example/linux_stub_lib", it builds a Linux library which I assume I can link into a Linux app but it calls
As Christian already said, that's a kernel module (or library to link to L4Linux).
the function "l4lx_thread_create()" for which I do not seem to find any docs. Can you please point me in the right direction to find the info.
l4lx_thread_create() is a L4Linux internal function to create an L4 thread inside the L4Linux server. This is no user accessible interface. Anyway, all those functions are doxygen documented in their header files.
Adam
Hi Adam,
I just wanted to make clear, that a hybrid program is doing stuff that the Linux server knows nothing about. So e.g. if you start mapping pages in the Linux address spaces from somewhere else, Linux may just overmap them. On the other side if you exactly know what Linux is doing with its programs and how it's handling their address space you can of course do your own thing. But that's fragile.
Thanks, I understand. This is not good news. Is it possible to reserve an region within the L4Linux (with startup commandline option?) and let the app attach the dataspace to that region?
Thanks again for your time! Leon
On Thursday 24 February 2005 10:41, Leon Brits wrote:
I just wanted to make clear, that a hybrid program is doing stuff that the Linux server knows nothing about. So e.g. if you start mapping pages in the Linux address spaces from somewhere else, Linux may just overmap them. On the other side if you exactly know what Linux is doing with its programs and how it's handling their address space you can of course do your own thing. But that's fragile.
Thanks, I understand. This is not good news. Is it possible to reserve an region within the L4Linux (with startup commandline option?) and let the app attach the dataspace to that region?
Try using
http://os.inf.tu-dresden.de/~fm3/emul_l4rm.c
as replacement for l4rm in L4Linux applications. But be aware that, as Adam said, the Linux server is not aware of memory from external data- spaces. So read/write syscalls don't work with this memory. To use these you had to use double buffering.
Frank
Frank,
Thanks - It works!!!
But be aware that, as Adam said, the Linux server is not aware of memory from external data- spaces. So read/write syscalls don't work with this memory. To use these
So as long as only my Linux app/kernel module accesses the data all is fine but to make it available to another Linux app I need to copy it to Linux allocated memory. Is this correct?
you had to use double buffering.
What is double buffering? [The last time I heard this term was with graphics device drivers]
Thanks again Leon
On Thursday 24 February 2005 15:26, Leon Brits wrote:
Thanks - It works!!!
Fine.
But be aware that, as Adam said, the Linux server is not aware of memory from external data- spaces. So read/write syscalls don't work with this memory. To use these
So as long as only my Linux app/kernel module accesses the data all is fine but to make it available to another Linux app I need to copy it to Linux allocated memory. Is this correct?
No. As long as your Linux application accesses the data, all is fine.
you had to use double buffering.
What is double buffering? [The last time I heard this term was with graphics device drivers]
Do NOT try to this:
- create a dataspace - attach it with l4rm_attach from emul_l4rm.c, you get address ADDR - read(..., ADDR, ...)
because the Linux kernel is located in a separate address space and it does not _see_ that memory. If you try this you will only get SEGFAULTS.
Double buffering is this:
static char buf[...]; int len;
len = read(..., buf, ...); /* make sure that len <= sizeof(buf) memcpy(ADDR, buf, len);
Frank
Frank,
Try using
http://os.inf.tu-dresden.de/~fm3/emul_l4rm.c
as replacement for l4rm in L4Linux applications
This file solved my problems ...BUT... I would just like to point out that the access rights provided via the flags-parameter is not used in the call to l4dm_map_pages(). I changed this by just passing the flags-parameter directly into l4dm_map_pages() - Now L4DM_RO works.
Cheers Leon
l4-hackers@os.inf.tu-dresden.de