Sophie

Sophie

distrib > Fedora > 18 > x86_64 > media > updates > by-pkgid > 1a595394b241504ff370a8d12ebfcea7 > files > 3049

kernel-doc-3.11.10-100.fc18.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Chapter&#160;3.&#160;Some Basic Rules</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="Unreliable Guide To Hacking The Linux Kernel" /><link rel="up" href="index.html" title="Unreliable Guide To Hacking The Linux Kernel" /><link rel="prev" href="basics-softirqs.html" title="Software Interrupt Context: Softirqs and Tasklets" /><link rel="next" href="ioctls.html" title="Chapter&#160;4.&#160;ioctls: Not writing a new system call" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;3.&#160;Some Basic Rules</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="basics-softirqs.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="ioctls.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="basic-rules"></a>Chapter&#160;3.&#160;Some Basic Rules</h1></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">No memory protection</span></dt><dd><p>
      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?
     </p></dd><dt><span class="term">No floating point or <acronym class="acronym">MMX</acronym></span></dt><dd><p>
      The <acronym class="acronym">FPU</acronym> context is not saved; even in user
      context the <acronym class="acronym">FPU</acronym> state probably won't
      correspond with the current process: you would mess with some
      user process' <acronym class="acronym">FPU</acronym> state.  If you really want
      to do this, you would have to explicitly save/restore the full
      <acronym class="acronym">FPU</acronym> state (and avoid context switches).  It
      is generally a bad idea; use fixed point arithmetic first.
     </p></dd><dt><span class="term">A rigid stack limit</span></dt><dd><p>
      Depending on configuration options the kernel stack is about 3K to 6K for most 32-bit architectures: it's
      about 14K on most 64-bit archs, and often shared with interrupts
      so you can't use it all.  Avoid deep recursion and huge local
      arrays on the stack (allocate them dynamically instead).
     </p></dd><dt><span class="term">The Linux kernel is portable</span></dt><dd><p>
      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.
     </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="basics-softirqs.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="ioctls.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Software Interrupt Context: Softirqs and Tasklets&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Chapter&#160;4.&#160;ioctls: Not writing a new system call</td></tr></table></div></body></html>