how to add new kernel call ? (not system call) - Minix

This is a discussion on how to add new kernel call ? (not system call) - Minix ; Hey all, i have already successfully added a system call to minix 3 but i would like to now add a kernel call. What i have done so far is : 1) added to /usr/src/kernel/system.c : map(SYS_MYCALL, do_mycall); 2) added ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: how to add new kernel call ? (not system call)

  1. how to add new kernel call ? (not system call)

    Hey all,
    i have already successfully added a system call to minix 3 but i would
    like to now add a kernel call.
    What i have done so far is :

    1) added to /usr/src/kernel/system.c :

    map(SYS_MYCALL, do_mycall);

    2) added to /usr/src/kernel/system.h :

    _PROTOTYPE( int do_mycall, (message *m_ptr) );

    3) added the do_mycall.c implementation file inside /usr/src/kernel/
    system/

    4) added to Makefile inside /usr/src/kernel/system :

    $(SYSTEM)(do_mycall.o) \ (after the corresponding lines)

    $(SYSTEM)(do_mycall.o): do_mycall.c
    $(CC) do_mycall.c

    5) added to /usr/src/include/minix/com.h

    #define SYS_MYCALL (KERNEL_CALL) + 31

    #define NR_SYS_CALLS 32 ( instead of 31 which was the previous
    value )

    6) then i did :

    cd /usr/src
    make includes
    cd /usr/src/kernel/system
    make
    cd /usr/src/kernel
    make

    and here (at this last make) i get the following:
    /usr/lib/em_led: /usr/lib/i386//libc.a(exit.o): _exit: multiply
    defined (error)
    make in /usr/src/kernel: Exit code 1

    So i am guessing i have forgotten to do something... Any directions ?





  2. Re: how to add new kernel call ? (not system call)

    > So i am guessing i have forgotten to do something... Any directions ?

    Just a general comment: it is easiest to use the Makefile in
    /usr/src/tools to build and install the operating system. It will do
    all these things in the right sequence. To make sure that everything is
    rebuit i always use "make fresh install" there, but in principle
    "fresh" should not be needed in your case.

  3. Re: how to add new kernel call ? (not system call)

    On Mar 18, 12:07*am, "Erik van der Kouwe" few.vu.nl>
    wrote:
    > > So i am guessing i have forgotten to do something... Any directions ?

    >
    > Just a general comment: it is easiest to use the Makefile in
    > /usr/src/tools to build and install the operating system. It will do
    > all these things in the right sequence. To make sure that everything is
    > rebuit i always use "make fresh install" there, but in principle
    > "fresh" should not be needed in your case.


    I have used that too but without success. I get the exact same error.

  4. Re: how to add new kernel call ? (not system call)

    In article <5d829114-e708-4919-b349-df7b6364fbb3@i12g2000prf.googlegroups.com>,
    wrote:
    >and here (at this last make) i get the following:
    >/usr/lib/em_led: /usr/lib/i386//libc.a(exit.o): _exit: multiply
    >defined (error)
    >make in /usr/src/kernel: Exit code 1
    >
    >So i am guessing i have forgotten to do something... Any directions ?


    Do you try to call printf in your code?


    --
    That was it. Done. The faulty Monk was turned out into the desert where it
    could believe what it liked, including the idea that it had been hard done
    by. It was allowed to keep its horse, since horses were so cheap to make.
    -- Douglas Adams in Dirk Gently's Holistic Detective Agency

  5. Re: how to add new kernel call ? (not system call)

    On Mar 18, 4:42*am, phi...@ue.aioy.eu (Philip Homburg) wrote:
    > In article <5d829114-e708-4919-b349-df7b6364f...@i12g2000prf.googlegroups.com>,
    >
    > * wrote:
    > >and here (at this last make) i get the following:
    > >/usr/lib/em_led: /usr/lib/i386//libc.a(exit.o): _exit: multiply
    > >defined (error)
    > >make in /usr/src/kernel: Exit code 1

    >
    > >So i am guessing i have forgotten to do something... Any directions ?

    >
    > Do you try to call printf in your code?
    >
    > --
    > That was it. Done. The faulty Monk was turned out into the desert where it
    > could believe what it liked, including the idea that it had been hard done
    > by. It was allowed to keep its horse, since horses were so cheap to make.
    > * * * * -- Douglas Adams in Dirk Gently's Holistic Detective Agency


    yes but even if i didn't, how is it possible to check the function if
    the necessary parts don't even compile ?
    the problem is at compile-time not run-time.



  6. Re: how to add new kernel call ? (not system call)

    In article <758d290f-4689-42e5-89e0-e0c8273264ef@59g2000hsb.googlegroups.com>,
    wrote:
    >yes but even if i didn't, how is it possible to check the function if
    >the necessary parts don't even compile ?
    >the problem is at compile-time not run-time.


    You can't use printf in the kernel. Use kprintf instead.

    --
    That was it. Done. The faulty Monk was turned out into the desert where it
    could believe what it liked, including the idea that it had been hard done
    by. It was allowed to keep its horse, since horses were so cheap to make.
    -- Douglas Adams in Dirk Gently's Holistic Detective Agency

  7. Re: how to add new kernel call ? (not system call)

    minix.shadow@gmail.com wrote:
    > yes but even if i didn't, how is it possible to check the function if
    > the necessary parts don't even compile ?
    > the problem is at compile-time not run-time.


    No. The problem is actually at link time. Your code compiles just fine but
    the linker gets confused by multiple definitions of the same function that
    don't match up while linking. As Philip said, use kprintf inside the
    kernel.

    Regards,

    Jens


    --
    Jens de Smit
    Student Computer Science | Vrije Universiteit Amsterdam
    jfdsmit@few.vu.nl | http://www.few.vu.nl/~jfdsmit
    "[In the end, people] get furious at IT that the goddamn magic isn't working"
    -- Stewart Dean

+ Reply to Thread