Discussion:
update frame pointer value x64
(too old to reply)
CoolSun20
2010-07-12 17:33:00 UTC
Permalink
Within my x86 driver I update EBP. using inline assembley, push and pop EBP
before my module exits..
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module. I found an intrinsic
function to retrieve addressofreturnaddress and I can obtain the value which
I want in EBP from this API . Question is how to use this value to update
the EBP register contents? Is there any intrinsic counterpart which I can use
or any other method..Hope I am clear on my concern..

Thanks in advance..
Scott Noone
2010-07-12 18:22:36 UTC
Permalink
Post by CoolSun20
Within my x86 driver I update EBP. using inline assembley, push and pop EBP
before my module exits..
Why do you do this?
Post by CoolSun20
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module.
The x64 compiler doesn't use RBP as a frame pointer, so I'm confused as to
why this is necessary.

-scott
--
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
Post by CoolSun20
Within my x86 driver I update EBP. using inline assembley, push and pop EBP
before my module exits..
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module. I found an intrinsic
function to retrieve addressofreturnaddress and I can obtain the value which
I want in EBP from this API . Question is how to use this value to update
the EBP register contents? Is there any intrinsic counterpart which I can use
or any other method..Hope I am clear on my concern..
Thanks in advance..
CoolSun20
2010-07-13 14:07:16 UTC
Permalink
Understanding and working with some legacy code, so was just following the
logic of saving and restoring EBP upon module load and exit.. Ignoring the
fact of x64 frame pointer store location under x86 is it possible to replace
that push EBP and Pop EBP with some intrinsics..

Considering am newbie to x64 development, what does x64 compiler use as
frame pointer then. or if you please point me to good reads on this topics
would be appreciated..

Thanks much..
Post by Scott Noone
Post by CoolSun20
Within my x86 driver I update EBP. using inline assembley, push and pop EBP
before my module exits..
Why do you do this?
Post by CoolSun20
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module.
The x64 compiler doesn't use RBP as a frame pointer, so I'm confused as to
why this is necessary.
-scott
--
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
Post by CoolSun20
Within my x86 driver I update EBP. using inline assembley, push and pop EBP
before my module exits..
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module. I found an intrinsic
function to retrieve addressofreturnaddress and I can obtain the value which
I want in EBP from this API . Question is how to use this value to update
the EBP register contents? Is there any intrinsic counterpart which I can use
or any other method..Hope I am clear on my concern..
Thanks in advance..
Scott Noone
2010-07-13 17:55:57 UTC
Permalink
Start here:

http://msdn.microsoft.com/en-us/library/ms235286.aspx

The info is a bit spread out so you have to click through all of the links
and read, but it's all there.

-scott
--
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
Post by CoolSun20
Understanding and working with some legacy code, so was just following the
logic of saving and restoring EBP upon module load and exit.. Ignoring the
fact of x64 frame pointer store location under x86 is it possible to replace
that push EBP and Pop EBP with some intrinsics..
Considering am newbie to x64 development, what does x64 compiler use as
frame pointer then. or if you please point me to good reads on this topics
would be appreciated..
Thanks much..
Post by Scott Noone
Post by CoolSun20
Within my x86 driver I update EBP. using inline assembley, push and pop EBP
before my module exits..
Why do you do this?
Post by CoolSun20
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module.
The x64 compiler doesn't use RBP as a frame pointer, so I'm confused as to
why this is necessary.
-scott
--
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
Post by CoolSun20
Within my x86 driver I update EBP. using inline assembley, push and pop EBP
before my module exits..
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module. I found an intrinsic
function to retrieve addressofreturnaddress and I can obtain the value which
I want in EBP from this API . Question is how to use this value to update
the EBP register contents? Is there any intrinsic counterpart which I
can
use
or any other method..Hope I am clear on my concern..
Thanks in advance..
Tim Roberts
2010-07-15 03:20:55 UTC
Permalink
Post by CoolSun20
Understanding and working with some legacy code, so was just following the
logic of saving and restoring EBP upon module load and exit.
But you need to UNDERSTAND the code before you can hope to port it. WHY
are they dinking with the frame pointer? The compiler is perfectly able to
manage the frame pointer on its own.
Post by CoolSun20
Ignoring the
fact of x64 frame pointer store location under x86 is it possible to replace
that push EBP and Pop EBP with some intrinsics..
No. There are many instrinsics, but certainly none for push and pop
instructions. Stack management on x64 is quite different from x86.
Post by CoolSun20
Considering am newbie to x64 development, what does x64 compiler use as
frame pointer then. or if you please point me to good reads on this topics
would be appreciated.
Typically, the basic stack pointer (rsp) is used as a frame pointer. You
don't find push and pop instructions in x64 code very often.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Maxim S. Shatskih
2010-07-12 18:27:44 UTC
Permalink
Post by CoolSun20
I am now porting that logic to AMD64 architecture, due to restrictions of
not able to use inline assembley within my amd64 driver is there a way to
update framepointer value(EBP) before I exit my module.
Throw away the inline assembly and rewrite the code in C.

Helps like a charm :-)
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
Loading...