Book Image

Mastering Linux Kernel Development

By : CH Raghav Maruthi
Book Image

Mastering Linux Kernel Development

By: CH Raghav Maruthi

Overview of this book

Mastering Linux Kernel Development looks at the Linux kernel, its internal arrangement and design, and various core subsystems, helping you to gain significant understanding of this open source marvel. You will look at how the Linux kernel, which possesses a kind of collective intelligence thanks to its scores of contributors, remains so elegant owing to its great design. This book also looks at all the key kernel code, core data structures, functions, and macros, giving you a comprehensive foundation of the implementation details of the kernel’s core services and mechanisms. You will also look at the Linux kernel as well-designed software, which gives us insights into software design in general that are easily scalable yet fundamentally strong and safe. By the end of this book, you will have considerable understanding of and appreciation for the Linux kernel.
Table of Contents (19 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Hardware abstraction


Every system has at least one clock counter. As with any hardware device in a machine, this counter too is represented and managed by a structure. Hardware abstraction is provided by struct clocksource, defined in the include/linux/clocksource.h header file. This structure provides callbacks to access and handle power management on the counter through the read, enable, disable, suspend, and resume routines:

structclocksource{u64(*read)(structclocksource*cs);u64mask;u32mult;u32shift;u64max_idle_ns;u32maxadj;#ifdef CONFIG_ARCH_CLOCKSOURCE_DATAstructarch_clocksource_dataarchdata;#endifu64max_cycles;constchar*name;structlist_headlist;intrating;int(*enable)(structclocksource*cs);void(*disable)(structclocksource*cs);unsignedlongflags;void(*suspend)(structclocksource*cs);void(*resume)(structclocksource*cs);void(*mark_unstable)(structclocksource*cs);void(*tick_stable)(structclocksource*cs);/* private: */#ifdef CONFIG_CLOCKSOURCE_WATCHDOG/* Watchdog related data, used by the framework...