From: Eric Roman (ESRoman_at_berkeley_dot_edu)
Date: Fri May 08 2009 - 08:57:20 PDT
We didn't introduce a new system call to interact with the kernel, instead we use an ioctl() method on the control descriptor. We use the cri_syscall() methods to invoke the ioctl(). Among other things, this allows us to save registers on the stack for restart. Eric On Fri, May 08, 2009 at 02:17:24PM +0800, 李宏亮 wrote: > > > 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 > > > > > > =============================================== > TOM 1.5G ʲô [page] > ===============================================