From: ÀîºêÁÁ (lihongliang070_at_tom.com)
Date: Thu May 07 2009 - 23:17:24 PDT
> These functions declared in libcr/cr_syscall.h are implemented in > libcr/cr_syscall.c, near the end of the file. The implementations are > done via macros that generate platform-specific inline assembly. For > instance: > > cri_syscall3(int, __cri_open, __NR_open, const char*, int, int) > > The inline assembly macros, such as cri_syscall3, are in > libcr/arch/*/cr_arch.h. > > -Paul Hello, Professor: Thank you very much for the explanation, But I have to bother you with another question about cri_syscall().which I really can not work it out for the whole morning... In the Linux kernel source code, there are many basic system calls, each system call correspond to a System call number, which stored in pointer array sys_call_table[] in the directory include/linux/sys.h. And when I want to invoke a system call, first use "int $0x80",then put System call number:__NR_name in the register %eax... However, when I want to write my own system calls, I need to definite new system call number, In BLCR, for example: __NR_open,__NR_close... But how can I notify the kernel that the system call I have defined together with the syscall number? I mean, the basic system call number are defined in "linux/include/unistd.h" in kernel source code, do I need to add my own number to this file?? how does it implemented in BLCR?? I can not see the code in BLCR which do this... It must be expatiatory...I just try to make the question clear, It's the first time I contact with Linux kernel, maybe It's simple, I really appreciate your reply...Thanks