2003-06-05 Casper S. Hornstrup <[email protected]>

Changes for compiling with w32api

	* ntoskrnl/include/internal/i386/ps.h (KPCR_TSS): Redefine as 0x3C.
	(KPCR_TIB): New structure.
	(IKPCR): Ditto.
	(KPCR): Match w32api structure fieldnames.
	* ntoskrnl/ke/main.c (ExpInitializeExecutive): Adjust for changes to KPCR.
	* ntoskrnl/ke/i386/kernel.c: Ditto.
	* ntoskrnl/ps/thread.c: Ditto.

svn path=/trunk/; revision=4842
This commit is contained in:
Casper Hornstrup
2003-06-05 11:51:13 +00:00
parent 55c6517e00
commit f2f1a0251b
5 changed files with 98 additions and 36 deletions
+12
View File
@@ -1,3 +1,15 @@
2003-06-05 Casper S. Hornstrup <[email protected]>
Changes for compiling with w32api
* ntoskrnl/include/internal/i386/ps.h (KPCR_TSS): Redefine as 0x3C.
(KPCR_TIB): New structure.
(IKPCR): Ditto.
(KPCR): Match w32api structure fieldnames.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Adjust for changes to KPCR.
* ntoskrnl/ke/i386/kernel.c: Ditto.
* ntoskrnl/ps/thread.c: Ditto.
2003-06-01 Casper S. Hornstrup <[email protected]>
Changes for compiling with w32api
+71 -23
View File
@@ -38,39 +38,87 @@
#define KPCR_EXCEPTION_LIST 0x0
#define KPCR_SELF 0x18
#define KPCR_TSS 0x28
#define KPCR_TSS 0x3C
#define KPCR_CURRENT_THREAD 0x124
#ifndef __ASM__
/*
* Processor Control Region
*/
typedef struct _KPCR
{
PVOID ExceptionList; /* 00 */
PVOID StackBase; /* 04 */
PVOID StackLimit; /* 08 */
PVOID SubSystemTib; /* 0C */
PVOID Reserved1; /* 10 */
PVOID ArbitraryUserPointer; /* 14 */
struct _KPCR* Self; /* 18 */
UCHAR ProcessorNumber; /* 1C */
KIRQL Irql; /* 1D */
UCHAR Reserved2[0x2]; /* 1E */
PUSHORT IDT; /* 20 */
PUSHORT GDT; /* 24 */
KTSS* TSS; /* 28 */
UCHAR Reserved3[0xF8]; /* 2C */
struct _KTHREAD* CurrentThread; /* 124 */
} __attribute__((packed)) KPCR;
#ifndef __USE_W32API
#pragma pack(push,4)
/*
* Processor Control Region Thread Information Block
*/
typedef struct _KPCR_TIB {
PVOID ExceptionList; /* 00 */
PVOID StackBase; /* 04 */
PVOID StackLimit; /* 08 */
PVOID SubSystemTib; /* 0C */
union {
PVOID FiberData; /* 10 */
DWORD Version; /* 10 */
};
PVOID ArbitraryUserPointer; /* 14 */
} KPCR_TIB, *PKPCR_TIB; /* 18 */
typedef struct _KPCR {
KPCR_TIB Tib; /* 00 */
struct _KPCR *Self; /* 18 */
struct _KPRCB *PCRCB; /* 1C */
KIRQL Irql; /* 20 */
ULONG IRR; /* 24 */
ULONG IrrActive; /* 28 */
ULONG IDR; /* 2C */
PVOID KdVersionBlock; /* 30 */
PUSHORT IDT; /* 34 */
PUSHORT GDT; /* 38 */
struct _KTSS *TSS; /* 3C */
USHORT MajorVersion; /* 40 */
USHORT MinorVersion; /* 42 */
KAFFINITY SetMember; /* 44 */
ULONG StallScaleFactor; /* 48 */
UCHAR DebugActive; /* 4C */
UCHAR ProcessorNumber; /* 4D */
UCHAR Reserved[2]; /* 4E */
} KPCR;
#pragma pack(pop)
typedef struct _KPCR *PKPCR;
#endif /* __USE_W32API */
#pragma pack(push,4)
/*
* Processor Control Region
* The first part of this structure must match the KPCR structure in w32api
*/
typedef struct _IKPCR {
KPCR_TIB Tib; /* 00 */
struct _KPCR *Self; /* 18 */
struct _KPRCB *PCRCB; /* 1C */
KIRQL Irql; /* 20 */
ULONG IRR; /* 24 */
ULONG IrrActive; /* 28 */
ULONG IDR; /* 2C */
PVOID KdVersionBlock; /* 30 */
PUSHORT IDT; /* 34 */
PUSHORT GDT; /* 38 */
struct _KTSS *TSS; /* 3C */
USHORT MajorVersion; /* 40 */
USHORT MinorVersion; /* 42 */
KAFFINITY SetMember; /* 44 */
ULONG StallScaleFactor; /* 48 */
UCHAR DebugActive; /* 4C */
UCHAR ProcessorNumber; /* 4D */
UCHAR Reserved[2]; /* 4E */
UCHAR Reserved2[0xD4]; /* 50 */
struct _KTHREAD* CurrentThread; /* 124 */
} IKPCR, *PIKPCR;
#pragma pack(pop)
#ifndef __USE_W32API
+2 -2
View File
@@ -71,7 +71,7 @@ KeApplicationProcessorInit(VOID)
KPCR->Irql = HIGH_LEVEL;
/* Mark the end of the exception handler list */
KPCR->ExceptionList = (PVOID)-1;
KPCR->Tib.ExceptionList = (PVOID)-1;
/*
* Initialize the GDT
@@ -127,7 +127,7 @@ KeInit1(VOID)
PcrsAllocated++;
/* Mark the end of the exception handler list */
KPCR->ExceptionList = (PVOID)-1;
KPCR->Tib.ExceptionList = (PVOID)-1;
Ki386InitializeLdt();
}
+6 -4
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: main.c,v 1.158 2003/05/20 14:37:05 ekohl Exp $
/* $Id: main.c,v 1.159 2003/06/05 11:51:13 chorns Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@@ -330,10 +330,12 @@ ExpInitializeExecutive(VOID)
assert(FIELD_OFFSET(KTRAP_FRAME, Reserved9) == KTRAP_FRAME_RESERVED9);
assert(FIELD_OFFSET(KV86M_TRAP_FRAME, regs) == TF_REGS);
assert(FIELD_OFFSET(KV86M_TRAP_FRAME, orig_ebp) == TF_ORIG_EBP);
assert(FIELD_OFFSET(KPCR, ExceptionList) == KPCR_EXCEPTION_LIST);
assert(FIELD_OFFSET(KPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST);
assert(FIELD_OFFSET(KPCR, Self) == KPCR_SELF);
assert(FIELD_OFFSET(KPCR, CurrentThread) == KPCR_CURRENT_THREAD);
assert(FIELD_OFFSET(IKPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST);
assert(FIELD_OFFSET(IKPCR, Self) == KPCR_SELF);
assert(FIELD_OFFSET(IKPCR, CurrentThread) == KPCR_CURRENT_THREAD);
LdrInit1();
+7 -7
View File
@@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.111 2003/05/01 22:00:31 gvg Exp $
/* $Id: thread.c,v 1.112 2003/06/05 11:51:13 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -63,7 +63,7 @@ static GENERIC_MAPPING PiThreadMapping = {THREAD_READ,
PKTHREAD STDCALL KeGetCurrentThread(VOID)
{
return(KeGetCurrentKPCR()->CurrentThread);
return(((PIKPCR) KeGetCurrentKPCR())->CurrentThread);
}
HANDLE STDCALL PsGetCurrentThreadId(VOID)
@@ -192,7 +192,7 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
KPRIORITY CurrentPriority;
PETHREAD Candidate;
ULONG Affinity;
PKTHREAD KCurrentThread = KeGetCurrentKPCR()->CurrentThread;
PKTHREAD KCurrentThread = ((PIKPCR) KeGetCurrentKPCR())->CurrentThread;
PETHREAD CurrentThread = CONTAINING_RECORD(KCurrentThread, ETHREAD, Tcb);
DPRINT("PsDispatchThread() %d/%d\n", KeGetCurrentProcessorNumber(),
@@ -259,7 +259,7 @@ PsDispatchThread(ULONG NewThreadStatus)
/*
* Save wait IRQL
*/
KeGetCurrentKPCR()->CurrentThread->WaitIrql = oldIrql;
((PIKPCR) KeGetCurrentKPCR())->CurrentThread->WaitIrql = oldIrql;
PsDispatchThreadNoLock(NewThreadStatus);
KeLowerIrql(oldIrql);
}
@@ -291,7 +291,7 @@ PsBlockThread(PNTSTATUS Status, UCHAR Alertable, ULONG WaitMode,
BOOLEAN DispatcherLock, KIRQL WaitIrql, UCHAR WaitReason)
{
KIRQL oldIrql;
PKTHREAD KThread = KeGetCurrentKPCR()->CurrentThread;
PKTHREAD KThread = ((PIKPCR) KeGetCurrentKPCR())->CurrentThread;
PETHREAD Thread = CONTAINING_RECORD (KThread, ETHREAD, Tcb);
PKWAIT_BLOCK WaitBlock;
@@ -370,7 +370,7 @@ PsFreezeAllThreads(PEPROCESS Process)
VOID
PsApplicationProcessorInit(VOID)
{
KeGetCurrentKPCR()->CurrentThread =
((PIKPCR) KeGetCurrentKPCR())->CurrentThread =
(PVOID)IdleThreads[KeGetCurrentProcessorNumber()];
}
@@ -443,7 +443,7 @@ PsInitThreadManagment(VOID)
THREAD_ALL_ACCESS,NULL, TRUE);
FirstThread->Tcb.State = THREAD_STATE_RUNNING;
FirstThread->Tcb.FreezeCount = 0;
KeGetCurrentKPCR()->CurrentThread = (PVOID)FirstThread;
((PIKPCR) KeGetCurrentKPCR())->CurrentThread = (PVOID)FirstThread;
NtClose(FirstThreadHandle);
DPRINT("FirstThread %x\n",FirstThread);