Muutke küpsiste eelistusi

E-raamat: FreeBSD Device Drivers

  • Formaat: EPUB+DRM
  • Ilmumisaeg: 12-May-2012
  • Kirjastus: No Starch Press,US
  • Keel: eng
  • ISBN-13: 9781593274368
Teised raamatud teemal:
  • Formaat - EPUB+DRM
  • Hind: 36,04 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Lisa ostukorvi
  • Lisa soovinimekirja
  • See e-raamat on mõeldud ainult isiklikuks kasutamiseks. E-raamatuid ei saa tagastada.
  • Formaat: EPUB+DRM
  • Ilmumisaeg: 12-May-2012
  • Kirjastus: No Starch Press,US
  • Keel: eng
  • ISBN-13: 9781593274368
Teised raamatud teemal:

DRM piirangud

  • Kopeerimine (copy/paste):

    ei ole lubatud

  • Printimine:

    ei ole lubatud

  • Kasutamine:

    Digitaalõiguste kaitse (DRM)
    Kirjastus on väljastanud selle e-raamatu krüpteeritud kujul, mis tähendab, et selle lugemiseks peate installeerima spetsiaalse tarkvara. Samuti peate looma endale  Adobe ID Rohkem infot siin. E-raamatut saab lugeda 1 kasutaja ning alla laadida kuni 6'de seadmesse (kõik autoriseeritud sama Adobe ID-ga).

    Vajalik tarkvara
    Mobiilsetes seadmetes (telefon või tahvelarvuti) lugemiseks peate installeerima selle tasuta rakenduse: PocketBook Reader (iOS / Android)

    PC või Mac seadmes lugemiseks peate installima Adobe Digital Editionsi (Seeon tasuta rakendus spetsiaalselt e-raamatute lugemiseks. Seda ei tohi segamini ajada Adober Reader'iga, mis tõenäoliselt on juba teie arvutisse installeeritud )

    Seda e-raamatut ei saa lugeda Amazon Kindle's. 

Instructs readers on how to develop device drivers for the FreeBSD operating system, providing coverage of topics ranging from running modules and allocating memory to using control device communication and managing hardware resources, in a guide that also explains how to write PCI, SCSI and USB device drivers. Original.

Device drivers make it possible for your software to communicate with your hardware, and because every operating system has specific requirements, driver writing is nontrivial. When developing for FreeBSD, you've probably had to scour the Internet and dig through the kernel sources to figure out how to write the drivers you need. Thankfully, that stops now.

In FreeBSD Device Drivers, Joseph Kong will teach you how to master everything from the basics of building and running loadable kernel modules to more complicated topics like thread synchronization. After a crash course in the different FreeBSD driver frameworks, extensive tutorial sections dissect real-world drivers like the parallel port printer driver.

You'll learn:

All about Newbus, the infrastructure used by FreeBSD to manage the hardware devices on your system

How to work with ISA, PCI, USB, and other buses

The best ways to control and communicate with the hardware devices from user space

How to use Direct Memory Access (DMA) for maximum system performance

The inner workings of the virtual null modem terminal driver, the USB printer driver, the Intel PCI Gigabit Ethernet adapter driver, and other important drivers

How to use Common Access Method (CAM) to manage host bus adapters (HBAs)

Concise descriptions and extensive annotations walk you through the many code examples. Don't waste time searching man pages or digging through the kernel sources to figure out how to make that arcane bit of hardware work with your system. FreeBSD Device Drivers gives you the framework that you need to write any driver you want, now.

Device drivers make it possible for your software to communicate with your hardware, and because every operating system has specific requirements, driver writing is nontrivial. When developing for FreeBSD, you've probably had to scour the Internet and dig through the kernel sources to figure out how to write the drivers you need. Thankfully, that stops now. In FreeBSD Device Drivers, Joseph Kong will teach you how to master everything from the basics of building and running loadable kernel modules to more complicated topics like thread synchronization. After a crash course in the different FreeBSD driver frameworks, extensive tutorial sections dissect real-world drivers like the parallel port printer driver.

You'll learn:

  • All about Newbus, the infrastructure used by FreeBSD to manage the hardware devices on your system
  • How to work with ISA, PCI, USB, and other buses
  • The best ways to control and communicate with the hardware devices from user space
  • How to use Direct Memory Access (DMA) for maximum system performance
  • The inner workings of the virtual null modem terminal driver, the USB printer driver, the Intel PCI Gigabit Ethernet adapter driver, and other important drivers
  • How to use Common Access Method (CAM) to manage host bus adapters (HBAs)

Concise descriptions and extensive annotations walk you through the many code examples. Don't waste time searching man pages or digging through the kernel sources to figure out how to make that arcane bit of hardware work with your system. FreeBSD Device Drivers gives you the framework that you need to write any driver you want, now.

Arvustused

"At last, a definitive and authoritative book on FreeBSD device drivers! Kong's clear mastery of his subject shines through every page." Michael Lucas, FreeBSD committer and author of Absolute FreeBSD

"FreeBSD Device Drivers is an excellent guide to the APIs used to write a device driver for FreeBSD." John Baldwin, Kernel Developer, FreeBSD

"I'd recommend the book for anybody that needs an introduction to drivers. The walk throughs will get people up to speed, as well as introduce many of the uniquely FreeBSD quirks one needs to know to integrate with FreeBSD." Warner Losh, FreeBSD core team 

"I am pleased to see No Starch provide a forum for books like this. They continue to produce high-quality works that read well and address subjects seldom found elsewhere." Richard Bejtlich, CSO of Mandiant & Founder of TaoSecurity

"I like this book. It fills a definite need, and does it well." Warren Block, FreeBSD committer 

"This book is definitely a must have for anybody interested in how FreeBSD device drivers are designed, not to mention those who are interested in writing their very own ones for the FreeBSD operating system!" Romain Tartière, FreeBSD ports committer

"This book is a no nonsense, straight to the point document that helps you get to the content quickly." BeginLinux.com 

"Definitely an excellent book with all the information youll need to start developing your own FreeBSD device drivers." xorl 

"Strikes a pretty good balance for its stated purpose. Its mostly 'just the facts maam' style works well, but it provides plenty of references for those wanting more detail or background. This is definitely worth a read if device drivers in FreeBSD are something you need or want to know about." Simon Gerraty, FreeBSD Journal

About The Author And The Technical Reviewer xvii
Foreword xix
John Baldwin
Acknowledgments xxi
Introduction xxiii
Who Is This Book For?
xxiii
Prerequisites
xxiv
Contents at a Glance
xxiv
Welcome Aboard!
xxv
1 Building And Running Modules 1(16)
Types of Device Drivers
1(1)
Loadable Kernel Modules
2(3)
Module Event Handler
2(1)
DECLARE_MODULE Macro
3(2)
Hello, world!
5(1)
Compiling and Loading
6(1)
Character Drivers
7(3)
d foo Functions
7(1)
Character Device Switch Table
8(1)
make_dev and destroy_dev Functions
9(1)
Mostly Harmless
10(5)
echo write Function
12(1)
echo_read Function
13(1)
echo modevent Function
14(1)
DEV_MODULE Macro
15(1)
Don't Panic
15(1)
Block Drivers Are Gone
15(1)
Conclusion
16(1)
2 Allocating Memory 17(10)
Memory Management Routines
17(2)
malloc_iype Structures
19(1)
MALLOC DEFINE Macro
19(1)
MALLOC_DECIARE Macro
20(1)
Tying Everything Together
20(2)
Contiguous Physical Memory Management Routines
22(1)
A Straightforward Example
23(2)
Conclusion
25(2)
3 Device Communication And Control 27(26)
ioctl
28(1)
Defining ioctl Commands
29(1)
Implementing ioctl
30(7)
echo_write Function
34(1)
echo_set_buffer_size Function
35(1)
echo_ioctl Function
36(1)
echo_modevent Function
36(1)
Don't Panic
37(1)
Invoking ioctl
37(3)
sysctl
40(1)
Implementing sysctls, Part 1
41(3)
sysctl Context Management Routines
44(1)
Creating Dynamic sysctls
44(3)
SYSCTL_STATIC_CHILDREN Macro
47(1)
SYSCTL_CHILDREN Macro
47(1)
Implementing sysctls, Part 2
47(5)
sysctl_set_buffer_size Function
50(2)
Don't Panic
52(1)
Conclusion
52(1)
4 Thread Synchronization 53(30)
A Simple Synchronization Problem
54(1)
A More Complex Synchronization Problem
54(11)
race_new Function
58(1)
race_find Function
58(1)
race_destroy Function
59(1)
race_ioctl Function
59(1)
race_modevent Function
60(1)
The Root of the Problem
61(4)
Preventing Race Conditions
65(1)
Mutexes
65(1)
Spin Mutexes
65(1)
Sleep Mutexes
66(1)
Mutex Management Routines
66(2)
Implementing Mutexes
68(5)
race modevent Function
71(1)
Don't Panic
72(1)
Shared/Exclusive Locks
73(1)
Shared/Exclusive Lock Management Routines
73(2)
Implementing Shared/Exclusive Locks
75(3)
Reader/Writer Locks
78(1)
Reader/Writer Lock Management Routines
78(1)
Condition Variables
79(1)
Condition Variable Management Routines
80(1)
General Guidelines
81(1)
Avoid Recursing on Exclusive Locks
81(1)
Avoid Holding Exclusive Locks for Long Periods of Time
82(1)
Conclusion
82(1)
5 Delaying Execution 83(16)
Voluntary Context Switching, or Sleeping
83(2)
Implementing Sleeps and Condition Variables
85(7)
sleep_modevent Function
88(1)
load Function
89(1)
sleep_thread Function
90(1)
sysctl_debug_sleep_test Function
91(1)
unload Function
91(1)
Don't Panic
92(1)
Kernel Event Handlers
92(2)
Callouts
94(2)
Callouts and Race Conditions
96(1)
Taskqueues
96(2)
Global Taskqueues
97(1)
Taskqueue Management Routines
97(1)
Conclusion
98(1)
6 Case Study: Virtual Null Modem 99(14)
Prerequisites
100(1)
Code Analysis
100(12)
nmdm_modevent Function
103(1)
nmdm_clone Function
104(1)
nmdm_alloc Function
105(1)
nmdm_outwakeup Function
106(1)
nmdm_taskity Function
106(2)
nmdm_inwakeup Function
108(1)
nmdm_modem Function
108(1)
nmdm_param Function
109(2)
nmdm_timeout Function
111(1)
bits_per_char Function
111(1)
Don't Panic
112(1)
Conclusion
112(1)
7 Newbus And Resource Allocation 113(12)
Autoconfiguration and Newbus Drivers
113(4)
device_foo Functions
114(1)
Device Method Table
115(1)
DRIVER MODULE Macro
116(1)
Tying Everything Together
117(5)
foo_pci_probe Function
120(1)
foo_pci_attach Function
120(1)
d_foo Functions
121(1)
foo_pci_detach Function
121(1)
Don't Panic
122(1)
Hardware Resource Management
122(2)
Conclusion
124(1)
8 Interrupt Handling 125(16)
Registering an Interrupt Handler
125(1)
Interrupt Handlers in FreeBSD
126(1)
Implementing an Interrupt Handler
127(11)
pint_identify Function
132(1)
pint_probe Function
132(1)
pint_attach Function
133(1)
pint_detach Function
134(1)
pint_open Function
134(1)
pint_close Function
135(1)
pint write Function
136(1)
pint_read Function
136(1)
pint intr Function
137(1)
Don't Panic
138(1)
Generating Interrupts on the Parallel Port
138(1)
Conclusion
139(2)
9 Case Study: Parallel Port Printer Driver 141(24)
Code Analysis
141(22)
lpt_identify Function
146(1)
lpt_probe Function
146(1)
lpt_detect Function
147(1)
lpt_port test Function
148(1)
lpt_attach Function
148(2)
lpt_detach Function
150(1)
lpt_open Function
151(2)
lpt_read Function
153(1)
lpt_write Function
154(2)
lpt_intr Function
156(2)
lpt_timeout Function
158(1)
lpt_push_bytes Function
158(1)
lpt_close Function
159(1)
lpt_ioctl Function
160(2)
lpt_request ppbus Function
162(1)
lpt_release_ppbus Function
162(1)
Conclusion
163(2)
10 Managing And Using Resources 165(18)
I/O Ports and I/O Memory
165(7)
Reading from I/O Ports and I/O Memory
166(1)
Writing to I/O Ports and I/O Memory
167(2)
Stream Operations
169(3)
Memory Barriers
172(1)
Tying Everything Together
172(10)
led_identify Function
177(1)
led_probe Function
177(1)
led_attach Function
178(1)
led_detach Function
178(1)
led_open Function
179(1)
led_close Function
180(1)
led_read Function
180(1)
led_write Function
181(1)
Conclusion
182(1)
11 Case Study: Intelligent Platform Management Interface Driver 183(10)
Code Analysis
183(8)
ipmi_pci_probe Function
185(1)
ipmi_pci_match Function
186(1)
ipmi_pci_attach Function
187(2)
ipmi2_pci_probe Function
189(1)
ipmi2_pci_attach Function
189(2)
Conclusion
191(2)
12 Direct Memory Access 193(14)
Implementing DMA
194(3)
Initiating a DMA Data Transfer
196(1)
Dismantling DMA
196(1)
Creating DMA Tags
197(1)
Tearing Down DMA Tags
198(1)
DMA Map Management Routines, Part 1
199(1)
Loading (DMA) Buffers into DMA Maps
199(3)
bus_dma_segment Structures
199(1)
bus_dmamap_load Function
200(1)
bus_dmamap_load_mbuf Function
201(1)
bus_dmamap_load_mbuf sg Function
201(1)
bus_dmamap_load_uio Function
202(1)
bus dmamap_unload Function
202(1)
DMA Map Management Routines, Part 2
202(1)
A Straightforward Example
203(2)
Synchronizing DMA Buffers
205(1)
Conclusion
205(2)
13 Storage Drivers 207(18)
disk Structures
207(3)
Descriptive Fields
208(1)
Storage Device Methods
209(1)
Mandatory Media Properties
209(1)
Optional Media Properties
209(1)
Driver Private Data
210(1)
disk Structure Management Routines
210(1)
Block I/O Structures
210(2)
Block I/O Queues
212(1)
Tying Everything Together
213(10)
at45d_attach Function
217(1)
at45d_delayed attach Function
218(1)
ati5d_get_info—Function
219(1)
at45d_wait_for_device_ready Function
220(1)
at45d_get status Function
220(1)
at45d_strategy Function
221(1)
at45d_task Function
221(2)
Block I/O Completion Routines
223(1)
Conclusion
223(2)
14 Common Access Method 225(32)
How CAM Works
226(1)
A (Somewhat) Simple Example
227(15)
mfip_attach Function
234(1)
mfip_detach Function
235(1)
mfip_action Function
236(2)
mfip_poll Function
238(1)
mfip_start Function
238(2)
mfip_clone Function
240(2)
SIM Registration Routines
242(1)
cam_simq_alloc Function
242(1)
cam_sim_alloc Function
242(1)
xpt_bus_register Function
243(1)
Action Routines
243(12)
XPT PATH INQ
243(2)
XPT_RESET BUS
245(1)
XPT_GET TRAN_SETTINGS
246(3)
XPT_SET_TRAN_SETTINGS
249(1)
XPT_SCSI_IO
250(5)
XPT_RESa_DEV
255(1)
Conclusion
255(2)
15 USB Drivers 257(26)
About USB Devices
257(1)
More About USB Devices
258(1)
USB Configuration Structures
259(3)
Mandatory Fields
260(1)
Optional Fields
260(1)
USB Transfer Flags
261(1)
USB Transfers (in FreeBSD)
262(2)
USB Configuration Structure Management Routines
264(1)
USB Methods Structure
265(1)
Tying Everything Together
266(16)
ulpt_probe Function
270(1)
ulpt_attach Function
271(2)
ulpt_detach Function
273(1)
ulpt-open Function
273(1)
ulpt_reset Function
274(1)
unlpt_open Function
275(1)
ulpt_close Function
276(1)
ulpt_ioctl Function
276(1)
ulpt_watchdog Function
277(1)
ulpt_start_read Function
277(1)
ulpt_stop_read Function
278(1)
ulpt_start_write Function
278(1)
ulpt_stop_write Function
278(1)
ulpt_write_callback Function
279(1)
ulpt_read_callback Function
280(1)
ulpt_status_callback Function
281(1)
Conclusion
282(1)
16 Network Drivers, Part 1: Data Structures 283(16)
Network Interface Structures
283(3)
Network Interface Structure Management Routines
286(3)
ether_ifattach Function
287(1)
ether_ifdetach Function
288(1)
Network Interface Media Structures
289(1)
Network Interface Media Structure Management Routines
289(2)
Hello, worldI
291(2)
mbuf Structures
293(1)
Message Signaled Interrupts
294(1)
Implementing MSI
294(3)
MSI Management Routines
297(1)
Conclusion
297(2)
17 Network Drivers, Part 2: Packet Reception And Transmission 299(10)
Packet Reception
299(5)
em_rxeof Function
300(3)
em_handle_rx Function
303(1)
Packet Transmission
304(3)
em_start_locked Function
304(1)
em_txeof Function
305(2)
Post Packet Transmission
307(1)
Conclusion
308(1)
References 309(2)
Index 311
The author of Designing BSD Rootkits (No Starch Press), Joseph Kong works on information security, operating system theory, reverse code engineering, and vulnerability assessment. Kong is a former system administrator for the City of Toronto.