Pushing the registers onto the stack (x64).

D

Dave

Is there a way to either directly get the contents of the x64 registers or
push them onto the stack (and of course pop the same) w/o having to use
MASM64?

For example, in VC++ x86:

__asm pushad;
DoSomething();
__asm popad;

or

DWORD r0,r1,r2,r3,r4,r5,r6;
__asm
{
mov r0,eax;
mov r1,ebx;
mov r2,ecx;
mov r3,edx;
mov r4,esi;
mov r5,edi;
mov r6,ebp;
}
mystack.push(r0);
mystack.push(r1);
mystack.push(r2);
mystack.push(r3);
mystack.push(r4);
mystack.push(r5);
mystack.push(r6);
DoSomething();

IA64 at least has __getReg()... I'd hate to have to dig into MASM64 for
this.

GetThreadContext() does't return them all (volatile registers are not
accurate), even if the thread is suspended prior.

TIA,

- Dave
 
A

Alf P. Steinbach

* Dave:
[OFF-TOPIC IN CLC++]

Please don't cross-post off-topic articles to clc++.

But even though your question is off-topic in this group, please don't
feel unwelcome. Spend some time reading posted articles to familiarize
yourself with the group, read the FAQ.

Thanks in advance, and C U L8R,

- Alf
 
J

Jim Langston

Dave said:
Is there a way to either directly get the contents of the x64 registers or
push them onto the stack (and of course pop the same) w/o having to use
MASM64?

For example, in VC++ x86:

__asm pushad;
DoSomething();
__asm popad;

or

DWORD r0,r1,r2,r3,r4,r5,r6;
__asm
{
mov r0,eax;
mov r1,ebx;
mov r2,ecx;
mov r3,edx;
mov r4,esi;
mov r5,edi;
mov r6,ebp;
}
mystack.push(r0);
mystack.push(r1);
mystack.push(r2);
mystack.push(r3);
mystack.push(r4);
mystack.push(r5);
mystack.push(r6);
DoSomething();

IA64 at least has __getReg()... I'd hate to have to dig into MASM64 for
this.

GetThreadContext() does't return them all (volatile registers are not
accurate), even if the thread is suspended prior.

It's too OS and compiler specific to ask in clc++. Try a newsgroup related
to your OS/Compiler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top