flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Linux > GNU C library vs POSIX in assembly

Author
Thread Post new topic Reply to topic
axlucas



Joined: 02 May 2014
Posts: 64
Location: Argentina
GNU C library vs POSIX in assembly
Hi, guys. I'm trying to get to understand the Linux internals so I can more comfortably program in assembly. Please correct me if I'm wrong. I've read that you can interface with the kernel both through the int 80h (or syscall, for 64bit) functions, which is called POSIX API and through the GNU C library, which is part of the GNU system (whether the GNU C library is part of the Linux kernel, though, I don't know and I assume not). Apparently, most sources suggest going for the high level API (i.e.: the C library), but the reason for this choice is not clear, especially when programming in assembly. So my first question is... can I comfortably choose any of the two options and stay cool that it will always work?

From here, I got to a second question. I understand that ALSA, the sound system, is actually part of the kernel... a module which comes bundled when you download the kernel and install it. Am I right? But I know there is also the ALSA library (I have a different question about that I will post separately). My question here is, is it at all possible, and in a way that's guaranteed not to change, to access the ALSA module via the POSIX API, without relying on the ALSA library?

Any comment, not just answering these questions, but even criticising and explaining why I'm totally wrong or confused will be highly appreciated!! Very Happy
Post 06 Mar 2016, 21:52
View user's profile Send private message Reply with quote
alkap



Joined: 18 Feb 2015
Posts: 34
Location: Dnipro, Ukraine
(1). You can interface with the kernel via system calls, as well as via libc. See fasm/examples/elfexe/, and fasm/examples/libcdemo/ for details.
(2). While I have not done any ALSA programming myself, I would dare say that you would have to invoke the functions supplied by the ALSA API from within your assembly code to interact with the sound system.
Hopefully, someone else who may have done some ALSA programming may respond in a more informed way.
Post 07 Mar 2016, 08:09
View user's profile Send private message Send e-mail Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 395
axlucas

syscall 64-bit reference is using C interface, regardless. So whatever you do in Linux, you'll probably end up with C or work around C anyway. If u insist on using syscall, then you need to hack your way into all those equates, structs, constants and similar C stuff. It is fun and challenging, but you are entering into some unchartered territory which is working against your 'working comfortably in assembly' intention.

For 32-but int 80s, I think JohnFound can help you with the assembly reference.

ALSA is something I don't know.
Post 07 Mar 2016, 08:54
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.