__getCFS
Visual Studio 2010
Microsoft Specific
Gets the current frame state.
unsigned __int64 __getCFS(void);
// 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;
}
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