Author Topic: SYSTEM_CPU_SET_INFORMATION struct  (Read 238 times)

six_L

  • Member
  • **
  • Posts: 175
SYSTEM_CPU_SET_INFORMATION struct
« on: June 29, 2020, 08:10:24 PM »
hello all.
this is the struct of C++ from Microsoft documentation
Code: [Select]
typedef struct _SYSTEM_CPU_SET_INFORMATION {
  DWORD                    Size;
  CPU_SET_INFORMATION_TYPE Type;
  union {
    struct {
      DWORD   Id;
      WORD    Group;
      BYTE    LogicalProcessorIndex;
      BYTE    CoreIndex;
      BYTE    LastLevelCacheIndex;
      BYTE    NumaNodeIndex;
      BYTE    EfficiencyClass;
      union {
        BYTE AllFlags;
        struct {
          BYTE Parked : 1;
          BYTE Allocated : 1;
          BYTE AllocatedToTargetProcess : 1;
          BYTE RealTime : 1;
          BYTE ReservedFlags : 4;
        } DUMMYSTRUCTNAME;
      } DUMMYUNIONNAME2;
      union {
        DWORD Reserved;
        BYTE  SchedulingClass;
      };
      DWORD64 AllocationTag;
    } CpuSet;
  } DUMMYUNIONNAME;
} SYSTEM_CPU_SET_INFORMATION
this is the struct of h2incx Transformation.
Code: [Select]
SYSTEM_CPU_SET_INFORMATION struct
Size_ DWORD ?
Type_ CPU_SET_INFORMATION_TYPE ?
union DUMMYUNIONNAME
struct CpuSet
Id DWORD ?
Group_ WORD ?
LogicalProcessorIndex BYTE ?
CoreIndex BYTE ?
LastLevelCacheIndex BYTE ?
NumaNodeIndex BYTE ?
EfficiencyClass BYTE ?
union DUMMYUNIONNAME2
AllFlags BYTE ?
struct DUMMYSTRUCTNAME
DUMMYSTRUCTNAME_R0 RECORD Parked:1,Allocated:1,AllocatedToTargetProcess:1,RealTime:1,ReservedFlags:4
DUMMYSTRUCTNAME_R0 <>
ends
ends
union
Reserved DWORD ?
SchedulingClass BYTE ?
ends
AllocationTag DWORD64 ?
ends
ends
SYSTEM_CPU_SET_INFORMATION ends
I think it should be as following.
Code: [Select]
CPU_SET_INFORMATION_TYPE typedef DWORD

DUMMYSTRUCTNAME struct
Parked BYTE ?
Allocated BYTE ?
AllocatedToTargetProcess BYTE ?
RealTime BYTE ?
ReservedFlags BYTE ?
DUMMYSTRUCTNAME ends

CPUSET struct
Id DWORD ?
Group_ WORD ?
LogicalProcessorIndex BYTE ?
CoreIndex BYTE ?
LastLevelCacheIndex BYTE ?
NumaNodeIndex BYTE ?
EfficiencyClass BYTE ?
union
AllFlags BYTE ?
dummystructname_ DUMMYSTRUCTNAME<>
ends
union
Reserved DWORD ?
SchedulingClass BYTE ?
ends
AllocationTag DWORD64 ?
CPUSET ends

SYSTEM_CPU_SET_INFORMATION struct
_Size DWORD ?
_Type CPU_SET_INFORMATION_TYPE ?
union
CpuSet_ CPUSET<?>

ends
SYSTEM_CPU_SET_INFORMATION ends
is it right?

Biterider

  • Member
  • ****
  • Posts: 533
  • ObjAsm Developer
    • ObjAsm
Re: SYSTEM_CPU_SET_INFORMATION struct
« Reply #1 on: June 29, 2020, 09:45:36 PM »
Hi
As far as I remember this C structure
Code: [Select]
struct {
          BYTE Parked : 1;
          BYTE Allocated : 1;
          BYTE AllocatedToTargetProcess : 1;
          BYTE RealTime : 1;
          BYTE ReservedFlags : 4;
        } DUMMYSTRUCTNAME;
is a bit field packed into a single BYTE. There are compiler implementation differences but you can get the idea here https://en.wikipedia.org/wiki/Bit_field#:~:text=A%20bit%20field%20is%20a,the%20set%20can%20be%20addressed.

Biterider
« Last Edit: July 01, 2020, 08:48:49 PM by Biterider »

TouEnMasm

  • Member
  • *****
  • Posts: 1290
    • EditMasm
Re: SYSTEM_CPU_SET_INFORMATION struct
« Reply #2 on: June 30, 2020, 07:51:16 AM »
DEFALIGNMASM TEXTEQU <QWORD>

RECASYSTEM_CPU_SET_INFORMATION      RECORD     AAReservedFlags : 4,
            AARealTime : 1,
            AAAllocatedToTargetProcess : 1,
            AAAllocated : 1,
            AAParked : 1

SYSTEM_CPU_SET_INFORMATION   STRUCT DEFALIGNMASM
   asize DWORD ?
   atype CPU_SET_INFORMATION_TYPE ?
   union   DUMMYUNIONNAME
   STRUCT   CpuSet
   Id DWORD ?
   agroup WORD ?
   LogicalProcessorIndex BYTE ?
   CoreIndex BYTE ?
   LastLevelCacheIndex BYTE ?
   NumaNodeIndex BYTE ?
   EfficiencyClass BYTE ?
   union   DUMMYUNIONNAME2
   AllFlags BYTE ?
   STRUCT   DUMMYSTRUCTNAME
   RECASYSTEM_CPU_SET_INFORMATION BYTE ?
   ENDS
   ENDS
   union
   Reserved DWORD ?
   SchedulingClass BYTE ?
   ENDS
   AllocationTag QWORD ?
   ENDS
   ENDS
SYSTEM_CPU_SET_INFORMATION      ENDS

« Last Edit: June 30, 2020, 04:33:45 PM by TouEnMasm »
Fa is a musical note to play with CL

six_L

  • Member
  • **
  • Posts: 175
Re: SYSTEM_CPU_SET_INFORMATION struct
« Reply #3 on: June 30, 2020, 04:06:09 PM »
hello,Biterider,TouEnMasm.
thanks you for the useable infomation. :thumbsup:
I need a lot of time to learn deeply.
hope to someone would maintain the inc and lib of UASM.

TouEnMasm

  • Member
  • *****
  • Posts: 1290
    • EditMasm
Re: SYSTEM_CPU_SET_INFORMATION struct
« Reply #4 on: June 30, 2020, 05:17:44 PM »
Fa is a musical note to play with CL

six_L

  • Member
  • **
  • Posts: 175
Re: SYSTEM_CPU_SET_INFORMATION struct
« Reply #5 on: July 01, 2020, 04:16:33 PM »
hi,TouEnMasm
thanks you for the link(Headinc : http://luce.yves.pagesperso-orange.fr/header.htm)