By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,964 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,964 IT Pros & Developers. It's quick & easy.

Pushing the registers onto the stack (x64).

P: n/a
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

Aug 14 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Dave" <go*****@yahoo.comwrote in message
news:U1******************@news02.roc.ny...
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.
Aug 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.