ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi All,
I'm learning Assembly Language ( or rather RE-learning it as I did some asm programming about 17 yrs ago - on DOS!) using NASM in Linux. What I'm looking for is documentation on the system calls and c calls under Linux. I've found some little documentation on linuxassembly.org and links from there but nearly everything points back at the .c source listings for my system. Trouble is, the sources were not installed on my system. (Ubuntu Edgy Eft) /usr/src/ (which is supposedly the usual location of the source files) contains only the .h header files. Anyone got any idea where I can find documentation for this stuff? What little I HAVE found is for the 2.2 kernel and most of the Linux world is up to 2.4 or 2.6
tia for any help.
-Doug
The system calls and their respective numbers are located in the header file <asm/unistd.h> (/usr/include/asm/unistd.h or /usr/src/linux/include/asm/unistd.h). The documentation for these system calls should be in system calls manpages (category 2).
E.g., for i386, the system call for read is 3 (__NR_read is defined as 3). To find documentation for it, type in terminal “man 2 read” and in the synopsis, it shows the first argument is the file descriptor, the second argument is the buffer into which you read, and the third argument is the number of bytes to be read. For i386, the syscall number should be put in the register eax, the various arguments should be put into the registers ebx, ecx, and edx respectively, and after making the system call (interrupt 0x80), the return value will be in eax.
I haave managed to locate the actual call nums in the .h files but I've got several listins of those call numbers. The problem is I have nothing listing what args a supposed to be passed where. This is supposed to be docuemented in the actual .c source files and I don't have the .c sources.
And, yes I've already tried Googleing for the sys calls but they all point back at the source files. ( at least all that I've checked out. I haven't checked them all yet)
Thanx for the replies though. I'll keep trying.
-Doug
I haave managed to locate the actual call nums in the .h files but I've got several listins of those call numbers. The problem is I have nothing listing what args a supposed to be passed where. This is supposed to be docuemented in the actual .c source files and I don't have the .c sources.
And, yes I've already tried Googleing for the sys calls but they all point back at the source files. ( at least all that I've checked out. I haven't checked them all yet)
Thanx for the replies though. I'll keep trying.
-Doug
Hi,osor-
to answer your last Q, no I don't have the section 2 man pages. I managed to locate and install the kernel sources. This is a help because with careful reading I can gain some understand of what the calls are doing, but my knowledge of c is rudimentary at best so it's rather slow going.
Do the man pages offer a better/more understandable explanation of what's needed for the sys_calls? If so, where can I get these man pages?
The first two give you the syscall numbers and prototypes. The system calls themselves seem to be spread round the kernel (presumably in the relevant subsystems) - the third file is an example for read(2) and write(2), which are called sys_read() and sys_write() in the kernel.
The site indexes and hyperlinks the whole kernel source, so you can browse it easily (only up to version 2.6.18 at the moment).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.