delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/15/16:29:10

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B9EAADF.4000605@gmail.com>
Date: Mon, 15 Mar 2010 21:47:11 +0000
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Assembly language exit() syscall does not return correct value
References: <SNT124-W268B75B0F1F523EE6A9847992E0 AT phx DOT gbl> <20100315165645 DOT GA30887 AT ednor DOT casa DOT cgf DOT cx>
In-Reply-To: <20100315165645.GA30887@ednor.casa.cgf.cx>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 15/03/2010 16:56, Christopher Faylor wrote:
> On Mon, Mar 15, 2010 at 04:23:39PM +0000, Brandon Chase wrote:
>> The following program is supposed to return a value of 222 when echo $? 
>> run, but I get 127 every time, no matter what I change. I have looked 
>> around but cannot seem to find out if this is an error or a 
>> cygwin-specific value.

> # %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.

    cheers,
      DaveK

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019