Dear seL4 developers,
first, I'd like to thank you for publishing seL4 under GPL. I am very
happy that I can finally get my hands dirty with working with the kernel
of your group. :-) Currently, I am taking the first baby steps to bring
the Genode OS framework (http://genode.org) to seL4. For reference, I am
using the experimental branch.
The first smallish issue I stumbled upon stems from the fact that Genode
is written in C++. By compiling the seL4 syscall bindings with a C++
compiler, I got the following error:
error: inconsistent operand constraints in an ‘asm’
It can be reproduced by putting the following code snippet into a cc
file and compiling it with 'g++ -m32 -c' (tested with the Genode tool
chain as well as with GCC 4.8.1):
typedef enum {
seL4_SysDebugPutChar = -9,
_enum_pad_seL4_Syscall_ID = (1U << ((sizeof(int)*8) - 1))
} seL4_Syscall_ID;
void
seL4_DebugPutChar(char c)
{
asm volatile (
"pushl %%ebp \n"
"movl %%esp, %%ecx \n"
"leal 1f, %%edx \n"
"1: \n"
"sysenter \n"
"popl %%ebp \n"
:
: "a" (seL4_SysDebugPutChar),
"b" (c)
: "%ecx", "%edx", "%esi", "%edi", "memory"
);
}
When compiling the same code snippet with 'gcc' instead of 'g++',
everything is fine. It turns out that the C++ compiler does not like the
enum value to be specified as input argument. I found the following ways
to circumvent this problem:
* Changing the enum value 'SysDebugPutChar' to a positive value,
* Removing the definition of '_enum_pad_seL4_Syscall_ID',
* Casting 'seL4_SysDebugPutChar' to an integer:
: "a" ((int)seL4_SysDebugPutChar),
In any case, I seem to have to change the bindings. Do you see a way
around it? If not, would you consider one of the solutions above for the
seL4 headers?
On another note, I noticed that the bindings use the EBX register.
Unfortunately, this makes it impossible to compile seL4 userland
software as position-independent code (PIC). E.g., when compiling the
above code snippet via 'g++ -m32 -fPIC -c', the following error occurs:
error: inconsistent operand constraints in an ‘asm’
However, PIC is required in order to use shared libraries. The solution
would be to not use EBX to pass arguments to the 'asm' statements, save
EBX on the stack prior moving the respective kernel argument to the
register, and, of course, restoring it after sysenter returns.
Before I start changing the bindings, I'd like to know: is there anyone
else working on the same problem? Would you be open to accept a change
of the bindings to become PIC compliant on the costs of a few added
instructions? Or do you have another suggestion how I should go about it?
Best regards
Norman
--
Dr.-Ing. Norman Feske
Genode Labs
http://www.genode-labs.com · http://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Dear all,
I follow the official step (https://github.com/seL4/refos-manifest) to
build RefOS and it occurs the following error message.
In file included from
/home/chi-wai/Workspaces/microkernel/RefOS/libs/librefos/src/sync.c:16:0:
~/Workspaces/RefOS/stage/arm/imx31/include/refos/refos.h:73:1: *error:
unknown type name ‘uint32_t’*
~/Workspaces/RefOS/stage/arm/imx31/include/refos/refos.h:73:23: *error:
unknown type name ‘uint32_t’*
In file included from
/home/chi-wai/Workspaces/microkernel/RefOS/libs/librefos/src/sync.c:18:0:
~/Workspaces/RefOS/stage/arm/imx31/include/refos-util/cspace.h:44:72: *error:
unknown type name ‘uint32_t’*
~/Workspaces/RefOS/libs/librefos/src/sync.c: In function
‘sync_create_mutex’:
~/Workspaces/RefOS/libs/librefos/src/sync.c:49:5: *warning*: ‘seL4_Notify’
is deprecated (declared at
/home/chi-wai/Workspaces/microkernel/RefOS/stage/arm/imx31/include/sel4/deprecated.h:23):
use seL4_Signal [-Wdeprecated-declarations]
~/Workspaces/RefOS/libs/librefos/src/sync.c: In function ‘sync_acquire’:
~/Workspaces/RefOS/libs/librefos/src/sync.c:65:5: *error: invalid
initializer*
~/Workspaces/RefOS/libs/librefos/src/sync.c: In function ‘sync_release’:
~/Workspaces/RefOS/libs/librefos/src/sync.c:74:5: *warning*: ‘seL4_Notify’
is deprecated (declared at
/home/chi-wai/Workspaces/microkernel/RefOS/stage/arm/imx31/include/sel4/deprecated.h:23):
use seL4_Signal [-Wdeprecated-declarations]
make[1]: *** [src/sync.o] Error 1
make: *** [librefos] Error 2
Does RefOS use the old seL4 API ? If it is, which version I need to
downgrade?
Thanks for any help or suggestion,
Gapry.
https://gapry.wordpress.com/
Hi everyone,I find an interesting problem when I read the code of endpoint(kernel\src\object\endpoint.c). In the sendIPC and receiveIPC functions , I see there are 3 states for an endpoint(Idle , send , receive). Below it is the state machine diagram.
sendIPC
EPState_Recv ——> EPState_Idle ——>EPState_send
receiveIPC
EPState_send——> EPState_Idle ——>EPState_Recv
But when I add some print infomation, I find the endpoint can never reach the Send state. I think the correct state machine diagram just has two states(idle and receive).
sendIPC
EPState_Recv ——> EPState_Idle
receiveIPC
EPState_Idle ——>EPState_Recv
Am I right???
I am trying to develop a camkes application with one component having
access to the timer. I got some inspiration from the time server for the
kzm machine. Now, I am trying to port that to the am335x machine to execute
on a beagleboard black.
I dig into the code and found the appropriate platform-specific functions
to call. Unfortunately, when trying to compile, it fails (see below).
Anybody has an idea why this happens?
Also, if you want to look at the camkes application, I put it on github at
https://github.com/juli1/sel4-experiments/tree/master/camkes/pingimpl-am335x
Thanks for any help!
/home/sel4/test/camkes/build/arm/am335x/pingimpl/src/timer/static/components/timer/src/timer.o:
In function `irq_callback':
/home/sel4/test/camkes/apps/pingimpl/components/timer/src/timer.c:22:
undefined reference to `dm_handle_irq'
/home/sel4/test/camkes/apps/pingimpl/components/timer/src/timer.c:32:
undefined reference to `dm_oneshot_relative'
/home/sel4/test/camkes/build/arm/am335x/pingimpl/src/timer/static/components/timer/src/timer.o:
In function `run':
/home/sel4/test/camkes/apps/pingimpl/components/timer/src/timer.c:58:
undefined reference to `dm_oneshot_relative'
collect2: error: ld returned 1 exit status
Dear all,
I would like to build a scheduler on top of camkes. I figure that I have to
get access to the timer irq and start from there (e.g. then, dispatch other
tasks according to the number of elapsed ticks).
I did find some relevant examples, especially in the camkes-vm (
https://github.com/seL4/camkes-vm) but nothing I can try. Is there any
information about such materials? I tried to reuse the component but always
got build error. I was wondering if there was an existing tutorial or an
example I could try that will help me.
Thanks.
Julien.
Hello,
while moving Genode's seL4 support to seL4 version 2, I stumbled over
the dynamic allocation within untyped memory regions.
In the old experimental branch that I used previously, the
retype-untyped operation allowed me to manually specify an offset where
the new kernel object should be placed within the untyped memory region.
So I was able to manage the allocation of untyped memory manually.
In short, I added each initial untyped memory region to a roottask-local
"phys-mem" allocator. Each time when creating a kernel object, I asked
this allocator for a region of the required size and alignment,
determined the untyped-memory capability that belongs to the found
region, and used this capability to create the kernel object(s) at the
calculated offset within the untyped-memory region. This worked very well.
After switching to version 2, I found the retype-untyped operation to
lack the offset argument (which admittedly was never present in the
non-experimental version). Instead of accepting an offset parameter, the
kernel maintains a built-in allocator per untyped-memory region. (please
correct me if my understanding is wrong) The allocator is basically a
simple offset value ("FreeIndex") that is increased with each
allocation. Since I no longer have the chance to specify the offset
explicitly, I have to rely on the allocation policy of the kernel and
hit the following problem:
There exists an untyped memory region of size 0x2000. Initially, the
FreeIndex is 0. Now, I am creating the following kernel objects within
the untyped-memory region:
1. CNode with totalObjectSize 0x400:
-> The allocation increases FreeIndex to 0x400.
2. CNode with totalObjectSize 0x800:
-> The FreeIndex gets aligned to 0x800 (natural alignment of
the to-be-created CNode).
This creates a gap between 0x400 and 0x800.
-> The allocation increases FreeIndex to 0x1000.
3. seL4_IA32_4K with a totalObjectSize 0x1000:
-> The allocation increases FreeIndex to 0x2000.
4. CNode with totalObjectSize 0x400:
<<seL4 [decodeUntypedInvocation/209 T0xe3fc9900
"rootserver" @2013228]:
Untyped Retype: Insufficient memory
(1 * 1024 bytes needed, 0 bytes available).>>
Since FreeIndex equals the size of the untyped memory region,
the kernel concludes that untypedFreeBytes is 0.
Even though there exists a gap of 0x400 within the untyped memory region
that satisfies the alignment of the to-be-created kernel object, the
kernel won't allow me to use it. In contrast, with the
retype-untyped-at-offset operation, such a situation never occurred.
Right now, I am a bit puzzled about how to proceed and have the
following questions in the back of me head:
* What is the rationale behind fixing the allocation policy within
untyped memory regions in the kernel. Doesn't this design
contradict with the principle of avoiding policy in the kernel?
In my specific case, this policy seemingly makes my life much more
difficult. To use the kernel in a deterministic way, I would need
to model the kernel's allocation behavior in the user land.
* From what I gather from the kernel's source code, the built-in
allocator would not allow me to reuse parts of untyped memory
regions because 'FreeIndex' is always increasing. E.g., after
revoking the CNodes of steps 1 and 2, I still cannot create
any new kernel objects within the untyped memory region because
FreeIndex remains equal the size of the untyped memory region.
Is this correct?
* Is it possible to give me the retyped-untyped-at-offset operation
back? ;-) e.g., in the form of a patch? Or alternatively, are there
any best practices that I could follow wrt managing untyped memory?
Maybe I'm just approaching the problem from the wrong angle?
Best regards
Norman
--
Dr.-Ing. Norman Feske
Genode Labs
http://www.genode-labs.com · http://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth