On Thu, 13 Oct 2011 00:03:54 +0200, Adam Lackorzynski wrote:
minicmd | mmap(): mmap, fd: 0, flags: 34
and then from 'loader' server:
loader | os2app,#17: Not allowed to perform any I/O
Regarding the loader message, it seems that the app accessed a random region in an I/O memory because of uninitialized variables. But why mmap to fd: 0, I cannot say. fd=0 is stdin, but I know that malloc accesses the heap but why it uses a memory-mapped files I yet don't know. So, some troubles are still there, but I hope I'll work it out
The flags indicates that anonymous memory is wanted, to the fd does not play any role.
Thanks for the note! Yes, now I made it working. It really calls mmap() when I am calling malloc(). With malloc(), the pointer to l4env_get_default_dsm() was uninitialized. I fixed that and now it works.
But another strange problem. I had the function which used the 'segments' feature. Now I moved that function from my application to the shared library -- just copied it as is. -- And got an error when trying to compile it:
/mnt/data/src/l4env/l4/pkg/os3/pkg/lib/kal/start.c: In function 'trampoline': /mnt/data/src/l4env/obj/include/x86/l4v2/l4/sys/segment.h:24:3: error: can't find a register in class 'BREG' while reloading 'asm' /mnt/data/src/l4env/obj/include/x86/l4/sys/segment.h:76:3: error: can't find a register in class 'BREG' while reloading 'asm' /mnt/data/src/l4env/obj/include/x86/l4v2/l4/sys/syscalls-l42-gcc3-pic.h:45:3: error: 'asm' operand has impossible constraints /mnt/data/src/l4env/obj/include/x86/l4v2/l4/sys/segment.h:24:3: error: 'asm' operand has impossible constraints /mnt/data/src/l4env/obj/include/x86/l4/sys/segment.h:76:3: error: 'asm' operand has impossible constraints /mnt/data/src/l4env/l4/pkg/os3/pkg/lib/kal/start.c:204:3: error: 'asm' operand has impossible constraints make[1]: *** [start.s.o] Error 1 make[1]: Leaving directory `/mnt/data/src/scratchbox/users/valerius/home/valerius/l4env/obj/pkg/os3/pkg/lib/kal/OBJ-x86_586-l4v2' make: *** [/mnt/data/src/l4env/obj/pkg/os3/pkg/lib/kal/OBJ-x86_586-l4v2] Error 2
the code fragment that causes the error is
/* L4 includes */ #include <l4/sys/segment.h> #include <l4/dm_mem/dm_mem.h> #include <l4/dm_generic/consts.h> #include <l4/events/events.h> #include <l4/generic_ts/generic_ts.h> #include <l4/env/env.h> #include <l4/env/errno.h> #include <l4/log/l4log.h> #include <l4/util/rdtsc.h> #include <l4/l4rm/l4rm.h> /* OS/2 server internal includes */ #include <l4/os3/gcc_os2def.h> #include <l4/os3/ixfmgr.h> #include <l4/os3/processmgr.h> #include <l4/os3/dl.h> /* OS/2 server RPC call includes */ #include <l4/os2srv/os2server-client.h> /* exec server RPC call includes */ #include <l4/execsrv/os2exec-client.h> /* DICE includes */ #include <dice/dice.h> /* local includes*/ #include <stacksw.h>
<...skipped...>
* GDT/LDT descriptor structure */ struct desc { short limit_lo :16; short base_lo1 :16; short base_lo2 :8; short acc_lo :8; short limit_hi :4; short acc_hi :4; short base_hi :8; };
<...skipped...> task = l4_myself(); <...skipped...>
/* Prepare TIB GDT descriptor */ desc.limit_lo = 0x30; desc.limit_hi = 0; desc.acc_lo = 0xF3; desc.acc_hi = 0; desc.base_lo1 = base & 0xffff; desc.base_lo2 = (base >> 16) & 0xff; desc.base_hi = base >> 24;
/* Allocate a GDT descriptor */ fiasco_gdt_set(&desc, sizeof(struct desc), 0, task);
/* Get a selector */ sel = (sizeof(struct desc)) * fiasco_gdt_get_entry_offset();
-- When I comment out the last two lines with fiasco_gdt_set(); and fiasco_get_entry_offset(), the error disappears. These two functions are in <l4/sys/segment.h>. But what can cause such an error? It complains about two assembly language inline functions, which are ok. -- I used it as is in my app and just moved it in unmodified state to the library -- only paths to source files are changed. Maybe, anyone encountered such an error before?