If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: ASM and x64

I hadn't heard that. It's awful. Is it just temporary or is inline ASM support to be permanently dropped? It's an indespensible tool for debugging release builds.

...how to port this to x64...

The first function in particular seems quite compiler dependent. Is this for a device driver?

This version of GetEip() seems to work, though it has pesky runtime check failure in a debug build.

This GetEbp() does not work, at least on my machine. It fails on the mov instruction with an access violation, I think because it is trying to execute code which is not in the code page. If you can get past that, I'm expecting it to still have a problem because the return address is not pushed onto the stack, but I think that is the more minor problem.

The first function in particular seems quite compiler dependent. Is this for a device driver?

No, it's for walking the call stack. Not very familiar with it, it's part of a big project. I'm trying to see what it takes to migrate it on x64, and this was the first thing that generated errors. Looking on the web, I actually saw different versions of those methods.

Re: ASM and x64

Can you explain what these magic numbers are?

That's the code for

Code:

mov eax, ebp
ret

The disassembly window verifies that as the correct byte sequence, but my machine consistently generates a GP Fault when the execution pointer tries to execute the move instruction. Likewise, another approach I tried also faulted when it attempted to memcpy that byte sequence to the start of a function. I don't know very much about the x86 architecture but assume these faults are rooted in some distinction between code and data segments.

If you could overcome the GP fault, for x64 you would probably want to use whatever byte sequence corresponds to

Code:

mov rax, rbp
ret

or so I assume. (?)

I think another way to put this... ...is...

Nice simplification. Wish I'd noticed it.
Also nGuardBytes should probably be a static const to get it off the stack frame.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.