Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux Device DriversÔĶÁ±Ê¼Ç

Linux Device Drivers, 3rd Edition
2.3.1. User Space and Kernel Space
Äں˿ռäºÍÓû§¿Õ¼ä
Unix transfers execution from user space to kernel space whenever an application issues a system call or is suspended by a hardware interrupt. Kernel code executing a system call is working in the context of a process—it operates on behalf of the calling process and is able to access data in the process's address space. Code that handles interrupts, on the other hand, is asynchronous with respect to processes and is not related to any particular process.
ÕâÊǺܹؼüµÄ¶ÎÂ䣺
Unix¿ÉÒÔͨ¹ýϵͳµ÷ÓúÍÓ²¼þÖжÏʵÏÖ´ÓÓû§¿Õ¼äµ½Äں˿ռäµÄÇл»¡£¶ÔÓÚϵͳµ÷Óã¬Äں˴úÂëÔËÐÐÓÚµ÷Óýø³ÌµÄÉÏÏÂÎÄÖУ¬Äں˴úÂë¿ÉÒÔ·ÃÎʵ÷Óýø³ÌµÄÊý¾Ý¡£¶ÔÓÚÓ²¼þÖжϣ¬Äں˴úÂëÔËÐÐÓÚÖжÏÉÏÏÂÎÄ£¬¶ÀÁ¢ÓÚµ±Ç°±»´ò¶ÏµÄ½ø³Ì£¬ËùÒÔ´Ëʱ²»ÄÜ·ÃÎʱ»Öжϵĵ±Ç°½ø³Ì¿Õ¼äµÄÊý¾Ý¡£
´ÓÓû§¿Õ¼äÇл»µ½Äں˿ռäʱҪʹÓÃÄں˿ռä¶ÑÕ»,linuxÄں˿ռä¶ÑÕ»<8k, дÄں˳ÌÐòÒªÏ൱עÒâÕ»µÄʹÓá£
µ±ÏµÍ³´ÓÄں˿ռ䷵»Ø»òÕß´ÓÖжÏÉÏÏÂÎÄÖзµ»ØÓû§¿Õ¼äʱ£¬Èç¹ûÓÐÖØÐµ÷¶ÈÐèÇó£¬ÏµÍ³»á½øÐÐÖØÐµ÷¶È£¬¼´Óû§ÇÀÕ¼¡£
ϵͳ´¦ÓÚÖжÏÉÏÏÂÎÄ»òÕß½ø³Ì³ÖÓÐ×ÔÐýËøÊ±²»ÔÊÐíÄÚºËÇÀÕ¼¡£
ÄÚºËÇÀÕ¼Ò»°ã·¢ÉúÔÚ£¬
    1 µ±ÏµÍ³ÔÚÄں˿ռäÖ´ÐÐʱ£¬±»Ä³¸öÖжϴò¶Ï£¬µ±´ÓÕâ¸öÖжϷµ»ØÄں˿ռäʱ¡£
    2 Äں˿ռäÊÍ·Å×ÔÐýËøÊ±¡£
3.7. read and write
unsigned long copy_to_user(void _ _user *to,
const void *from,
unsigned long count);
unsigned long copy_from_user(void *to,
const void _ _user *from,
unsigned long count);
Although these functions behave like normal memcpy functions, a little extra care must be used when accessing user space from kernel code. The user pages being addressed might not be currently present in memory, and the virtual memory subsystem can put the process to sleep while the page is being transferred into place. This happens, for example, when the page must be retrieved from swap space.
Äں˿ռäºÍÓû§¿Õ¼ä¿½±´Êý¾Ýʱ


Ïà¹ØÎĵµ£º

LinuxÏÂÀûÓÃÌõ¼þ±äÁ¿ÊµÏÖ¶ÁÐ´Ëø

