Programming This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-24-2007, 05:28 AM
|
#1
|
|
LQ Newbie
Registered: Oct 2006
Posts: 8
Rep:
|
seeking docs for system calls in assembler
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
|
|
|
|
02-24-2007, 12:45 PM
|
#2
|
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,569
|
Point your browser at www.google.com/linux, and use the search terms: assembler "system calls". I got 47,000 returns.
|
|
|
|
02-24-2007, 01:06 PM
|
#3
|
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
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.
|
|
|
|
02-24-2007, 07:54 PM
|
#4
|
|
LQ Newbie
Registered: Oct 2006
Posts: 8
Original Poster
Rep:
|
Thnx for our reply, osor -
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
|
|
|
|
02-24-2007, 10:12 PM
|
#5
|
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
Quote:
|
Originally Posted by dsdarrow
Thnx for our reply, osor -
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
|
Do you have the section 2 manpages?
|
|
|
|
02-25-2007, 07:15 AM
|
#6
|
|
LQ Newbie
Registered: Oct 2006
Posts: 8
Original Poster
Rep:
|
Quote:
|
Originally Posted by osor
Do you have the section 2 manpages?
|
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?
Thanx again
-Doug
|
|
|
|
02-25-2007, 01:28 PM
|
#7
|
|
Member
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700
Rep:
|
I'd install the following:
Code:
manpages
manpages-dev
manpages-posix
manpages-posix-dev
You need the multiverse rep. for some of the above, see packages.ubuntu.com for details.
|
|
|
|
02-28-2007, 06:06 PM
|
#8
|
|
LQ Newbie
Registered: Oct 2006
Posts: 8
Original Poster
Rep:
|
Quote:
|
Originally Posted by introuble
I'd install the following:
Code:
manpages
manpages-dev
manpages-posix
manpages-posix-dev
You need the multiverse rep. for some of the above, see packages.ubuntu.com for details.
|
Thanks, I'm installing them now as we speak (er..sort-of)
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:15 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|