This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

The same assembly code but different result on cygwin and Centos


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

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

? movl $1,%eax
? 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@Matt-PC ~
$ ./max2

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

CentOS:
------------------------------
[Matt@localhost]# ./max2
[Matt@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]