Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,971 of 4,675    |
|    Bart to Xavier Maillard    |
|    Re: simple ASM prog segfault    |
|    26 Nov 19 20:15:00    |
      From: bc@nospicedham.freeuk.com              On 26/11/2019 06:12, Xavier Maillard wrote:       > Hello,       >       > I am just starting to learn writing some fun progs in asm.       >       > I just jotted down some instructions, assembled it and linked it.       > Running it just segfault.       >       > The question is: why ? :)       >       > The program is just this:       >       > .section .data       >       > .section .text       > .globl _start       > _start:       >       > movl $1, %eax       > movl $0, %ebx       > int $0x80       >       > As you can see, it just does *nothing*       Syscall #1 appears to do 'exit', so it /ought/ to do nothing!              Are you saying it crashes instead of gracefully exiting?              Is your system 64 bits? If so you might try using rax and rbx instead of       eax and ebx. However I don't know whether the 64-bit set of syscalls are       the same (one set I saw appeared to be different from the 32-bit ones.       eg call #1 does sys_write).              (I know nothing about Linux assembly coding, it just looked intriguing.)              If you can't get anywhere, try starting from C and write the simplest       program. Compile it like this:               gcc -S prog.c              to get the assembly output in prog.s, which can also be assembled and       linked by gcc (which will invoke as and ld, or you can do that yourself):               gcc prog.s -oprog              Now you can play with the ASM instructions in prog.s, but starting from       something that works.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca