Pushing the registers onto the stack (x64). - Programmer

This is a discussion on Pushing the registers onto the stack (x64). - Programmer ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Pushing the registers onto the stack (x64).

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


  2. Re: Pushing the registers onto the stack (x64).

    * 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

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?

  3. Re: Pushing the registers onto the stack (x64).

    "Dave" wrote in message
    news:U1nwi.13916$ya1.1646@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.



+ Reply to Thread