Adding new Kernel Call - Minix

This is a discussion on Adding new Kernel Call - Minix ; Hello, I've noticed that there are several tutorials arround about adding a new system call in minix, but i couldn't find one about adding a new kernel call (I am seeking an explanatory tutorial, not just a quotation of steps). ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Adding new Kernel Call

  1. Adding new Kernel Call

    Hello,

    I've noticed that there are several tutorials arround about adding a
    new system call in minix, but i couldn't find one about adding a new
    kernel call (I am seeking an explanatory tutorial, not just a
    quotation of steps).
    So, may you tell me where i can find such a paper-tutorial?
    (As far as i know, not even the "Minix book" contains such
    information..)

    Thanks..

  2. Re: Adding new Kernel Call

    > I've noticed that there are several tutorials arround about adding a
    > new system call in minix, but i couldn't find one about adding a new
    > kernel call (I am seeking an explanatory tutorial, not just a
    > quotation of steps).
    > So, may you tell me where i can find such a paper-tutorial?
    > (As far as i know, not even the "Minix book" contains such
    > information..)


    What works best for me: simply choose an existing kernel call
    (preferably one with most similar functionality and parameters) and
    search for all code concerning this call.

    For example, suppose you choose sys_kill. Search all the sources for
    this name. You will find:

    include/minix/com.h - definition of SYS_KILL kernel call number
    include/minix/syslib.h - prototype for sys_kill
    kernel/system/do_kill.c - implementation of sys_kill
    lib/syslib/Makefile.in - inclusion of sys_kill.c in $libsys_FILES
    lib/syslib/sys_kill.c - stub to call sys_kill from outside kernel

    This shows you'll need to create two files (equivalent to
    kernel/system/do_kill.c and lib/syslib/sys_kill.c), include them in the
    makefiles and add declarations similiar to existing ones in several
    other files.

    Now search again, this time for the names of the files you need to add
    equivalents of: do_kill.c and sys_kill.c. This allows you to locate the
    Makefiles you need to change. We already found lib/syslib/Makefile.in,
    and kernel/system/Makefile this way (as could have been expected).
    You'll need to add the new C files here to make sure they get compiled
    (if you don't, expect to see a linker error message).

    Now the kernel will still need to be able to find your call. Search for
    all references to do_kill (the kernel implementation of sys_kill) and
    SYS_KILL (the kernel call number):

    include/minix/com.h - aliases for parameter fields in message
    kernel/system.c - SYS_KILL gets mapped to do_kill
    kernel/system.h - prototype for do_kill
    kernel/table.c - permission bitmaps indicating which servers
    can use the SYS_KILL call

    (note: there is another do_kill in the PM, which is obviously
    irrelevant)

    This shows you all locations you need to modify (AFAIK) and some
    example code on which to base your kernel call and the required
    definitions.

    --
    With kind regards,
    Erik van der Kouwe

+ Reply to Thread