Re: [PATCH] implement-system-call-mini-HOWTO.txt

From: Jan Engelhardt
Date: Mon Nov 13 2006 - 04:23:54 EST



On Nov 12 2006 22:14, Amit Choudhary wrote:
>+*How is it invoked?
>+--A library routine issues a trap to the OS by executing INT 0x80 assembly instruction.
>+--The system call number is passed through the EAX register.
>+--The arguments are passed through registers EBX, ECX, etc.

A nice short description, however, not all of the world runs x86 and may
not know E?X. Just mention that you will describe the process based on
x86.

>+*The Makefile in dir "mycall" will have only one line:
>+
>+#####Makefile Start#####
>+obj-y := mycall.o
>+#####Makefile End#######

I am tempted to use obj-y += mycall.o

Generally, one does not need a new directory for a new syscall, or a new
source file. You can edit kernel/sys.c if you like.

>+--Line 3:
>+ _syscall1(long, mycall, int, i)
>+ This is needed for system calls with 1 argument. It is explained in detail
>+ below.

This was deprecated in favor of syscall().

>+#include<stdio.h>
>+#include "testmycall.h"
>+
>+main()
>+{
>+ printf("%d\n", mycall(15));
>+}

Care to use ANSI C?


-`J'
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/