Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the "linux-2.6.3x.x/include/asm-generic/' for?

My os-book says that if you want to add a system call to the Linux kernel, edit the linux-2.x/include/asm-i386/unistd.h.

But the linux kernel's source structure seems to change a lot. In the linux-2.6.34.1 version kernel source tree, I only find a linux-2.6.34.1/include/asm-generic/unistd.h and linux-2.6.34.1/arch/x86/include/asm/unistd.h.

It seems that editing the latter one make more sense.

My question is what the /inlcude/asm-generic is for? How can asm related code be generic?

like image 977
Zifei Tong Avatar asked Jul 14 '10 15:07

Zifei Tong


1 Answers

asm-generic is a generic versions of functions usually coded in assembly, but coded in plain C, without any inline assembly. It's probably made for easy porting of the kernel to new platforms, and to keep platfom-independent common code in one place.

like image 65
Dr. Snoopy Avatar answered Sep 22 '22 03:09

Dr. Snoopy