Ê×ÏȽéÉÜÏÂpthread_cond_t¡£ ÔÚLinuxϳÆÖ®Îª×´Ì¬±äÁ¿£¬ÓëÖ®Ïà¹ØµÄÓÐÏÂÃæ¼¸¸öAPI:
    int pthread_cond_init (pthread_cond_t *COND,pthread_condattr_t *cond_ATTR);
    int pthread_cond_signal (pthread_cond_t *COND);
    int pthread_cond_broadcast (pthread_con ......

LinuxÖÕ¶ËÉ豸Çý¶¯

ÎÄÕÂÀ´Ô´£ºhttp://blog.chinaunix.net/u3/94284/showart_1981110.html
ÔÚLinuxϵͳÖУ¬ÖÕ¶ËÉ豸·Ç³£ÖØÒª£¬Ã»ÓÐÖÕ¶ËÉ豸£¬ÏµÍ³½«ÎÞ·¨ÏòÓû§·´À¡ÐÅÏ¢£¬LinuxÖаüº¬¿ØÖÆÌ¨¡¢´®¿ÚºÍαÖÕ¶Ë3ÀàÖÕ¶ËÉ豸¡£
14.1ÖÕ¶ËÉ豸
    ÔÚLinuxϵͳÖУ¬ÖÕ¶ËÊÇÒ»ÖÖ×Ö·ûÐÍÉ豸£¬ËüÓжàÖÖÀàÐÍ£¬Í¨³£Ê¹ÓÃttyÀ´¼ò³Æ¸÷ÖÖÀàÐ͵ÄÖÕ¶ ......

¸ß¼¶Linux³ÌÐòÉè¼ÆµÚÈýÕ£º½ø³Ì

ÿ¸ö½ø³Ì¶¼ÓÐÒ»¸öΨһµÄ½ø³ÌºÅ¡£ ÿ¸ö½ø³Ì¶¼ÓÐÒ»¸ö¸¸½ø³Ì¡£ ϵͳÖеĽø³ÌÒÔÊ÷µÄÐÎʽ×éÖ¯£¬init½ø³Ì(½ø³ÌºÅΪ1)×÷Ϊ¸ù¡£ ½ø³Ì0Êǵ÷¶È½ø³Ì£¬Ã»ÓгÌÐòÓëÖ®¶ÔÓ¦£¬ÊÇÄں˵ÄÒ»²¿·Ö¡£ ½ø³Ì1ÊÇinit½ø³Ì£¬ÊÇÔÚϵͳÆô¶¯µÄ½×¶ÎÓÉÄÚºËÆô¶¯µÄ£¬¶ÔÓ¦/sbin/ini ......

VmwareÏÂLinuxµÄ°²×°¡¢ÉÏÍøÉèÖú͹²ÏíÎļþ¼Ð£¨×ª£©


Ò»¡¢             VmwareÏÂLinuxµÄ°²×°ºÍʹÓÃ
1.       ÏÂÔØLinux ¾µÏñ£¨isoÎļþ£©£¬ÎÒʹÓõÄÊÇRedHat Linux5 server¡£
2.       ÔÚVmwareÖÐн¨Ò»¸öÐéÄâ»ú
 
 
 
  ......

ºêÄÚºËÓë΢Äںˣ¬LinuxÄÚºËÓëUnixÄÚºË

 
²Ù×÷ϵͳÄں˿ÉÄÜÊÇ΢Äںˣ¬Ò²¿ÉÄÜÊǵ¥Äںˣ¨ºóÕßÓÐʱ³ÆÖ®ÎªºêÄÚºËMacrokernel£©¡£°´ÕÕÀàËÆ·â×°µÄÐÎʽ£¬ÕâЩÊõÓﶨÒåÈçÏ£º
 
 
µ¥ÄںˣºÒ²³ÆÎªºêÄںˡ£½«Äں˴ÓÕûÌåÉÏ×÷Ϊһ¸ö´ó¹ý³ÌʵÏÖ£¬²¢Í¬Ê±ÔËÐÐÔÚÒ»¸öµ¥¶ÀµÄµØÖ·¿Õ¼ä¡£ËùÓеÄÄں˷þÎñ¶¼ÔÚÒ»¸öµØÖ·¿Õ¼äÔËÐУ¬Ï໥֮¼äÖ±½Óµ÷Óú¯Êý£¬¼òµ¥¸ßЧ¡£Î¢Ä ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