Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

__getCFS

Microsoft Specific

Gets the current frame state.


unsigned __int64 __getCFS(void);

Returns the first 18 bits of the current frame marker (CFM).

Intrinsic Architecture

__getCFS

IPF

Header file <intrin.h>

Bits 0 to 6 give the size of the current stack frame. Bits 7 to 13 give the size of the locals portion of the stack frame. Bits 14 to 17 give the size of the rotating portion of the stack frame.

This routine is only available as an intrinsic.

// getCFS.c
// processor: IPF
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic (__getCFS)

#define SIZE_OF_FRAME_MASK 127
#define SIZE_OF_LOCALS_MASK 16256
#define SIZE_OF_ROT_MASK 245760

int main()
{
    int size_of_frame, size_of_locals, size_of_rot;
    unsigned __int64 cfs;

    cfs = __getCFS();
    printf_s("Current Frame State: 0x%x\n", cfs);

    size_of_frame = cfs & SIZE_OF_FRAME_MASK;
    size_of_locals = (cfs & SIZE_OF_LOCALS_MASK) >> 7;
    size_of_rot = (cfs & SIZE_OF_ROT_MASK) >> 13;
    printf_s("Size of current stack frame: %d\n",
             size_of_frame);
    printf_s("Size of locals portion of current stack frame: %d\n",
             size_of_locals);
    printf_s("Size of rotating portion of current stack frame: %d\n",
             size_of_rot);
   return 0;
}

Output

Current Frame State: 0x185
Size of current stack frame: 5
Size of locals portion of current stack frame: 3
Size of rotating portion of current stack frame: 0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.