linux - why does this give a segmentation fault? it should just exit -


I am trying to learn low level development in Ibex 1 and in eX (for acet ()) By putting and calling int x x 80, it should be out of the program. I have a simple program that runs fine, but when I paste it, instead of getting out of expectation, I get a segmentation fault. Why does this happen

Thank you!

  __asm__ ("xor% ebx,% ebx;" "mov% al, 1;" "int $ 80;"); Edit: Thanks for the advice, still nothing but SIG flaws, though. Here are the revisions I made:  
  __asm__ ("xor% ebx,% ebx;" "xor% eax,% eax;" "mov $ 1,% eax;" "$ 80 difference ; "); Edit this example with  

edit:

  asm ("movl $ 1, %% eax; / * SYS_exit 1 * / xorl %% ebx After doing, %% ebx; / * logic is in eBook, it should enter 0 * / int $ 0x80 "/ * kernel mode /);  

This has ultimately worked for me:

  asm ("movl $ 1,% eax; xorl% ebx,% ebx; int $ 0x80" );  

Thanks for looking at and giving advice.

Are you sure the remaining eax is approved? Try moving 1 to eax and not just al or at least clear it first.

  __ asm__ ("Xor% ebx,% ebx;" "mov $ 1,% eax;" "int $ 0x80;");  Edit:  If Enddog is right about AT & T syntax.  

Edit: It's been a while since I used gas but 80 16 is $ 0x80 $ 80 is 80 10 . It should fix its last.


Comments