📄 1128.html
字号:
.long SYMBOL_NAME(sys_sigprocmask)<br>
.long SYMBOL_NAME(sys_create_module)<br>
.long SYMBOL_NAME(sys_init_module)<br>
.long SYMBOL_NAME(sys_delete_module)<br>
.long SYMBOL_NAME(sys_get_kernel_syms)/* 130 */<br>
.long SYMBOL_NAME(sys_quotactl)<br>
.long SYMBOL_NAME(sys_getpgid)<br>
.long SYMBOL_NAME(sys_fchdir)<br>
.long SYMBOL_NAME(sys_bdflush)<br>
.long SYMBOL_NAME(sys_sysfs)/* 135 */<br>
.long SYMBOL_NAME(sys_personality)<br>
.long SYMBOL_NAME(sys_ni_syscall)/* for afs_syscall */<br>
.long SYMBOL_NAME(sys_setfsuid)<br>
.long SYMBOL_NAME(sys_setfsgid)<br>
.long SYMBOL_NAME(sys_llseek)/* 140 */<br>
.long SYMBOL_NAME(sys_getdents)<br>
.long SYMBOL_NAME(sys_select)<br>
.long SYMBOL_NAME(sys_flock)<br>
.long SYMBOL_NAME(sys_msync)<br>
.long SYMBOL_NAME(sys_readv)/* 145 */<br>
.long SYMBOL_NAME(sys_writev)<br>
.long SYMBOL_NAME(sys_getsid)<br>
.long SYMBOL_NAME(sys_fdatasync)<br>
.long SYMBOL_NAME(sys_sysctl)<br>
.long SYMBOL_NAME(sys_mlock)/* 150 */<br>
.long SYMBOL_NAME(sys_munlock)<br>
.long SYMBOL_NAME(sys_mlockall)<br>
.long SYMBOL_NAME(sys_munlockall)<br>
.long SYMBOL_NAME(sys_sched_setparam)<br>
.long SYMBOL_NAME(sys_sched_getparam) /* 155 */<br>
.long SYMBOL_NAME(sys_sched_setscheduler)<br>
.long SYMBOL_NAME(sys_sched_getscheduler)<br>
.long SYMBOL_NAME(sys_sched_yield)<br>
.long SYMBOL_NAME(sys_sched_get_priority_max)<br>
.long SYMBOL_NAME(sys_sched_get_priority_min) /* 160 */<br>
.long SYMBOL_NAME(sys_sched_rr_get_interval)<br>
.long SYMBOL_NAME(sys_nanosleep)<br>
.long SYMBOL_NAME(sys_mremap)<br>
.long SYMBOL_NAME(sys_setresuid)<br>
.long SYMBOL_NAME(sys_getresuid)/* 165 */<br>
.long SYMBOL_NAME(sys_vm86)<br>
.long SYMBOL_NAME(sys_query_module)<br>
.long SYMBOL_NAME(sys_poll)<br>
.long SYMBOL_NAME(sys_nfsservctl)<br>
.long SYMBOL_NAME(sys_setresgid)/* 170 */<br>
.long SYMBOL_NAME(sys_getresgid)<br>
.long SYMBOL_NAME(sys_prctl)<br>
.long SYMBOL_NAME(sys_rt_sigreturn)<br>
.long SYMBOL_NAME(sys_rt_sigaction)<br>
.long SYMBOL_NAME(sys_rt_sigprocmask)/* 175 */<br>
.long SYMBOL_NAME(sys_rt_sigpending)<br>
.long SYMBOL_NAME(sys_rt_sigtimedwait)<br>
.long SYMBOL_NAME(sys_rt_sigqueueinfo)<br>
.long SYMBOL_NAME(sys_rt_sigsuspend)<br>
.long SYMBOL_NAME(sys_pread)/* 180 */<br>
.long SYMBOL_NAME(sys_pwrite)<br>
.long SYMBOL_NAME(sys_chown)<br>
.long SYMBOL_NAME(sys_getcwd)<br>
.long SYMBOL_NAME(sys_capget)<br>
.long SYMBOL_NAME(sys_capset) /* 185 */<br>
.long SYMBOL_NAME(sys_sigaltstack)<br>
.long SYMBOL_NAME(sys_sendfile)<br>
.long SYMBOL_NAME(sys_ni_syscall)/* streams1 */<br>
.long SYMBOL_NAME(sys_ni_syscall)/* streams2 */<br>
.long SYMBOL_NAME(sys_vfork) /* 190 */<br>
我们来继续看本行的三个参数:(,%eax,4),实现数组索引。当然,这个数组是以sys_call_table作为索<br>
引的,称为偏移。三个参数分别代表:数组的基地址,索引(eax,也就是系统调用数)和大小,或每个数<br>
组元素中的字节数-----这里是4。由于数组基地址为空,所以赋予0---但它需要和偏移地址sys_call_table相加,简单的说是sys_call_table被当作数组的基地址。我把本行用c重写如下:<br>
(sys_call_table)[EAX]();<br>
当然,c还要处理许多工作,如为你纪录数组元素的大小。不要忘记,系统调用的参数早已经存储在堆栈<br>
中了,以便于system_call使用SAVE_ALL把他们压栈。<br>
--------------------------------------------------------------------------------------------<br>
movl %eax,EAX(%esp)# 系统调用返回<br>
/*它在EAX寄存器中的返回值(这个值同时也是system_call的返回值)被存储了起来。返回值被存储在堆<br>
栈中的EAX内,以使得RESTORE_ALL可以迅速地恢复实际的EAX寄存器及其他寄存器的值。*/<br>
<br>
6月6日:<br>
以下代码依然是system_call的一部分,是一个可以命名为ret_from_sys_call和ret_from_intr的独立<br>
入口点。它们偶尔会被c直接调用,也可以从system_call的其他部分跳转过来。<br>
ALIGN<br>
.globl ret_from_sys_call<br>
.globl ret_from_intr<br>
ret_from_sys_call:<br>
movl SYMBOL_NAME(bh_mask),%eax<br>
andl SYMBOL_NAME(bh_active),%eax<br>
jne handle_bottom_half<br>
/*检测bottom half是否激活,如果激活,程序就跳转到handle_bottom_half执行,bottom half是中断进<br>
程的一部分,以后再提及,中断进程我的概念也很模糊。*/<br>
ret_with_reschedule:<br>
cmpl $0,need_resched(%ebx)/*检查进程是否为再次调度做了标记*/<br>
jne reschedule/*如果是,就跳转到reschedule*/<br>
cmpl $0,sigpending(%ebx)/*检查是否还有挂起信号*/<br>
jne signal_return/*如果有,则程序跳转到signal_return*/<br>
restore_all:<br>
RESTORE_ALL/*system_call的退出点,参看前面SAVE_ALL的用法*/<br>
<br>
ALIGN<br>
signal_return:/*当system_call从系统调用返回前,如果它检测到需要将信号传送给当前的进程时,才<br>
会执行到signal_return。它通过使中断再次可用开始执行。*/<br>
sti# we can get here from an interrupt handler<br>
testl $(VM_MASK),EFLAGS(%esp)/*检测是否返回虚拟8086模式*/<br>
movl %esp,%eax<br>
jne v86_signal_return/*如果是,就跳转到v86_signal_return(由于虚拟8086我也不太理解,<br>
所以就跳过了,:(*/<br>
xorl %edx,%edx /*system_call需要调用c函数do_signal来释放信号。do_signal需要两个参数<br>
,这两个参数都是通过寄存器来传递的;第一个是EAX寄存器,另一个是edx寄存器。system_call已经把<br>
第一个参数的值赋给了eax;现在,把edx寄存器和寄存器本身进行xor操作,从而将其清0,这样do_signal就认为这是一个空指针。*/<br>
call SYMBOL_NAME(do_signal) /*好,现在就可以调用do_signal来传递信号了*/<br>
jmp restore_all /*然后跳转到restore_all结束*/<br>
<br>
ALIGN<br>
v86_signal_return:<br>
call SYMBOL_NAME(save_v86_state)<br>
movl %eax,%esp<br>
xorl %edx,%edx<br>
call SYMBOL_NAME(do_signal)<br>
jmp restore_all<br>
<br>
ALIGN<br>
tracesys: /*前面说过,当有当前进程的系统调用被其祖先跟踪,如strace或truss程序,程序就跳转到<br>
此。*/<br>
movl $-ENOSYS,EAX(%esp) /*system_call把存储在堆栈中的EAX拷贝赋予-ENOSYS。*/<br>
call SYMBOL_NAME(syscall_trace) /*调用syscall_trace*/<br>
movl ORIG_EAX(%esp),%eax /*在172行再从所作的拷贝中恢复EAX的值*/<br>
call *SYMBOL_NAME(sys_call_table)(,%eax,4) /*调用实际的系统调用。*/<br>
movl %eax,EAX(%esp)/*把系统调用的返回值置入堆栈中EAX的位置。*/<br>
call SYMBOL_NAME(syscall_trace) /*再次调用syscall_trace*/<br>
jmp ret_from_sys_call /*被跟踪的系统调用已经返回,控制流程跳转到ret_from_sys_call*/<br>
badsys: /*前面说过,当系统调用数超过边界值时程序就跳转到这里。*/<br>
movl $-ENOSYS,EAX(%esp) /*这时system_call必须返回-ENOSYS,82行把ENOSYS赋值为38。调用<br>
者会识别这个错误*/<br>
jmp ret_from_sys_call /*跳转到ret_from_sys_call*/<br>
<br>
ALIGN<br>
ret_from_exception:/*在诸如除0之类的cpu异常中断情况下将执行到这里;system_call内部代码不会执<br>
行到这个标号*/<br>
movl SYMBOL_NAME(bh_mask),%eax<br>
andl SYMBOL_NAME(bh_active),%eax<br>
jne handle_bottom_half<br>
ALIGN<br>
ret_from_intr:<br>
GET_CURRENT(%ebx)<br>
movl EFLAGS(%esp),%eax# mix EFLAGS and CS<br>
movb CS(%esp),%al<br>
testl $(VM_MASK | 3),%eax# return to VM86 mode or non-supervisor?<br>
jne ret_with_reschedule<br>
jmp restore_all<br>
<br>
ALIGN<br>
handle_bottom_half:<br>
call SYMBOL_NAME(do_bottom_half)<br>
jmp ret_from_intr<br>
<br>
ALIGN<br>
reschedule:<br>
call SYMBOL_NAME(schedule) # test<br>
jmp ret_from_sys_call<br>
这以上的代码,我都还不太怎么明白,等我弄明白了就补齐,但基本的system_call的内部核心代码都介<br>
绍完了。<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -