Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > update frame pointer value x64

Reply
Thread Tools Display Modes

update frame pointer value x64

 
 
CoolSun20
Guest
Posts: n/a

 
      07-12-2010
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..
 
Reply With Quote
 
 
 
 
Scott Noone
Guest
Posts: n/a

 
      07-12-2010
> Within my x86 driver I update EBP. using inline assembley, push and pop
> EBP
> before my module exits..


Why do you do this?

> 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


"CoolSun20" <> wrote in message
news:F885E310-6080-4B13-BBB5-...
> 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..


 
Reply With Quote
 
Maxim S. Shatskih
Guest
Posts: n/a

 
      07-12-2010
> 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

http://www.storagecraft.com

 
Reply With Quote
 
CoolSun20
Guest
Posts: n/a

 
      07-13-2010
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..


"Scott Noone" wrote:

> > Within my x86 driver I update EBP. using inline assembley, push and pop
> > EBP
> > before my module exits..

>
> Why do you do this?
>
> > 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
>
>
> "CoolSun20" <> wrote in message
> news:F885E310-6080-4B13-BBB5-...
> > 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..

>

 
Reply With Quote
 
Scott Noone
Guest
Posts: n/a

 
      07-13-2010
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


"CoolSun20" <> wrote in message
newsFDC304F-CA39-41DA-BA1D-...
> 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..
>
>
> "Scott Noone" wrote:
>
>> > Within my x86 driver I update EBP. using inline assembley, push and pop
>> > EBP
>> > before my module exits..

>>
>> Why do you do this?
>>
>> > 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
>>
>>
>> "CoolSun20" <> wrote in message
>> news:F885E310-6080-4B13-BBB5-...
>> > 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..

>>

 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a

 
      07-15-2010
CoolSun20 <> wrote:
>
>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.

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

>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,
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Office Home 7 Student Update Problems Alice Windows Vista General Discussion 12 08-25-2010 05:21 PM
Re: KB971023 installs every day gchq Windows Update 4 08-21-2010 09:22 PM
Windows update problem. Clueless Clueless.MG Windows Update 3 05-28-2010 07:10 PM
Updates were unable to be successfully installed wjousts Windows Update 6 01-30-2010 04:01 PM
Explorer Crashes after Update Trader Windows Update 1 11-10-2009 05:41 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59