Mail Archives: djgpp/1997/07/09/15:07:04
Message-ID: | <87BC54A997CCD01198930020AFF6011C270ED3@mail.rkk.cz>
|
From: | "Holejsovsky, Pavel" <PHolejs AT rkk DOT cz>
|
To: | djgpp AT delorie DOT com
|
Subject: | RE: Djgpp and Asm
|
Date: | Wed, 9 Jul 1997 20:58:47 +0200
|
MIME-Version: | 1.0
|
On Monday, July 07, 1997 8:50 PM, john Conner [SMTP:Fuckyou AT nowhere DOT com]
wrote:
> Matthew Mastracci wrote:
> >
> > On Sun, 6 Jul 1997, john Conner wrote:
> >
> > > asm("leal _RAM,%ebp"); /* RAM is a c pointer */
> > >
> > > It crashes every time. I get a gpf or stack fault.
> > > It works fine if I use esi,edi,ect. Any help?
> >
<snip>
> nope, I'm trying to move RAM(yes its defined) to %ebp. Basicly what im
> trying to do is pass a pointer into an obj asm module that uses %ebp
for
> one of its functions.
But %ebp is used internally as a stack frame pointer, compiler-generated
code references all local variables using %ebp (unless you compiled with
-fomit-frame-pointer, then %esp is used for this purpose and %ebp is
another free register to use for optimizations performed by compiler).
So you MUST preserve %ebp, e.g.
__asm__("pushl %ebp; leal _RAM, %ebp; ....; popl %ebp")
I couldn't try it here and hope that pushing %ebp won't confuse the
compiler even more. If it will, then try to save %ebp into GLOBAL (not
local!) variable..
Pavel
BTW: I'd rather send this answer to you personnaly, but I'm really
unsure if fuckyou AT nowhere DOT com is your real SMTP address or just antispam
;-)
- Raw text -