Linux MIPS Architecture development
 help / color / mirror / Atom feed
* system call implementation for 64 bit
@ 2007-05-19 11:56 kernel coder
  2007-05-19 18:53 ` Kumba
  0 siblings, 1 reply; 2+ messages in thread
From: kernel coder @ 2007-05-19 11:56 UTC (permalink / raw)
  To: linux-mips

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?


shahzad

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: system call implementation for 64 bit
  2007-05-19 11:56 system call implementation for 64 bit kernel coder
@ 2007-05-19 18:53 ` Kumba
  0 siblings, 0 replies; 2+ messages in thread
From: Kumba @ 2007-05-19 18:53 UTC (permalink / raw)
  To: kernel coder; +Cc: linux-mips

kernel coder wrote:
> 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.
> 

I have a chunk of code to consider:


if (x86_64 != mips) {
	__go_away(now);
}


It's really quite an intuitive piece of code.


--Kumba

-- 
Gentoo/MIPS Team Lead

"Such is oft the course of deeds that move the wheels of the world: small hands 
do them because they must, while the eyes of the great are elsewhere."  --Elrond

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-19 18:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-19 11:56 system call implementation for 64 bit kernel coder
2007-05-19 18:53 ` Kumba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox