From the course: Linux Device Drivers: Reading, Writing, and Debugging
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Understand the user and kernel address spaces - Linux Tutorial
From the course: Linux Device Drivers: Reading, Writing, and Debugging
Understand the user and kernel address spaces
- [Instructor] Let's talk about address spaces. When you're writing a driver, you need to be aware of address spaces. Your driver code's going to run in the kernel address space. A process, opening up your device file, say, is running in user space. We can also say code running in the kernel is running in kernel mode. And so we have two different address spaces. That means virtual addresses have to be translated differently. Some implementations of Linux and some systems, they overlap pointers. So given literal pointer value could map at different places, maybe the kernel, maybe user space. Most instances of Linux, the kernel virtual addresses are distinct and they're much bigger values from user space. So by looking at a pointer literal value, you could tell if it's kernel or user space. But in user space, all the processes reuse the virtual addresses. So at virtual address and user space, we have to know which process to be able to translate it. And the kernel, of course, knows how…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Use device files3m 21s
-
(Locked)
Create device files2m 45s
-
(Locked)
Character device driver file operations4m 45s
-
(Locked)
Implementing operation functions7m 39s
-
(Locked)
Write a character device driver5m 29s
-
(Locked)
The /dev/null driver3m 44s
-
(Locked)
Understand the user and kernel address spaces5m 19s
-
(Locked)
Challenge: Write a character driver1m 53s
-
(Locked)
Solution: Write a character driver3m 53s
-
(Locked)
-
-
-
-