473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Pushing the registers onto the stack (x64).

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
1 2747
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Shi Jin | last post by:
Hi there, I am now having a puzzle regarding what a function call actually does when called. I have a simple code to see what's going on. It is simply calling another simple function from...
2
by: Yan | last post by:
Hi. I found weird gcc/vc behaviour when generating functions code. According to the docs I read, C functions don't save any registers except ebp (on x86), but I see that both gcc and cl (VC++)...
5
by: volvox | last post by:
hi, is it possible to access protected mode registers (EAX , EBX,ECX...) via assembly in C .
1
by: VivekR | last post by:
Hi I have a class CodeGen in which GenerateILBody is a method that uses ILGenerator.Emit to create the IL code as method body for a dynamic method DynMethod. GenerateILBody at runtime must call...
3
by: Frank Rizzo | last post by:
Hello, I need to port a fairly large app to x64, as it needs access to more than 2GB. So I ported the app to VS2005 (from vs2003). Now the Project Properties have a Build Tab, which has a...
9
by: Frank Rizzo | last post by:
I have a set of apps that require .net 1.1 framework. I've installed them on Windows 2003 Server (x64) with the .net 2.0 (x64) framework. I can't seem to find the x64 1.1 framework and the x86...
5
by: danfike | last post by:
Hi all, So I'm working on a C++ application that will eventually embed or extend Python using Boost.Python, but I first need to get Python compiled correctly for my platform. I've got a Windows...
0
by: captainjaneway | last post by:
Can anyone show me how to determine if an object pushed onto a stack object is actually a ref object? Example code snippet: Stack m_stack = new Stack() void PushByRef<T>(ref T value) { ...
2
by: A n g l e r | last post by:
Hi all. I'm having a truly bugging me problem going on here. When I get to Tools->Options->VC++ Directories and try to set up paths for x64, it turns out that it's listed in a drop-box twice!...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.