Computer Science 635Course’s theme is…Normal C/C++ programmingSlide 4Linux Kernel ModulesRequirements/BenefitsCourse prerequisitesRecommended textsComputer Science 635Advanced Systems ProgrammingFall 2007Professor Allan CruseCourse’s theme is…“Using the computer to study the computer”Normal C/C++ programmingapplicationWe would write most of this source-code “app.cpp” but we would call some library-functions e.g., open(), read(), write(), malloc(), … then our code would get ‘linked’ with standard runtime libraries (So this is an example of “code reuse”)standard“runtime”librariescallretNormal C/C++ programmingapplicationstandard“runtime”librariescallretuser space kernel spaceOperating Systemkernelsyscallsysret Many standard library functions perform services that require executing privileged instructions (which only the kernel can do)Linux Kernel Modulesapplicationstandard“runtime”librariescallretuser space kernel spaceOperating Systemkernelsyscallsysretmodule Linux allows us to write our own installable kernel modulesand add them to a running systemcallretRequirements/Benefits•An LKM has to be written using “C” -- but can include “inline” assembly language•An LKM runs in kernel-space – so it can do anything that the CPU supports•So an LKM can ––directly control the peripheral devices–modify the kernel’s scheduling algorithms–examine the kernel’s hidden data-structuresCourse prerequisites•Be a CS Graduate Student •Be familiar with using Linux (or UNIX)•Be able to write programs in C (or C++) •Be able to use an assembler•Be acquainted with x86 architecture–General-purpose registers (EAX, EBX, …)–Categories of instructions (MOV, ADD, …)–Ways to address memory (direct, indirect,…)Recommended textsCorbet, Rubini, and Kroah-Hartman,Linux Device Drivers (3rd Ed),O’Reilly (2005), ISBN 0-596-00590-3Bovet and Cesati,Understanding the Linux Kernel (3rd Ed),O’Reilly (2006), ISBN
View Full Document