public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* integrated asm and vars
@ 2000-03-20  4:26 Leonhard Grünschloß
  2000-03-20  8:15 ` Chris Faylor
  2000-03-20 10:33 ` Mumit Khan
  0 siblings, 2 replies; 3+ messages in thread
From: Leonhard Grünschloß @ 2000-03-20  4:26 UTC (permalink / raw)
  To: cygwin

My problem: I want to use the integrated assembler for some time critical 
procedures. But I need to get the content of some local vars - I couldn't 
find a solution for about 4 hours. I tried to use VC++ style e.g. mov eax, 
[asm_var] - didn't work. I wrote an extra procedure and used "%0", "%1" to 
get the parameters - didn't work. I tried to use TASM and link the object - 
cygwin couldn't read it. Finally used FreePascal (based on gcc) - produced 
compilable asm code but it couldn't find the reference. Then I tried to get 
the address by calculating it with the help of %ebp - always got access 
violation errors. I'm new to asm so I don't know what this "=&a" (var) 
means, to - well to assign a var to a register it also didn't work. Is it 
only for results?

Is there any good documentation for cygwin to download in which something 
like this is explained? For gnu-c there was always such an info tool. Is 
there anything similar for cygwin?
An example prog for my problem:

int main() {
int a = 1;
a = 1;
__asm (
" mov eax, [a] ; " // or
" mov ebx, a ; " // or
" mov %eax, %a ; " // or
" mov %eax, %0 ; " // if in an extra procedure
" mov %eax, %h0 ; " // or
" mov %eax, (8)%ebp ; " JUST ISN'T WORKING
...
)
return 0;
}

Thank you.
-- Leonhard
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

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

* Re: integrated asm and vars
  2000-03-20  4:26 integrated asm and vars Leonhard Grünschloß
@ 2000-03-20  8:15 ` Chris Faylor
  2000-03-20 10:33 ` Mumit Khan
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Faylor @ 2000-03-20  8:15 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]

On Mon, Mar 20, 2000 at 01:25:37PM +0100, Leonhard Grünschloß wrote:
>My problem: I want to use the integrated assembler for some time critical 
>procedures. But I need to get the content of some local vars - I couldn't 
>find a solution for about 4 hours. I tried to use VC++ style e.g. mov eax, 
>[asm_var] - didn't work. I wrote an extra procedure and used "%0", "%1" to 
>get the parameters - didn't work. I tried to use TASM and link the object - 
>cygwin couldn't read it. Finally used FreePascal (based on gcc) - produced 
>compilable asm code but it couldn't find the reference. Then I tried to get 
>the address by calculating it with the help of %ebp - always got access 
>violation errors. I'm new to asm so I don't know what this "=&a" (var) 
>means, to - well to assign a var to a register it also didn't work. Is it 
>only for results?
>
>Is there any good documentation for cygwin to download in which something 
>like this is explained? For gnu-c there was always such an info tool. Is 
>there anything similar for cygwin?

This is a gcc issue, not a cygwin issue.  You should be looking for gcc
documentation.

In this case, you need to look at the gcc info files under the "extended
asm" section.  This illustrates how to do what you want.

The cygwin source code also does this in several places, if you want to
look at examples.  linux also relies on it quite heavily.

You can download the latest cygwin source code snapshot from:

http://sourceware.cygnus.com/cygwin/snapshots/

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

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

* Re: integrated asm and vars
  2000-03-20  4:26 integrated asm and vars Leonhard Grünschloß
  2000-03-20  8:15 ` Chris Faylor
@ 2000-03-20 10:33 ` Mumit Khan
  1 sibling, 0 replies; 3+ messages in thread
From: Mumit Khan @ 2000-03-20 10:33 UTC (permalink / raw)
  To: Leonhard Grünschloß; +Cc: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

On Mon, 20 Mar 2000, Leonhard Grünschloß wrote:

> My problem: I want to use the integrated assembler for some time critical 
> procedures. But I need to get the content of some local vars - I couldn't 
> find a solution for about 4 hours. I tried to use VC++ style e.g. mov eax, 
> [asm_var] - didn't work. I wrote an extra procedure and used "%0", "%1" to 
> get the parameters - didn't work. I tried to use TASM and link the object - 
> cygwin couldn't read it. Finally used FreePascal (based on gcc) - produced 
> compilable asm code but it couldn't find the reference. Then I tried to get 
> the address by calculating it with the help of %ebp - always got access 
> violation errors. I'm new to asm so I don't know what this "=&a" (var) 
> means, to - well to assign a var to a register it also didn't work. Is it 
> only for results?

First read the GCC documentation on inline assembly, and then look at the
excellent tutorial by Colin Plumb (URL below), and that should give you a 
pretty good head start.

   Linkname: asm tutorial [Re: More assembly compiler erorrs]
   URL: http://sourceware.cygnus.com/ml/cygwin/1999-08/msg00138.html

Regards,
Mumit



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

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

end of thread, other threads:[~2000-03-20 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-20  4:26 integrated asm and vars Leonhard Grünschloß
2000-03-20  8:15 ` Chris Faylor
2000-03-20 10:33 ` Mumit Khan

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