Unreliable Guide To Hacking The Linux Kernel
Paul Rusty Russell
rusty@rustcorp.com.au
Copyright
© 2000 by
Paul Russell
Table of Contents
1.
Introduction
2.
The Players
User Context
Hardware Interrupts (Hard IRQs)
Software Interrupt Context: Bottom Halves, Tasklets, softirqs
3.
Some Basic Rules
4.
ioctls: Not writing a new system call
5.
Recipes for Deadlock
6.
Common Routines
printk()
include/linux/kernel.h
copy_[to/from]_user()
/
get_user()
/
put_user()
include/asm/uaccess.h
kmalloc()
/
kfree()
include/linux/slab.h
current
include/asm/current.h
udelay()
/
mdelay()
include/asm/delay.h
include/linux/delay.h
local_irq_save()
/
local_irq_restore()
include/asm/system.h
local_bh_disable()
/
local_bh_enable()
include/asm/softirq.h
smp_processor_id
()/
cpu_[number/logical]_map()
include/asm/smp.h
__init
/
__exit
/
__initdata
include/linux/init.h
__initcall()
/
module_init()
include/linux/init.h
module_exit()
include/linux/init.h
MOD_INC_USE_COUNT
/
MOD_DEC_USE_COUNT
include/linux/module.h
7.
Wait Queues
include/linux/wait.h
Declaring
Queuing
Waking Up Queued Tasks
8.
Atomic Operations
9.
Symbols
EXPORT_SYMBOL()
include/linux/module.h
EXPORT_SYMTAB
10.
Routines and Conventions
Double-linked lists
include/linux/list.h
Return Conventions
Breaking Compilation
Initializing structure members
GNU Extensions
C++
#if
11.
Putting Your Stuff in the Kernel
12.
Kernel Cantrips
13.
Thanks
Next
Introduction