mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "kernel coder" <lhrkernelcoder@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: system call implementation for x86_64
Date: Sat, 19 May 2007 04:55:12 -0700	[thread overview]
Message-ID: <f69849430705190455m4d62835fx9aed5a17df69c805@mail.gmail.com> (raw)

hi,

I'm trying to implement a system call for x86_64. Mine processor is
dual core opetron.There is very little material on web for
implementing system calls for x86_64 processor for 2.6 series kernel.I
tried to implement a new system call by observing the existing
implementation but to no success.Following are files names and changes
made.

//////////////////////////////////////////////////
file-> include/asm-x86_64/unistd.h

#define __NR_newcall        273
__SYSCALL(__NR_newcall, sys_newcall)

#define __NR_syscall_max __NR_newcall

//////////////////////////////////////////////////
file-> include/linux/syscalls.h

asmlinkage unsigned long sys_newcall(char __user *buf);

/////////////////////////////////////////////
file--> fs/read_write.c

asmlinkage unsigned long sys_newcall(char __user * buf){

     printk("new system call \n");
     ret 0;
}

EXPORT_SYMBOL_GPL(sys_write)


Please let me know where i'm doing wrong .Following is program which
is calling mine system call


#include <stdlib.h>
#include <stdio.h>
#include <sys/unistd.h>
#include <sys/syscall.h>

  long int ret;
   int num = 243;
  char  buffer=[20];

int main() {


  asm ("syscall;"
       : "=a" (ret)
       : "0" (num),
         "D" (buffer),
      );
 return ret;
}

When i call this ,nothing gets printed in file /var/log/messages.Am i
missing something ?

Actually i wana pass a pointer to kernel from user space.Later on data
will be copied to that memory location .i am thinking of using
copy_to_user for copying data.Buffer passed through system call will
be used by kernel function as circular ring.And portions of this ring
will get updated frequently even after system call has returned.

Is there any better way to do this?

             reply	other threads:[~2007-05-19 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-19 11:55 kernel coder [this message]
2007-05-21  5:46 ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f69849430705190455m4d62835fx9aed5a17df69c805@mail.gmail.com \
    --to=lhrkernelcoder@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®