Hi,
entry.S in kernel source is the file that contains all the logic which gets executed during any system call entry or return, but this whole file is written in assembly language. Well I know a bit of it, can understand the simple code written in it, but can not figure out anything out of entry.S. If somebody knows any good link which explains this file in detail, please let me know or if somebody can explain it in details, please do that.
Regards, Gaurav
Hi,
Entry.S contains the entry point for system calls, interrupts and exceptions. I dont know abot text defing in detail. I'll try to share what i know.
In i386, There is a interrupt descriptor table. It contains the entry points to the interrupt handlers(See intel manual for details). It is filled during startup using
/* traps.c */
set_intr_gate(2,&nmi);
set_system_gate(3,&int3);
2 is the interrupt number and &nmi is the entry point to jump to when exception 2 occurs. In i386 there are 256 interrupts max where 0-32 are exceptions others are free. Linux uses 0x80 for system call.
If you know i386 assembly, it wont be so difficult. It is for 2.4. 2.6 is quite similar but a lot of things has been added.
ENTRY(xx)
is the netry point for the exceptions and ENTRY(system_call) is the entry point for system call.
If Any exceptions occur, It begins executing from entry point. The exceptions entry point simply pushes the the entry point for c function which is in traps.c and jump to error_code.
error code mainly pdates es and ds to that of kernel. pushes esi(errorcode) and edx(pointer to pt_regs structure which points to pushed registers in the stack.). It then calls the c entry point.
Similarly,
System call entry point checks if it is valid system call and if it is calls to system call entry points. The entry points are put in an array of system call c entry points call sys_call_table.
After returning from system call it puts the return code to eax(remember original eax is in stack.)
Checks if the task needs rescheduling. if yes calls schedule.
Checks if it has pending signals. if yes serves that signal.
then returns to user.
I know a lot of things is missing. Not possible to say every piece in detail in single mail. I hope it will be a good start.
regards manish
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/