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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I've been wanting to learn how to write simple programs and library-like functions in assembly for a while, and now when I have some time to spare I thought I'd get to it. I have decided to use Gas as my assembler (don't try to talk me into using nasm. it won't work) and to work in the Linux environment. A few example programs have been written to understand the concept of basic looping and such, but now I've struck an obstacle. From what I can understand, I can't use processor interrupts since Linux runs in protected mode, so I have to use Linux syscalls. My problem is that the few tables of the available syscalls out there doesn't really explain (think novice tutorials...) exactly what type of values to put in which registers etc. I could translate it all from the manpages using my limited skills in C, but in the end all code ends up segfaulting on me, so now I'm wondering if any of you know of a site with info like this. Preferably in AT&T-syntax, but not necessary. I have visited most basic Linux assembly sites, but I probably havn't looked hard enough, because by the looks of it, the threshold to Linux assembly programming seems pretty high. If any of you could please help me find the information I need (or provide a bit of help) I'd be very grateful.
As I said, I have checked out the most basic websites and such, and I've read a few howtos and tutorials too. What I need is a table or tutorial which describes how to use all the Linux syscalls.
syscall number goes in eax, if there are <= 5 args they go in ebx, ecx, edx, esi, edi in taht order, >= 6 args the args get pushed onto the stack and the pointer to them goes in ebx. for a cool tutorial, see here: http://www.linuxassembly.org/article....html#Syscalls
there is this book...free...art of assembly by randall hyde ...
a great book for linux assembly coding.. http://webster.cs.ucr.edu/
as for how to use the system calls ....
and then, there is nothing like going through the kernel code to see how you can use the system calls.. interrupt 0x80 being raised and context switchin to kernel mode and so on...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.