delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/04/25/22:53:01

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Date: Tue, 26 Apr 2011 10:52:35 +0800
Message-ID: <BANLkTikQXxpBLcHGPKWonACr=RO0dynMiA@mail.gmail.com>
Subject: The same assembly code but different result on cygwin and Centos
From: matthew chao <mathewchao AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
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

The code below assigns an integer number 20 to %ebx,  which  can be
CORRECTLY assembled on both cygwin and CentOS,

###code begin###
.section .data
items:
.long=A0 20

.section .text
.globl _start
_start:
=A0 movl $0,%edi
=A0 movl items(,%edi,4),%eax
=A0 movl %eax,%ebx

=A0 movl $1,%eax
=A0 int $0x80
###code end###
However, when I wanted to get the number(20) by the following way, I
found  the difference between cygwin and CentOS,

cygwin:
------------------------------
  Matt AT Matt-PC ~
$ ./max2

Matt AT Matt-PC ~
$ echo $?
127                        # The result is WRONG
------------------------------

CentOS:
------------------------------
[Matt AT localhost]# ./max2
[Matt AT localhost]# echo $?
20                          # The result is RIGHT
------------------------------
Could someone give me a hand?thanks

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