Assembly language exit() syscall does not return correct value

Stephan Mueller Stephan.Mueller@microsoft.com
Tue Mar 16 17:24:00 GMT 2010


Brandon Chase wrote:
" DaveK wrote:
" " On 15/03/2010 16:56, Christopher Faylor wrote:
" " > # %ebx is the status code for the exit system call
" " > # and it already has the maximum number
" " >   movl $1, %eax                   #1 is the exit() syscall
" " >
" " > If, in theory, I got this right then, on linux it SEGVs.  I would
" " > not expect anything different on Cygwin.  It seems like you need
" " > to actually call exit() if you want this to exit.
"
" "   Yeah, this looks like it was Linux assembly code and the "int 0x80" has just
" " been removed.  What you said.  Also, it should probably define '_main' rather
" " than '_start'.  And use the gcc driver to assemble and link it so as to get
" " the necessary startup code.
"
" "   Brandon, Cygwin isn't compatible with Linux at the assembler-code level, in
" " particular Cygwin isn't a real kernel, so it doesn't have a syscall interface;
" " you just call system functions as if they were ordinary functions.
"
" So I cannot compile assembly language with Cygwin? Do I need a linux shell?

No, that's not what anyone said.  You can use the assembler on Cygwin to generate
binaries that run on Cygwin (which is I think what you're looking for), but your
assembly source code won't work as is -- you will need to make changes of the
sort that DaveK and cgf state in the paragraphs above.

stephan();

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list