public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* The same assembly code but different result on cygwin and Centos
@ 2011-04-26  7:44 matthew chao
  2011-04-26 13:02 ` Václav Haisman
  0 siblings, 1 reply; 2+ messages in thread
From: matthew chao @ 2011-04-26  7:44 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: The same assembly code but different result on cygwin and Centos
  2011-04-26  7:44 The same assembly code but different result on cygwin and Centos matthew chao
@ 2011-04-26 13:02 ` Václav Haisman
  0 siblings, 0 replies; 2+ messages in thread
From: Václav Haisman @ 2011-04-26 13:02 UTC (permalink / raw)
  To: cygwin

matthew chao wrote, On 26.4.2011 4:52:
> 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
>[...]
Cygwin is Linux emulation DLL, it runs on top of Win32 API. It does not
emulate Linux' syscalls; it cannot emulate that.

-- 
VH

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-26  4:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-26  7:44 The same assembly code but different result on cygwin and Centos matthew chao
2011-04-26 13:02 ` Václav Haisman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).