What you'll learn
- Basics of Inline Assembly
- Writing examples for Inline Assembly
- Various places where inline assembly is used
- Adding a new system call to kernel
- Updating system call table
- VDSO and Virtual System Calls
Requirements
- Should have a basic understanding of Linux Kernel modules
- C language
Description
What will you learn from this course?
Basics of Inline Assembly
Types of Inline Assembly: Basic and Extended
GCC Assembly Syntax: AT&T
Constraint strings
Input and output operands
Clobbering
Various use cases of Inline assembly in Linux kernel: Interrupts, I/O Ports, Atomic operations, CPUID, Control Registers, Timestamp counters etc
Deep understanding of system calls: Various ways of switching from user space to kernel space (int $0x80, sysenter/sysexit, syscall/sysret)
VDSO
Adding a new system call which doesn't accept any arguments
Adding a system call which accept argument
Kernel Symbols and Kernel Symbol table
Writing a kernel module which overwrite the kernel symbol table
Writing a kernel module which sniffs the parameters passed to a system call
Examples covered in this course:
Add two numbers in inline assembly
Add three numbers in inline assembly
Subtract, divide, multiply in inline assembly
Can we disable/enable interrupts in user space
Checking whether interrupts are enabled and disabled in user space
Enabling/Disabling interrupts in user space
Implementing simple locking to avoid race conditions: Lock prefix, compare and exchange instructions
And many
Who this course is for:
- Linux Kernel Developers interested in gaining deep knowledge on how system call works
Course content
- Preview02:28
- Preview04:08
- Preview01:38
- 03:07GCC Basic Assembly Example
- 05:07GCC Assembly Syntax
- Preview02:36
- Preview02:33
- 08:04Constraint string
- 02:25Example of extended assembly
- Preview02:23
- 01:59What if i only have input operands
- 06:12Debugging Inline assembly using gdb
- 02:39Inline assembly example for add,sub,mul and div
- 02:43Inline assembly example for accessing memory
- 01:49Immediate integer operand
- 00:46Example of immediate integer operand
- 01:29Example of printing stack pointer
- 02:59Matching constraints
- 03:04Clobberring
- 03:13Example of cloberring
- 03:49Special specifiers in clobbering section
- 01:10Immediate I
- 00:56More constraints
- 02:30More Example of Inline Assembly
Instructor
I have been working on Linux for more than 7 years. I have seen many people still lack their skills on Linux. So, i am working on courses for Linux which will make them Learn Linux in an easy way. The agenda of my courses will be more practical and less theoretical. Show more examples and you will easily grab the concepts.
Order of Learning
1. Learn Linux User Space Debugging
2. Learn Linux Kernel Programming
3. Character Device Drivers in Deep
4. Memory management in Linux Kernel
5. Synchronization in Linux Kernel Programming
6. Linux Kernel Development Model and Compilation
7. Linux Device Drivers - Communicating with Hardware
8. Interrupts and Bottom Halves in Linux Kernel
9. System calls in deep
10. Timing Subsystem in deep
11. Embedded Linux using Yocto
12. Embedded Linux using Yocto Part 2
13. Embedded Linux using Yocto Part 3
14. Embedded Linux using Yocto Part 4
15. Testing Linux Kernel
16. Debugging Linux kernel in deep - Part 1
17. Debugging Linux kernel in deep - Part 2