RE: Question about systemcall

Jan Stoess <[email protected]> Fri, 11 Jul 2008 11:14:26 +0200
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
Hello yjfpb04,


> i want to trace a syscall's route for example ThreadControl.
> from the top 
> convenience programming interface:DeassociateInterrupt() 
> calls 
> system-call funtion:ThreadControl() 

> In ThreadControl(). i saw the source code call __L4_ThreadCOntrol()
funtion.
> but i don't know how and where __L4_ThreadControl() is implement.?

__L4_ThreadControl is defined (for ia32) in usr/lib/l4/ia32-syscall-stubs.S

The idea here is to have a user-level library that initializes the syscall
addresses based on the relative mapping of the the KIP within the
application's address space. Whenever an application calls a syscall other
than L4_KernelInterface() the first time, the lib jumps in and first
executes an initialization procedure __L4_init_syscalls() in
usr/lib/l4/ia32-syscalls-init.cc to calculate the effective syscall symbols.

> and i read some sourcecode find that:
> the route is:
> SYSCALL_STUB(thread_control) -->then "int SYS_SYSCALL_NUM" to enter system
interrupt
> -->then jmp to IA32_EXC_NO_ERRORCODE(exc_user_syscall, 0).
> --> then call the sys_thread_control() implement funtion.
> am i correct?

Yes that's correct.

> and how jmp from __L4_ThreadControl() to SYSCALL_STUB(thread_control)?

That's done via a kernel-mapped syscall trampolines provided by the kernel.
The kernel basically maps the KIP + syscall trampolines into each address
space, and the user-level applications references them using the
initializion scheme described above. That way we are free to optimized the
kernel entry path without respecifying the kernel API.

Cheers,
-Jan
--
Jan Stoess
System Architecture Group
University of Karlsruhe
Phone: +49 (721) 608-4056
Fax: +49 (721) 608-7664
eMail: [email protected]



________________________________________
22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多
smime.p7s (application/x-pkcs7-signature, 3.1 KB) - not displayed