This is the mail archive of the
cygwin
mailing list for the Cygwin project.
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
- Date: Tue, 26 Apr 2011 10:52:35 +0800
- Subject: 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