delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/17/20:43:42

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 17 Feb 2004 20:42:59 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Krzysztof Duleba <krzysan AT skrzynka DOT pl>
cc: cygwin AT cygwin DOT com
Subject: Re: Assembler
In-Reply-To: <c0ucj0$ijn$1@sea.gmane.org>
Message-ID: <Pine.GSO.4.56.0402172023000.5630@slinky.cs.nyu.edu>
References: <AE2AA130827456459AA497E8C9D6EA00412C02 AT pauex2ku02 DOT agere DOT com> <c0ucj0$ijn$1 AT sea DOT gmane DOT org>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Tue, 17 Feb 2004, Krzysztof Duleba wrote:

> Williams, Gerald S (Jerry) wrote:
>
> >> What about Linux syscalls? Will Cygwin emulation layer match
> >> it?
>
> > I just Googled "int 0x80". So THAT'S what you're
> > trying to do. :-)
>
> :-)
>
> > No, I think your experiment shows that Cygwin is
> > not emulating Linux syscalls at that level.
>
> Really?
>
> > Nor would I have expected it to.
>
> Why not? c code, translated to asm with -c -S on linux box, can be later
> compiled and linked with Cygwin's gcc and works fine. As you see, I have a
> good reason to believe that nasm's int 0x80 will work too. So maybe I should
> simply look for a nasm -> gcc's assembler translator?
>
>
> > On the other hand, you can get at DOS functions,
> > at least if you build your executable correctly.
> > For example, the following:
> >
> > ; hello.asm
> > [ORG 0x100]
> >
> > section .text
> > global  _start
> >
> > _start: mov     ah,9
> >         mov     dx, hello
> >         int     0x21
> >
> >         mov     ax,0x4c00
> >         int     0x21
> >
> > section .data
> > hello   db      'Hello, World', 13, 10, '$'
>
> That was an easy example. But what if I want to fork? :-)

Most of the C code on Linux doesn't use int 0x80.  It normally invokes
user-level functions that invoke system calls.  Why not go the same route
with Cygwin?  In one of the previous messages in this thread, there was an
example of calling printf from assembly.  You should be able to make calls
to the Cygwin emulation layer the same way.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019