- update KPCR and KIPCR

- add KeGetPcr() and update KeGetCurrentProcessorNumber 

svn path=/branches/ros-amd64-bringup/; revision=34970
This commit is contained in:
Timo Kreuzer 2008-07-31 02:16:59 +00:00
parent a4011bc8b6
commit 5a0c8727c2
2 changed files with 61 additions and 38 deletions

View file

@ -5516,23 +5516,38 @@ KeGetCurrentThread(
typedef struct _KPCR
{
NT_TIB NtTib;
struct _KPRCB *CurrentPrcb;
ULONG64 SavedRcx;
ULONG64 SavedR11;
union
{
NT_TIB NtTib;
struct
{
union _KGDTENTRY64 *GdtBase;
struct _KTSS64 *TssBase;
ULONG64 UserRsp;
struct _KPCR *Self;
struct _KPRCB *CurrentPrcb;
PKSPIN_LOCK_QUEUE LockArray;
PVOID Used_Self;
};
};
union _KIDTENTRY64 *IdtBase;
ULONG64 Unused[2];
KIRQL Irql;
UCHAR SecondLevelCacheAssociativity;
UCHAR Number;
UCHAR ObsoleteNumber;
UCHAR Fill0;
ULONG Irr;
ULONG IrrActive;
ULONG Idr;
ULONG Unused0[3];
USHORT MajorVersion;
USHORT MinorVersion;
ULONG StallScaleFactor;
union _KIDTENTRY64 *IdtBase;
union _KGDTENTRY64 *GdtBase;
struct _KTSS64 *TssBase;
PVOID Unused1[3];
ULONG KernelReserved[15];
ULONG SecondLevelCacheSize;
ULONG HalReserved[16];
ULONG Unused2;
PVOID KdVersionBlock;
PVOID Unused3;
ULONG PcrAlign1[24];
} KPCR, *PKPCR;
typedef struct _KFLOATING_SAVE {
@ -5551,11 +5566,18 @@ NTAPI
KeGetCurrentThread(
VOID);
FORCEINLINE
PKPCR
KeGetPcr(VOID)
{
return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
}
FORCEINLINE
ULONG
KeGetCurrentProcessorNumber(VOID)
{
return (ULONG)__readgsbyte(FIELD_OFFSET(KPCR, Number));
return (ULONG)__readgsword(0x184);
}
#elif defined(__PowerPC__)

View file

@ -635,41 +635,42 @@ typedef struct _KIPCR
NT_TIB NtTib;
struct
{
struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
PVOID Used_StackBase;
PVOID PerfGlobalGroupMask;
PVOID TssCopy;
ULONG ContextSwitches;
KAFFINITY SetMemberCopy;
union _KGDTENTRY64 *GdtBase;
struct _KTSS64 *TssBase;
ULONG64 UserRsp;
struct _KPCR *Self;
struct _KPRCB *CurrentPrcb;
PKSPIN_LOCK_QUEUE LockArray;
PVOID Used_Self;
};
};
struct _KPCR *Self;
struct _KPRCB *Prcb;
union _KIDTENTRY64 *IdtBase;
ULONG64 Unused[2];
KIRQL Irql;
ULONG IRR;
ULONG IrrActive;
ULONG IDR;
PVOID KdVersionBlock;
PKIDTENTRY IDT;
PKGDTENTRY GDT;
struct _KTSS *TSS;
UCHAR SecondLevelCacheAssociativity;
UCHAR ObsoleteNumber;
UCHAR Fill0;
ULONG Unused0[3];
USHORT MajorVersion;
USHORT MinorVersion;
KAFFINITY SetMember;
ULONG StallScaleFactor;
UCHAR SparedUnused;
UCHAR Number;
UCHAR Reserved;
UCHAR L2CacheAssociativity;
ULONG VdmAlert;
ULONG KernelReserved[14];
PVOID Unused1[3];
ULONG KernelReserved[15];
ULONG SecondLevelCacheSize;
ULONG HalReserved[16];
ULONG InterruptMode;
UCHAR Spare1;
ULONG KernelReserved2[17];
KPRCB PrcbData;
ULONG Unused2;
ULONG Fill1;
PVOID KdVersionBlock; // 0x108
PVOID Unused3;
ULONG PcrAlign1[24];
ULONG Unknown1; // 0x178
ULONG Unknown2;
ULONG Unknown3;
USHORT CpuNumber; // 0x184
// hack:
ULONG ContextSwitches;
} KIPCR, *PKIPCR;
#pragma pack(pop)