linuxÄÚºËÖпªÍ·´øÓÐ asmlinkage µÄº¯Êý±íʾʲô
Ç¿ÖÆÍ¨¹ý¶ÑÕ»´«µÝ²ÎÊý£¬²»ÒªÓüĴæÆ÷´«µÝ
×Ðϸ¿´Ò»ÏÂÓÐasmlinkageµÄµØ·½Í¨³£ÊÇϵͳµ÷Óõĺ¯Êý£¬ÒòΪÔÚϵͳµ÷ÓÃÖУ¬¼Ä´æÆ÷´ÓÓû§¿Õ¼ä´«¹ýÀ´ºóSAVE_ALLѹÈë¶ÑÕ»£¬½Ó×ŵ÷ÓÃÏàÓ¦µÄϵͳµ÷Óú¯Êý£¬ÕâÑùϵͳµ÷Óú¯ÊýÒ»¶¨Òª±£Ö¤ÊÇͨ¹ý¶ÑÕ»´«µÝ²ÎÊýµÄ
תÌùÒ»¶Î£º
The asmlinkage tag is one other thing that we should observe about this simple function. This is a #define for some gcc magic that tells the compiler that the function should not expect to find any of its arguments in registers (a common optimization), but only on the CPU's stack. Recall our earlier assertion that system_call consumes its first argument, the system call number, and allows up to four more arguments that are passed along to the real system call. system_call achieves this feat simply by leaving its other arguments (which were passed to it in registers) on the stack. All system calls are marked with the asmlinkage tag, so they all look to the stack for arguments. Of course, in sys_ni_syscall's case, this doesn't make any difference, because sys_ni_syscall doesn't take any arguments, but it's an issue for most other system calls. And, because you'll be seeing asmlinkage in front of many other functions, I thought you should know what it was about.
Ïà¹ØÎĵµ£º
Linux ÎļþºÍĿ¼µÄÊôÐÔ
×÷Õߣº±±ÄÏÄϱ±
À´×Ô£ºLinuxSir.Org
ÕªÒª£º±¾ÎĽ²ÊöµÄÊÇÎļþ»òĿ¼µÄÊôÐÔ£¬±ÈÈç½Úµãinode¡¢ÎļþÀàÐÍ¡¢ÎļþȨÏÞ¼°¹éÊô£»»¹¶Ôsetuid¡¢setgid¼°Õ³Ìùλ½øÐÐÁËÒ»°ãÐԵĽ²½â¡£¶Ôln ¡¢chmod¡¢umask¡¢chown¡¢chgrp ¡¢touch µÄÓ÷¨Ò²½øÐÐÁ˱ȽÏÏêϸµÄ˵Ã÷ºÍ¾ÙÀý£»
Ŀ¼
1¡¢ Linux ÎļþµÄÊôÐÔ¸ÅË ......
Linuxϵͳ¶¼ÊÇÒÔÎļþµÄÐÎʽÀ´·ÃÎÊÓ²¼þÉ豸µÄ£¬¸÷ÖÖÉ豸ÊÇÒÔϵͳÉ豸ÎļþµÄÐÎʽ´æÔÚÓÚϵͳÉ豸Ŀ¼£¯devÖеġ£ÕâЩÎļþÓÃÓÚ·ÃÎÊϵͳÖÐËùÓв»Í¬ÀàÐ͵ÄÓ²¼þ¡£ÀýÈ磬£¯dev£¯mouseÎļþ¶ÔÓ¦Êó±êÉ豸Îļþ£¬ÓÃÓÚ¶ÁÈ¡Êó±êÊäÈëµÄ£»£¯dev£¯fd0Îļþ¶ÔÓ¦ÈíÇýÉ豸Îļþ£¬ÓÃÓÚ´¦ÀíÈíÅ̶ÁдµÄ£»
LinuxÎļþϵͳÖÐÿ¸öÎļþÓà i½Úµã À´±êʶ£¬¹Ø ......
µ÷ÊÔ´úÂëµÄÄѶÈÊÇÊ״αàдÕâЩ´úÂëµÄÁ½±¶£¬Òò´Ë£¬Èç¹ûÄãÔÚ±àд´úÂëʱ¾ÍÒѾ·¢»ÓÁËÈ«²¿µÄ´Ï
Ã÷²ÅÖÇ£¬ÄÇô°´ÕÕ³£Àí£¬Ä㽫ÎÞ·¨Æ¾½è×Ô¼ºµÄÖÇ»ÛÈ¥µ÷ÊÔÕâЩ´úÂë¡£
......
linuxÊÇÒ»¸ö¸´ÔÓµÄÈí¼þϵͳ£¬ÆäÄÚºËÔ´´úÂëÍùÍù»áÓõ½Ò»Ð©ÔÚÓ¦ÓóÌÐòÉè¼ÆÖв¿³£¼ûÓïÑԳɷֺͱà³Ì¼¼ÇÉ£¬ÕâЩ¶¼ÊÇ·ÖÎöÄÚºËÔ´´úÂëµÄ»ù±¾¹¦£¬Ï£Íû´ó¼ÒÄÜÖØµãÕÆÎÕ¡£
Ê×ÏÈ£¬gcc±àÒëÆ÷´ÓÓïÑÔÀïÎüÊÕÁË“inline”ºÍ“const”¡£inlineº¯ÊýµÄ´óÁ¿Ê¹Óã¬ÓÐÀûÓÚÌá¸ßÔËÐ ......
ÈκÎÒ»¸öÓø߼¶ÓïÑÔ±àдµÄ²Ù×÷ϵͳ£¬ÆäÄÚºËÔ´´úÂëÖÐ×ÜÓÐÉÙ²¿·Ö´úÂëÊÇÓûã±àÓïÑÔ±àдµÄ¡£¶Á
¹ýUnix Sys VÔ´´úÂëµÄ¶ÁÕß¶¼ÖªµÀ£¬ÔÚÆäÔ¼3ÍòÐеĺËÐÄ´úÂëÖÐÓûã±àÓïÑÔ±àдµÄ´úÂëÔ¼2000ÐУ¬·Ö
³É²»µ½20¸öÀ©Õ¹ÃûΪ.sºÍ.mµÄÎļþ£¬ÆäÖд󲿷ÖÊǹØÓÚÖжÏÓëÒì³£´¦ÀíµÄµ×²ã³ÌÐò£¬»¹ÓоÍÊÇÓë³õʼ
»¯ÓÐ¹ØµÄ³Ì ......