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

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

?? kernel-hacking.tmpl

?? ARM 嵌入式 系統 設計與實例開發 實驗教材 二源碼
?? TMPL
?? 第 1 頁 / 共 4 頁
字號:
  <programlisting>if (signal_pending())         return -ERESTARTSYS;  </programlisting>  <para>   If you're doing longer computations: first think userspace. If you   <emphasis>really</emphasis> want to do it in kernel you should   regularly check if you need to give up the CPU (remember there is   cooperative multitasking per CPU).  Idiom:  </para>  <programlisting>if (current-&gt;need_resched)        schedule(); /* Will sleep */   </programlisting>  <para>   A short note on interface design: the UNIX system call motto is   "Provide mechanism not policy".  </para> </chapter> <chapter id="deadlock-recipes">  <title>Recipes for Deadlock</title>  <para>   You cannot call any routines which may sleep, unless:  </para>  <itemizedlist>   <listitem>    <para>     You are in user context.    </para>   </listitem>   <listitem>    <para>     You do not own any spinlocks.    </para>   </listitem>   <listitem>    <para>     You have interrupts enabled (actually, Andi Kleen says     that the scheduling code will enable them for you, but     that's probably not what you wanted).    </para>   </listitem>  </itemizedlist>  <para>   Note that some functions may sleep implicitly: common ones are   the user space access functions (*_user) and memory allocation   functions without <symbol>GFP_ATOMIC</symbol>.  </para>  <para>   You will eventually lock up your box if you break these rules.    </para>  <para>   Really.  </para> </chapter> <chapter id="common-routines">  <title>Common Routines</title>  <sect1 id="routines-printk">   <title>    <function>printk()</function>    <filename class=headerfile>include/linux/kernel.h</filename>   </title>   <para>    <function>printk()</function> feeds kernel messages to the    console, dmesg, and the syslog daemon.  It is useful for debugging    and reporting errors, and can be used inside interrupt context,    but use with caution: a machine which has its console flooded with    printk messages is unusable.  It uses a format string mostly    compatible with ANSI C printf, and C string concatenation to give    it a first "priority" argument:   </para>   <programlisting>printk(KERN_INFO "i = %u\n", i);   </programlisting>   <para>    See <filename class=headerfile>include/linux/kernel.h</filename>;    for other KERN_ values; these are interpreted by syslog as the    level.  Special case: for printing an IP address use   </para>   <programlisting>__u32 ipaddress;printk(KERN_INFO "my ip: %d.%d.%d.%d\n", NIPQUAD(ipaddress));   </programlisting>   <para>    <function>printk()</function> internally uses a 1K buffer and does    not catch overruns.  Make sure that will be enough.   </para>   <note>    <para>     You will know when you are a real kernel hacker     when you start typoing printf as printk in your user programs :)    </para>   </note>   <!--- From the Lions book reader department -->    <note>    <para>     Another sidenote: the original Unix Version 6 sources had a     comment on top of its printf function: "Printf should not be     used for chit-chat".  You should follow that advice.    </para>   </note>  </sect1>  <sect1 id="routines-copy">   <title>    <function>copy_[to/from]_user()</function>    /    <function>get_user()</function>    /    <function>put_user()</function>    <filename class=headerfile>include/asm/uaccess.h</filename>   </title>     <para>    <emphasis>[SLEEPS]</emphasis>   </para>   <para>    <function>put_user()</function> and <function>get_user()</function>    are used to get and put single values (such as an int, char, or    long) from and to userspace.  A pointer into userspace should    never be simply dereferenced: data should be copied using these    routines.  Both return <constant>-EFAULT</constant> or 0.   </para>   <para>    <function>copy_to_user()</function> and    <function>copy_from_user()</function> are more general: they copy    an arbitrary amount of data to and from userspace.    <caution>     <para>      Unlike <function>put_user()</function> and      <function>get_user()</function>, they return the amount of      uncopied data (ie. <returnvalue>0</returnvalue> still means      success).     </para>    </caution>    [Yes, this moronic interface makes me cringe.  Please submit a    patch and become my hero --RR.]   </para>   <para>    The functions may sleep implicitly. This should never be called    outside user context (it makes no sense), with interrupts    disabled, or a spinlock held.   </para>  </sect1>  <sect1 id="routines-kmalloc">   <title><function>kmalloc()</function>/<function>kfree()</function>    <filename class=headerfile>include/linux/slab.h</filename></title>   <para>    <emphasis>[MAY SLEEP: SEE BELOW]</emphasis>   </para>   <para>    These routines are used to dynamically request pointer-aligned    chunks of memory, like malloc and free do in userspace, but    <function>kmalloc()</function> takes an extra flag word.    Important values:   </para>   <variablelist>    <varlistentry>     <term>      <constant>       GFP_KERNEL      </constant>     </term>     <listitem>      <para>       May sleep and swap to free memory. Only allowed in user       context, but is the most reliable way to allocate memory.      </para>     </listitem>    </varlistentry>        <varlistentry>     <term>      <constant>       GFP_ATOMIC      </constant>     </term>     <listitem>      <para>       Don't sleep. Less reliable than <constant>GFP_KERNEL</constant>,       but may be called from interrupt context. You should       <emphasis>really</emphasis> have a good out-of-memory       error-handling strategy.      </para>     </listitem>    </varlistentry>        <varlistentry>     <term>      <constant>       GFP_DMA      </constant>     </term>     <listitem>      <para>       Allocate ISA DMA lower than 16MB. If you don't know what that       is you don't need it.  Very unreliable.      </para>     </listitem>    </varlistentry>   </variablelist>   <para>    If you see a <errorname>kmem_grow: Called nonatomically from int    </errorname> warning message you called a memory allocation function    from interrupt context without <constant>GFP_ATOMIC</constant>.    You should really fix that.  Run, don't walk.   </para>   <para>    If you are allocating at least <constant>PAGE_SIZE</constant>    (<filename class=headerfile>include/asm/page.h</filename>) bytes,    consider using <function>__get_free_pages()</function>    (<filename class=headerfile>include/linux/mm.h</filename>).  It    takes an order argument (0 for page sized, 1 for double page, 2    for four pages etc.) and the same memory priority flag word as    above.   </para>   <para>    If you are allocating more than a page worth of bytes you can use    <function>vmalloc()</function>.  It'll allocate virtual memory in    the kernel map.  This block is not contiguous in physical memory,    but the <acronym>MMU</acronym> makes it look like it is for you    (so it'll only look contiguous to the CPUs, not to external device    drivers).  If you really need large physically contiguous memory    for some weird device, you have a problem: it is poorly supported    in Linux because after some time memory fragmentation in a running    kernel makes it hard.  The best way is to allocate the block early    in the boot process via the <function>alloc_bootmem()</function>    routine.   </para>   <para>    Before inventing your own cache of often-used objects consider    using a slab cache in    <filename class=headerfile>include/linux/slab.h</filename>   </para>  </sect1>  <sect1 id="routines-current">   <title><function>current</function>    <filename class=headerfile>include/asm/current.h</filename></title>   <para>    This global variable (really a macro) contains a pointer to    the current task structure, so is only valid in user context.    For example, when a process makes a system call, this will    point to the task structure of the calling process.  It is    <emphasis>not NULL</emphasis> in interrupt context.   </para>  </sect1>  <sect1 id="routines-udelay">   <title><function>udelay()</function>/<function>mdelay()</function>     <filename class=headerfile>include/asm/delay.h</filename>      <filename class=headerfile>include/linux/delay.h</filename>    </title>   <para>    The <function>udelay()</function> function can be used for small pauses.    Do not use large values with <function>udelay()</function> as you risk    overflow - the helper function <function>mdelay()</function> is useful    here, or even consider <function>schedule_timeout()</function>.   </para>   </sect1>   <sect1 id="routines-endian">   <title><function>cpu_to_be32()</function>/<function>be32_to_cpu()</function>/<function>cpu_to_le32()</function>/<function>le32_to_cpu()</function>     <filename class=headerfile>include/asm/byteorder.h</filename>    </title>   <para>    The <function>cpu_to_be32()</function> family (where the "32" can    be replaced by 64 or 16, and the "be" can be replaced by "le") are    the general way to do endian conversions in the kernel: they    return the converted value.  All variations supply the reverse as    well: <function>be32_to_cpu()</function>, etc.   </para>   <para>    There are two major variations of these functions: the pointer    variation, such as <function>cpu_to_be32p()</function>, which take    a pointer to the given type, and return the converted value.  The    other variation is the "in-situ" family, such as    <function>cpu_to_be32s()</function>, which convert value referred    to by the pointer, and return void.   </para>   </sect1>  <sect1 id="routines-local-irqs">   <title><function>local_irq_save()</function>/<function>local_irq_restore()</function>    <filename class=headerfile>include/asm/system.h</filename>   </title>   <para>    These routines disable hard interrupts on the local CPU, and    restore them.  They are reentrant; saving the previous state in    their one <varname>unsigned long flags</varname> argument.  If you    know that interrupts are enabled, you can simply use    <function>local_irq_disable()</function> and    <function>local_irq_enable()</function>.   </para>  </sect1>  <sect1 id="routines-softirqs">   <title><function>local_bh_disable()</function>/<function>local_bh_enable()</function>    <filename class=headerfile>include/asm/softirq.h</filename></title>   <para>    These routines disable soft interrupts on the local CPU, and    restore them.  They are reentrant; if soft interrupts were    disabled before, they will still be disabled after this pair    of functions has been called.  They prevent softirqs, tasklets    and bottom halves from running on the current CPU.   </para>  </sect1>  <sect1 id="routines-processorids">   <title><function>smp_processor_id</function>()/<function>cpu_[number/logical]_map()</function>    <filename class=headerfile>include/asm/smp.h</filename></title>      <para>    <function>smp_processor_id()</function> returns the current    processor number, between 0 and <symbol>NR_CPUS</symbol> (the    maximum number of CPUs supported by Linux, currently 32).  These    values are not necessarily continuous: to get a number between 0    and <function>smp_num_cpus()</function> (the number of actual    processors in this machine), the    <function>cpu_number_map()</function> function is used to map the    processor id to a logical number.    <function>cpu_logical_map()</function> does the reverse.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99麻豆久久久国产精品免费| 麻豆精品在线播放| 日韩1区2区日韩1区2区| 韩国v欧美v亚洲v日本v| 精品国产一区二区三区久久影院| 日韩国产欧美在线播放| 欧美怡红院视频| 国产精品欧美久久久久无广告| 日韩和欧美一区二区三区| 欧美日韩中文字幕一区二区| 亚洲色图在线看| 欧美午夜在线一二页| 国产激情91久久精品导航| www.欧美日韩国产在线| 奇米影视在线99精品| 亚洲自拍都市欧美小说| 国产欧美一区二区在线| 精品国产三级电影在线观看| 欧美日韩视频不卡| 91首页免费视频| 国产成人高清在线| 狠狠色丁香婷婷综合| 日本成人在线看| 亚洲一区二区三区中文字幕| 自拍偷拍国产精品| 国产日韩精品一区二区三区| 26uuu久久综合| 日韩无一区二区| 欧美精品久久一区二区三区| 在线欧美日韩精品| 色先锋久久av资源部| 91年精品国产| 91免费在线视频观看| 99精品国产99久久久久久白柏| 国产成人亚洲精品狼色在线| 国内精品不卡在线| 精品一区精品二区高清| 久久国产综合精品| 精品一区二区日韩| 经典三级视频一区| 国产综合色精品一区二区三区| 美腿丝袜亚洲色图| 国内精品嫩模私拍在线| 国产精品影视在线| 国产精品18久久久久久久网站| 国产一区二区不卡老阿姨| 黄色日韩网站视频| 国产精品88av| 99国产精品久久久久久久久久| av成人动漫在线观看| 91亚洲男人天堂| 色av综合在线| 欧美精品自拍偷拍动漫精品| 91精品国产综合久久久久久久久久 | 九九九久久久精品| 国产一区三区三区| 成人精品高清在线| 一本久久精品一区二区| 欧美人成免费网站| 欧美不卡一区二区三区四区| 国产农村妇女毛片精品久久麻豆 | 欧美亚州韩日在线看免费版国语版| 色天使色偷偷av一区二区| 欧美性一区二区| 日韩免费一区二区| 国产精品乱人伦中文| 亚洲一区二区精品视频| 秋霞av亚洲一区二区三| 国产精品1024| 色成年激情久久综合| 91精品国产色综合久久不卡电影| 久久久噜噜噜久久中文字幕色伊伊| 国产精品欧美久久久久一区二区| 一区二区三区四区在线| 蜜桃一区二区三区在线观看| 国产精品综合在线视频| 91黄色免费版| 欧美变态凌虐bdsm| 亚洲女同一区二区| 麻豆精品一区二区| 不卡欧美aaaaa| 欧美酷刑日本凌虐凌虐| 国产校园另类小说区| 亚洲午夜视频在线观看| 国产精品一区二区果冻传媒| 91福利在线播放| 精品国产髙清在线看国产毛片 | 日韩经典一区二区| 高清成人在线观看| 欧美日产国产精品| 国产免费观看久久| 香蕉成人伊视频在线观看| 国产成人日日夜夜| 日韩一区二区三区四区| 亚洲乱码中文字幕| 国产在线国偷精品产拍免费yy | 欧美妇女性影城| 国产精品免费人成网站| 奇米综合一区二区三区精品视频| 99久久精品国产导航| 久久综合视频网| 婷婷夜色潮精品综合在线| 国产成人免费视频网站高清观看视频| 欧美久久久久中文字幕| 亚洲男人的天堂在线aⅴ视频| 国产一区二区美女诱惑| 在线不卡a资源高清| 亚洲码国产岛国毛片在线| 国产精品一区二区在线观看网站| 欧美美女bb生活片| 亚洲欧洲综合另类| 国产盗摄视频一区二区三区| 欧美一区二区三区日韩| 亚洲国产精品久久久久婷婷884| 成人综合婷婷国产精品久久蜜臀| 日韩欧美一区在线观看| 午夜精品久久久久久久久| 91色.com| 亚洲丝袜精品丝袜在线| 国产a级毛片一区| 久久先锋影音av鲁色资源网| 麻豆精品久久精品色综合| 欧美精品vⅰdeose4hd| 亚洲图片欧美综合| 91黄色免费观看| 亚洲免费色视频| 91美女片黄在线观看| 国产精品区一区二区三区 | 在线影院国内精品| 亚洲视频免费在线| 99精品久久免费看蜜臀剧情介绍| 国产欧美日韩精品一区| 国产传媒欧美日韩成人| 久久精品一级爱片| 国产成人精品综合在线观看| 国产亚洲欧美在线| 成人做爰69片免费看网站| 国产清纯在线一区二区www| 国产成人夜色高潮福利影视| 国产欧美一区二区精品仙草咪| 国产精品18久久久久| 欧美激情综合在线| 粉嫩绯色av一区二区在线观看| 中文字幕成人网| 99国产精品久久| 亚洲一区二区视频在线| 91麻豆精品国产综合久久久久久| 日本色综合中文字幕| 精品日韩在线观看| 国产经典欧美精品| 亚洲欧洲日韩综合一区二区| 色偷偷久久一区二区三区| 一区二区三区精品久久久| 欧美日韩一区二区三区视频| 日本伊人色综合网| 亚洲精品一区二区三区蜜桃下载| 国产精一区二区三区| 亚洲视频免费看| 欧美精品在线观看播放| 国内久久精品视频| 亚洲日本中文字幕区| 欧美日韩精品是欧美日韩精品| 美女网站视频久久| 国产亚洲欧美一级| 在线观看一区不卡| 久久精品国产久精国产爱| 国产欧美视频在线观看| 91丨porny丨户外露出| 日韩精品三区四区| 国产视频一区二区三区在线观看| 色综合久久久久综合体| 免费成人av在线播放| 国产精品你懂的| 欧美日精品一区视频| 国产在线精品一区二区夜色| 综合激情网...| 日韩三级视频中文字幕| 成人app网站| 日韩va亚洲va欧美va久久| 日本一区二区三区电影| 精品视频1区2区3区| 国产成人在线看| 午夜一区二区三区在线观看| 国产日产精品1区| 在线不卡一区二区| 成人97人人超碰人人99| 免费成人你懂的| 一区二区在线观看免费| 日韩一级黄色大片| 精品在线视频一区| 91免费版在线| 国产日韩欧美一区二区三区综合| 亚洲电影第三页| 欧美群妇大交群中文字幕| 亚洲成a人片在线观看中文| 久久美女高清视频| 欧美三级韩国三级日本三斤 | 国产精品1区2区| 图片区小说区区亚洲影院| 国产精品视频看|