The same assembly code but different result on cygwin and Centos

matthew chao mathewchao@gmail.com
Tue Apr 26 07:44:00 GMT 2011


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



More information about the Cygwin mailing list