亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? kernel-hacking.tmpl

?? ARM 嵌入式 系統 設計與實例開發 實驗教材 二源碼
?? TMPL
?? 第 1 頁 / 共 4 頁
字號:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]><book id="lk-hacking-guide"> <bookinfo>  <title>Unreliable Guide To Hacking The Linux Kernel</title>    <authorgroup>   <author>    <firstname>Paul</firstname>    <othername>Rusty</othername>    <surname>Russell</surname>    <affiliation>     <address>      <email>rusty@rustcorp.com.au</email>     </address>    </affiliation>   </author>  </authorgroup>  <copyright>   <year>2001</year>   <holder>Rusty Russell</holder>  </copyright>  <legalnotice>   <para>    This documentation is free software; you can redistribute    it and/or modify it under the terms of the GNU General Public    License as published by the Free Software Foundation; either    version 2 of the License, or (at your option) any later    version.   </para>      <para>    This program is distributed in the hope that it will be    useful, but WITHOUT ANY WARRANTY; without even the implied    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the GNU General Public License for more details.   </para>      <para>    You should have received a copy of the GNU General Public    License along with this program; if not, write to the Free    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,    MA 02111-1307 USA   </para>      <para>    For more details see the file COPYING in the source    distribution of Linux.   </para>  </legalnotice>  <releaseinfo>   This is the first release of this document as part of the kernel tarball.  </releaseinfo> </bookinfo> <toc></toc> <chapter id="introduction">  <title>Introduction</title>  <para>   Welcome, gentle reader, to Rusty's Unreliable Guide to Linux   Kernel Hacking.  This document describes the common routines and   general requirements for kernel code: its goal is to serve as a   primer for Linux kernel development for experienced C   programmers.  I avoid implementation details: that's what the   code is for, and I ignore whole tracts of useful routines.  </para>  <para>   Before you read this, please understand that I never wanted to   write this document, being grossly under-qualified, but I always   wanted to read it, and this was the only way.  I hope it will   grow into a compendium of best practice, common starting points   and random information.  </para> </chapter> <chapter id="basic-players">  <title>The Players</title>  <para>   At any time each of the CPUs in a system can be:  </para>  <itemizedlist>   <listitem>    <para>     not associated with any process, serving a hardware interrupt;    </para>   </listitem>   <listitem>    <para>     not associated with any process, serving a softirq, tasklet or bh;    </para>   </listitem>   <listitem>    <para>     running in kernel space, associated with a process;    </para>   </listitem>   <listitem>    <para>     running a process in user space.    </para>   </listitem>  </itemizedlist>  <para>   There is a strict ordering between these: other than the last   category (userspace) each can only be pre-empted by those above.   For example, while a softirq is running on a CPU, no other   softirq will pre-empt it, but a hardware interrupt can.  However,   any other CPUs in the system execute independently.  </para>  <para>   We'll see a number of ways that the user context can block   interrupts, to become truly non-preemptable.  </para>    <sect1 id="basics-usercontext">   <title>User Context</title>   <para>    User context is when you are coming in from a system call or    other trap: you can sleep, and you own the CPU (except for    interrupts) until you call <function>schedule()</function>.      In other words, user context (unlike userspace) is not pre-emptable.   </para>   <note>    <para>     You are always in user context on module load and unload,     and on operations on the block device layer.    </para>   </note>   <para>    In user context, the <varname>current</varname> pointer (indicating     the task we are currently executing) is valid, and    <function>in_interrupt()</function>    (<filename>include/asm/hardirq.h</filename>) is <returnvalue>false    </returnvalue>.     </para>   <caution>    <para>     Beware that if you have interrupts or bottom halves disabled      (see below), <function>in_interrupt()</function> will return a      false positive.    </para>   </caution>  </sect1>  <sect1 id="basics-hardirqs">   <title>Hardware Interrupts (Hard IRQs)</title>   <para>    Timer ticks, <hardware>network cards</hardware> and     <hardware>keyboard</hardware> are examples of real    hardware which produce interrupts at any time.  The kernel runs    interrupt handlers, which services the hardware.  The kernel    guarantees that this handler is never re-entered: if another    interrupt arrives, it is queued (or dropped).  Because it    disables interrupts, this handler has to be fast: frequently it    simply acknowledges the interrupt, marks a `software interrupt'    for execution and exits.   </para>   <para>    You can tell you are in a hardware interrupt, because     <function>in_irq()</function> returns <returnvalue>true</returnvalue>.     </para>   <caution>    <para>     Beware that this will return a false positive if interrupts are disabled      (see below).    </para>   </caution>  </sect1>  <sect1 id="basics-softirqs">   <title>Software Interrupt Context: Bottom Halves, Tasklets, softirqs</title>   <para>    Whenever a system call is about to return to userspace, or a    hardware interrupt handler exits, any `software interrupts'    which are marked pending (usually by hardware interrupts) are    run (<filename>kernel/softirq.c</filename>).   </para>   <para>    Much of the real interrupt handling work is done here.  Early in    the transition to <acronym>SMP</acronym>, there were only `bottom     halves' (BHs), which didn't take advantage of multiple CPUs.  Shortly     after we switched from wind-up computers made of match-sticks and snot,    we abandoned this limitation.   </para>   <para>    <filename class=headerfile>include/linux/interrupt.h</filename> lists the     different BH's.  No matter how many CPUs you have, no two BHs will run at     the same time. This made the transition to SMP simpler, but sucks hard for    scalable performance.  A very important bottom half is the timer    BH (<filename class=headerfile>include/linux/timer.h</filename>): you     can register to have it call functions for you in a given length of time.   </para>   <para>    2.3.43 introduced softirqs, and re-implemented the (now    deprecated) BHs underneath them.  Softirqs are fully-SMP    versions of BHs: they can run on as many CPUs at once as    required.  This means they need to deal with any races in shared    data using their own locks.  A bitmask is used to keep track of    which are enabled, so the 32 available softirqs should not be    used up lightly.  (<emphasis>Yes</emphasis>, people will    notice).   </para>   <para>    tasklets (<filename class=headerfile>include/linux/interrupt.h</filename>)     are like softirqs, except they are dynamically-registrable (meaning you     can have as many as you want), and they also guarantee that any tasklet     will only run on one CPU at any time, although different tasklets can     run simultaneously (unlike different BHs).     </para>   <caution>    <para>     The name `tasklet' is misleading: they have nothing to do with `tasks',      and probably more to do with some bad vodka Alexey Kuznetsov had at the      time.    </para>   </caution>   <para>    You can tell you are in a softirq (or bottom half, or tasklet)    using the <function>in_softirq()</function> macro     (<filename class=headerfile>include/asm/softirq.h</filename>).     </para>   <caution>    <para>     Beware that this will return a false positive if a bh lock (see below)     is held.    </para>   </caution>  </sect1> </chapter> <chapter id="basic-rules">  <title>Some Basic Rules</title>  <variablelist>   <varlistentry>    <term>No memory protection</term>    <listitem>     <para>      If you corrupt memory, whether in user context or      interrupt context, the whole machine will crash.  Are you      sure you can't do what you want in userspace?     </para>    </listitem>   </varlistentry>   <varlistentry>    <term>No floating point or <acronym>MMX</acronym></term>    <listitem>     <para>      The <acronym>FPU</acronym> context is not saved; even in user      context the <acronym>FPU</acronym> state probably won't      correspond with the current process: you would mess with some      user process' <acronym>FPU</acronym> state.  If you really want      to do this, you would have to explicitly save/restore the full      <acronym>FPU</acronym> state (and avoid context switches).  It      is generally a bad idea; use fixed point arithmetic first.     </para>    </listitem>   </varlistentry>   <varlistentry>    <term>A rigid stack limit</term>    <listitem>     <para>      The kernel stack is about 6K in 2.2 (for most      architectures: it's about 14K on the Alpha), and shared      with interrupts so you can't use it all.  Avoid deep      recursion and huge local arrays on the stack (allocate      them dynamically instead).     </para>    </listitem>   </varlistentry>   <varlistentry>    <term>The Linux kernel is portable</term>    <listitem>     <para>      Let's keep it that way.  Your code should be 64-bit clean,      and endian-independent.  You should also minimize CPU      specific stuff, e.g. inline assembly should be cleanly      encapsulated and minimized to ease porting.  Generally it      should be restricted to the architecture-dependent part of      the kernel tree.     </para>    </listitem>   </varlistentry>  </variablelist> </chapter> <chapter id="ioctls">  <title>ioctls: Not writing a new system call</title>  <para>   A system call generally looks like this  </para>  <programlisting>asmlinkage int sys_mycall(int arg) {        return 0; }  </programlisting>  <para>   First, in most cases you don't want to create a new system call.   You create a character device and implement an appropriate ioctl   for it.  This is much more flexible than system calls, doesn't have   to be entered in every architecture's   <filename class=headerfile>include/asm/unistd.h</filename> and   <filename>arch/kernel/entry.S</filename> file, and is much more   likely to be accepted by Linus.  </para>  <para>   If all your routine does is read or write some parameter, consider   implementing a <function>sysctl</function> interface instead.  </para>  <para>   Inside the ioctl you're in user context to a process.  When a   error occurs you return a negated errno (see   <filename class=headerfile>include/linux/errno.h</filename>),   otherwise you return <returnvalue>0</returnvalue>.  </para>  <para>   After you slept you should check if a signal occurred: the   Unix/Linux way of handling signals is to temporarily exit the   system call with the <constant>-ERESTARTSYS</constant> error.  The   system call entry code will switch back to user context, process   the signal handler and then your system call will be restarted   (unless the user disabled that).  So you should be prepared to   process the restart, e.g. if you're in the middle of manipulating   some data structure.  </para>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美婷婷六月丁香综合色| 国产婷婷色一区二区三区四区| 丝袜美腿一区二区三区| 一区二区三区在线视频观看| 中文字幕一区二区视频| 中文字幕电影一区| 久久久午夜精品| 久久日韩精品一区二区五区| 日韩欧美成人午夜| 亚洲精品一区二区三区影院| 精品国产一区二区三区四区四| 欧美精品乱码久久久久久按摩| 欧美人xxxx| 欧美日韩不卡在线| 欧美一区二区久久| 精品福利一区二区三区免费视频| 精品久久国产97色综合| 久久久久国产免费免费| 国产精品久久一卡二卡| 亚洲激情第一区| 午夜精品福利一区二区三区蜜桃| 日本不卡一区二区三区高清视频| 日本视频免费一区| 黄页视频在线91| 粉嫩在线一区二区三区视频| 99国产精品久久久久久久久久久| 在线中文字幕一区| 91精品国产综合久久久久久| 2019国产精品| 18欧美亚洲精品| 日日骚欧美日韩| 韩国av一区二区三区四区 | 成人深夜在线观看| 91老师片黄在线观看| 欧美亚洲禁片免费| 日韩欧美色电影| 中文字幕+乱码+中文字幕一区| 亚洲欧美乱综合| 男女男精品网站| 丁香网亚洲国际| 久久久久久久综合色一本| 国产精品伦一区二区三级视频| 亚洲永久精品大片| 国产一区视频在线看| 91极品美女在线| 精品国产成人系列| 亚洲国产美国国产综合一区二区| 国产精品综合一区二区| 欧美麻豆精品久久久久久| 国产亚洲成年网址在线观看| 天天操天天色综合| 91性感美女视频| 26uuuu精品一区二区| 亚洲国产精品麻豆| aaa国产一区| 精品久久久久一区二区国产| 一区二区成人在线观看| 国产激情91久久精品导航| 欧美日本视频在线| 亚洲色图欧美激情| 国产精华液一区二区三区| 欧美精品在线视频| 一区二区三区四区不卡在线| 成人午夜视频在线观看| 欧美电视剧在线看免费| 天堂在线亚洲视频| 欧美一a一片一级一片| 国产精品全国免费观看高清| 国产精选一区二区三区| 日韩三级在线免费观看| 三级一区在线视频先锋| 欧美视频在线观看一区二区| 午夜精品久久久久久不卡8050| 日本精品裸体写真集在线观看| 国产人成亚洲第一网站在线播放| 三级久久三级久久久| 欧美亚洲尤物久久| 亚洲品质自拍视频网站| 99久久久无码国产精品| 国产精品美女久久久久av爽李琼| 国产精品一二二区| 久久久精品一品道一区| 国产精品羞羞答答xxdd| 国产亚洲一本大道中文在线| 国产在线观看免费一区| 日韩精品专区在线影院观看 | 一区二区三区四区乱视频| 色婷婷综合久久久久中文一区二区| 国产精品欧美久久久久一区二区| 成人黄色电影在线 | 亚洲蜜臀av乱码久久精品蜜桃| 成人app在线观看| 日韩美女视频一区| 91高清在线观看| 亚洲午夜视频在线| 日韩美女视频在线| 国产在线国偷精品免费看| 中文字幕精品一区二区三区精品| 成人午夜av电影| 玉足女爽爽91| 91.麻豆视频| 精品一区二区久久久| 国产女人水真多18毛片18精品视频| 成人永久aaa| 亚洲午夜三级在线| 日韩女优毛片在线| 成人午夜在线播放| 亚洲成人动漫精品| 26uuu另类欧美| 99国产欧美另类久久久精品| 日韩专区中文字幕一区二区| 337p日本欧洲亚洲大胆色噜噜| 成人影视亚洲图片在线| 亚洲6080在线| 日本一区二区视频在线观看| 欧洲av一区二区嗯嗯嗯啊| 久久福利资源站| 亚洲欧美日韩久久精品| 欧美成人精品1314www| jlzzjlzz欧美大全| 久久er99精品| 一区二区三区中文字幕电影 | 国产一区三区三区| 一二三四社区欧美黄| 精品久久人人做人人爰| 99re8在线精品视频免费播放| 性欧美大战久久久久久久久| 国产欧美日韩激情| 欧美高清性hdvideosex| 99久久精品国产导航| 久久电影网电视剧免费观看| 亚洲久草在线视频| 久久夜色精品国产噜噜av| 欧美久久一二三四区| 99精品视频中文字幕| 激情av综合网| 亚洲午夜久久久久久久久久久| 国产欧美日韩激情| 久久综合成人精品亚洲另类欧美| 91精品福利在线| 99久久er热在这里只有精品66| 黄色资源网久久资源365| 午夜av一区二区| 亚洲视频图片小说| 国产精品卡一卡二| 日本一区二区综合亚洲| 欧美精品一区二区三区很污很色的 | 91丝袜美女网| 成人av网在线| 国产成人在线观看| 激情五月婷婷综合| 看电影不卡的网站| 男女性色大片免费观看一区二区| 亚洲sss视频在线视频| 一区二区三区四区高清精品免费观看 | 色94色欧美sute亚洲线路一久| 成人网在线播放| 粉嫩蜜臀av国产精品网站| 国产精品夜夜嗨| 国产精品夜夜嗨| 国产jizzjizz一区二区| 国产福利一区二区三区在线视频| 精品系列免费在线观看| 精品一区二区在线免费观看| 久热成人在线视频| 国产资源精品在线观看| 国产一区二区在线看| 国产suv精品一区二区883| 成人一道本在线| 一本色道亚洲精品aⅴ| 色av成人天堂桃色av| 欧美三级中文字幕在线观看| 欧美日韩激情一区二区三区| 欧美精品色综合| 欧美大片在线观看一区| 国产亚洲欧美日韩在线一区| 国产三级一区二区| 亚洲色图都市小说| 五月综合激情日本mⅴ| 日本免费新一区视频| 国产老肥熟一区二区三区| 成人app在线| 欧美综合一区二区三区| 日韩欧美久久久| 国产精品久久久久久久久搜平片 | 亚洲国产日韩在线一区模特| 日本一不卡视频| 国产一区 二区| 色哦色哦哦色天天综合| 777奇米成人网| 国产日韩欧美制服另类| 一区二区三区在线免费视频| 日韩国产一二三区| 波多野结衣在线一区| 欧美精品欧美精品系列| 国产午夜精品福利| 亚洲福利一二三区| 国产精品一级片在线观看| 欧美日韩在线精品一区二区三区激情| 欧美成人在线直播|