Click to See Complete Forum and Search --> : Nasm
dogn00dles
09-25-2002, 12:43 AM
hey there! i made a small asm file, it contained nothing but mov,ax,10, or something like that. i try: nasm -f elf source.asm, then ld source.asm. the executable always gives me a seg. fault, even when i am pasting examples! does anyone know what i am doing wrong? thanks.
love,
dogn00dles
bwkaz
09-25-2002, 01:34 PM
Can you post one of the examples? If your program is just mov ax,10, then you don't return to the OS, so it starts executing random contents of memory after the mov instruction. I'm not sure how an assembly program quits in Linux, but in DOS there was a syscall for it.
But if you posted one of the examples, that might help someone figure out what the deal with them is.
dogn00dles
09-25-2002, 06:29 PM
thanks...i will go to linuxassembly.org, i believe they have what you are talking about there. i was using a DOS guide, but didn't think it mattered what OS you used.
TacKat
09-26-2002, 08:31 PM
I'm not sure how an assembly program quits in Linux,
mov eax, 1
int 80h
Uses the exit() syscall.
bwkaz
09-26-2002, 10:09 PM
I knew syscalls were int 80h in Linux (DOS is 20h, 21h, and some others, depending on what you're doing -- talk about headaches), but it's (debatably ;) ) good to know exit() is eax = 1.
Is there a list of them anywhere, other than looking through the kernel source (assuming I could find the relevant pieces)?
TacKat
09-26-2002, 10:15 PM
Yeah, /usr/include/asm/unistd.h gives a nice list of defines for them.
dogn00dles
09-29-2002, 09:19 PM
Thanks guys...I was wondering where you got your wealth of knowledge, whether it be book or online source. If so, what? danke. lates,
dogn00dles
TacKat
09-30-2002, 05:23 PM
I don't know that it's a wealth of knowledge, but I got most of my assembly stuff from various books. Most of them were terribly old and only dealt with 16-bit asm. I don't know where you'd find them now. From there 32-bit is a breeze; no more segments do deal with. I picked up the Linux specific asm from linuxassembly.org (http://www.linuxassembly.org).
I haven't really looked at it, but apparently there's a 32-bit version of Art of Assembly. Do a google search for it.
dogn00dles
09-30-2002, 09:22 PM
thanks. i am in forever debt to you. no joke.
love,
dogn00dles