Adding a Kernel Module in base-hw

Martin Stein martin.stein at ...1...
Mon Jan 19 11:35:24 CET 2015

Hi Franc,

The easiest way to trigger privileged code from userland is by adding a
new syscall to the base-hw kernel. To achieve this, you first have to
adapt the kernel-interface description. Let me give you some background
for this. There are two types of syscalls, public syscalls that can be
called by everyone and core syscalls that can be called only by Genodes
core process. For optimization purpose, the kernel expects the IDs of
the syscalls to be this way:

public syscalls: 0, 1, ..., x
core syscalls: x+1, x+2, x+y

So if you want to add a public syscall in
base-hw/include/kernel/interface.h, you should always use the call ID
that is one higher than the current maximum in this file. Additionally,
you must increase all core-syscall IDs in
base-hw/src/core/include/kernel/core_interface.h by one.

After that, you can implement the syscall back-end by adding a new
method 'void Thread::_call_xxx()' in base-hw/src/core/kernel/
and adapting the 'void Thread::_call()' method in the same file
accordingly. In this file you also find the implementation of all the
other syscalls. They may serve you as inspiration on how to pass
arguments and return values.

If you have further questions, please don't hesitate to ask ;)


On 19.01.2015 11:04, Franc sylvester wrote:
> Hello everyone, 
> I am stuck at one point because of lack of understanding in Genode,
> Actually I want to execute some assembly instruction in privileged
> mode in base-hw kernel from a user script. 
> So I need to know, How will I add a kernel module which will execute
> assembly instruction and how can I call this module from the user space.
> And if there is already any such modules exist in Genode that will
> really help me to understand the flow mechanism, Let me know. 
> Cheers
> Franc
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> _______________________________________________
> genode-main mailing list
> genode-main at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list