SMP detection work

Changed initialization back
Changed to NT IRQLs
Check for return from main

svn path=/trunk/; revision=1797
This commit is contained in:
David Welch 2001-04-16 02:02:07 +00:00
parent bdfcd5630a
commit 65b55ec6c6
30 changed files with 1311 additions and 812 deletions

View file

@ -211,29 +211,19 @@ enum
#include <ddk/i386/irql.h>
/*
* IRQ levels
*/
#if 0
#define PASSIVE_LEVEL (1)
#define APC_LEVEL (2)
#define DISPATCH_LEVEL (3)
#define FIRST_DEVICE_SPECIFIC_LEVEL (4)
#define HIGH_LEVEL (FIRST_DEVICE_SPECIFIC_LEVEL + NR_DEVICE_SPECIFIC_LEVELS)
#else
/* NT's IRQL */
#define PASSIVE_LEVEL 0 // Passive release level
#define LOW_LEVEL 0 // Lowest interrupt level
#define APC_LEVEL 1 // APC interrupt level
#define DISPATCH_LEVEL 2 // Dispatcher level
#define PROFILE_LEVEL 27 // Timer used for profiling
#define CLOCK1_LEVEL 28 // Interval clock 1 level - Not used on x86
#define CLOCK2_LEVEL 28 // Interval clock 2 level
#define IPI_LEVEL 29 // Interprocessor interrupt level
#define POWER_LEVEL 30 // Power failure level
#define HIGH_LEVEL 31 // Highest interrupt level
#define SYNCH_LEVEL (IPI_LEVEL-1) // Synchronization level
#endif
#define PASSIVE_LEVEL 0 // Passive release level
#define LOW_LEVEL 0 // Lowest interrupt level
#define APC_LEVEL 1 // APC interrupt level
#define DISPATCH_LEVEL 2 // Dispatcher level
/* timer used for profiling */
#define PROFILE_LEVEL 27
/* Interval clock 1 level - Not used on x86 */
#define CLOCK1_LEVEL 28
#define CLOCK2_LEVEL 28 // Interval clock 2 level
#define IPI_LEVEL 29 // Interprocessor interrupt level
#define POWER_LEVEL 30 // Power failure level
#define HIGH_LEVEL 31 // Highest interrupt level
#define SYNCH_LEVEL (IPI_LEVEL-1) // synchronization level
#endif /* __ASM__ */

View file

@ -9,6 +9,6 @@ mount -t vfat /bochs/10M.vga.dos /mnt/floppy -o loop,offset=8704,rw
./install.sh /mnt/floppy
umount /mnt/floppy
echo "Installing to minix disk."
mount -t minix /bochs/10M.vga.minix /mnt/floppy -o loop,offset=8704,rw
./install.sh /mnt/floppy
umount /mnt/floppy
#mount -t minix /bochs/10M.vga.minix /mnt/floppy -o loop,offset=8704,rw
#./install.sh /mnt/floppy
#umount /mnt/floppy

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.35 2001/04/16 00:48:04 chorns Exp $
# $Id: Makefile,v 1.36 2001/04/16 02:02:03 dwelch Exp $
#
# ReactOS Operating System
#
@ -22,8 +22,12 @@ CONFIG :=
ifeq ($(DBG), 1)
CFLAGS_DBG := -g
CONFIG += DBG
LINKER_SCRIPT := ntoskrnl.lnk
STRIP_FLAGS := -Wl,-s
else
CFLAGS_DBG :=
LINKER_SCRIPT := ntoskrnl.lnk
STRIP_FLAGS := -Wl,-s
endif
ifeq ($(KDBG), 1)
@ -52,7 +56,8 @@ all: $(EXE_PREFIX)depends$(EXE_POSTFIX) \
$(OBJECTS_PATH) \
$(TARGETNAME).nostrip.exe \
$(TARGETNAME).exe \
$(TARGETNAME).sym
$(TARGETNAME).sym \
$(TARGETNAME).dbg
$(EXE_PREFIX)depends$(EXE_POSTFIX): depends.c
$(HOST_CC) -o depends$(EXE_POSTFIX) depends.c
@ -519,9 +524,9 @@ $(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(TARGETNAME).a $(IE_DATA)
$(TARGETNAME).o -lgcc
- $(RM) temp.exp
$(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a $(TARGETNAME).lnk
$(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a $(LINKER_SCRIPT)
$(CC) \
-Wl,-T,ntoskrnl.lnk \
-Wl,-T,$(LINKER_SCRIPT) \
-nostartfiles -nostdlib \
-mdll \
-o junk.tmp \
@ -540,7 +545,7 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a $(TARGETNAME).lnk
--kill-at
- $(RM) base.tmp
$(CC) \
-Wl,-T,ntoskrnl.lnk -Wl,-s\
-Wl,-T,$(LINKER_SCRIPT) $(STRIP_FLAGS)\
-nostartfiles -nostdlib \
-mdll \
-o $(TARGETNAME).exe \
@ -552,6 +557,42 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a $(TARGETNAME).lnk
$(TARGETNAME).o -lgcc
- $(RM) temp.exp
$(TARGETNAME).dbg.o: $(TARGETNAME).o
$(STRIP) --strip-debug -o $(TARGETNAME).dbg.o $(TARGETNAME).o
$(TARGETNAME).dbg: $(TARGETNAME).dbg.o $(TARGETNAME).a $(TARGETNAME).dbg.lnk
$(CC) \
-Wl,-T,$(TARGETNAME).dbg.lnk \
-nostartfiles -nostdlib \
-mdll \
-o junk.tmp \
-Wl,--subsystem,native \
-Wl,--image-base,0xc0000000 \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--base-file,base.tmp \
$(TARGETNAME).dbg.o -lgcc
- $(RM) junk.tmp
$(DLLTOOL) \
--dllname $(TARGETNAME).dbg \
--base-file base.tmp \
--output-exp temp.exp \
--def $(TARGETNAME).edf \
--kill-at
- $(RM) base.tmp
$(CC) \
-Wl,-T,$(TARGETNAME).dbg.lnk \
-nostartfiles -nostdlib \
-mdll \
-o $(TARGETNAME).dbg \
-Wl,--subsystem,native \
-Wl,--image-base,0xc0000000 \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,temp.exp \
$(TARGETNAME).dbg.o -lgcc
- $(RM) temp.exp
$(TARGETNAME).sym: $(TARGETNAME).nostrip.exe
$(NM) --numeric-sort $(TARGETNAME).nostrip.exe > $(TARGETNAME).sym

View file

@ -16,4 +16,4 @@ DBG := 1
#
# Whether to compile a multiprocessor or single processor version
#
MP := 0
MP := 1

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: kdb.c,v 1.2 2001/04/12 00:56:04 dwelch Exp $
/* $Id: kdb.c,v 1.3 2001/04/16 02:02:03 dwelch Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/dbg/kdb.c
@ -30,6 +30,9 @@
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/ps.h>
#include <limits.h>
#include <ctype.h>
#include "kdb.h"
#define NDEBUG
@ -39,19 +42,124 @@
/* GLOBALS *******************************************************************/
ULONG
DbgContCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
ULONG
DbgRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
ULONG
DbgDRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
ULONG
DbgCRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
ULONG
DbgBugCheckCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
ULONG
DbgBackTraceCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
ULONG
DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
struct
{
PCH Name;
ULONG (*Fn)(PKTRAP_FRAME Tf, PCH Args);
ULONG (*Fn)(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
} DebuggerCommands[] = {
{"cont", DbgContCommand},
{"regs", DbgRegsCommand},
{"dregs", DbgDRegsCommand},
{"cregs", DbgCRegsCommand},
{"bugcheck", DbgBugCheckCommand},
{"bt", DbgBackTraceCommand},
{"plist", DbgProcessListCommand},
{NULL, NULL}
};
/* FUNCTIONS *****************************************************************/
/*
* Convert a string to an unsigned long integer.
*
* Ignores `locale' stuff. Assumes that the upper and lower case
* alphabets and digits are each contiguous.
*/
static unsigned long
strtoul(const char *nptr, char **endptr, int base)
{
const char *s = nptr;
unsigned long acc;
int c;
unsigned long cutoff;
int neg = 0, any, cutlim;
/*
* See strtol for comments as to the logic used.
*/
do {
c = *s++;
} while (isspace(c));
if (c == '-')
{
neg = 1;
c = *s++;
}
else if (c == '+')
c = *s++;
if ((base == 0 || base == 16) &&
c == '0' && (*s == 'x' || *s == 'X'))
{
c = s[1];
s += 2;
base = 16;
}
if (base == 0)
base = c == '0' ? 8 : 10;
cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
for (acc = 0, any = 0;; c = *s++)
{
if (isdigit(c))
c -= '0';
else if (isalpha(c))
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
acc *= base;
acc += c;
}
}
if (any < 0)
{
acc = ULONG_MAX;
}
else if (neg)
acc = -acc;
if (endptr != 0)
*endptr = any ? (char *)s - 1 : (char *)nptr;
return acc;
}
char*
strpbrk(const char* s, const char* accept)
{
int i;
for (; (*s) != 0; s++)
{
for (i = 0; accept[i] != 0; i++)
{
if (accept[i] == (*s))
{
return((char *)s);
}
}
}
return(NULL);
}
VOID
KdbGetCommand(PCH Buffer)
{
@ -76,55 +184,397 @@ KdbGetCommand(PCH Buffer)
}
ULONG
DbgContCommnad(PCH Args, PKTRAP_FRAME Tf)
DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
extern LIST_ENTRY PsProcessListHead;
PLIST_ENTRY current_entry;
PEPROCESS current;
ULONG i = 1;
if (PsProcessListHead.Flink == NULL)
{
DbgPrint("No processes.\n");
return(1);
}
DbgPrint("Process list: ");
current_entry = PsProcessListHead.Flink;
while (current_entry != &PsProcessListHead)
{
current = CONTAINING_RECORD(current_entry, EPROCESS, ProcessListEntry);
DbgPrint("%d %.8s", current->UniqueProcessId,
current->ImageFileName);
i++;
if ((i % 4) == 0)
{
DbgPrint("\n");
}
current_entry = current_entry->Flink;
}
return(1);
}
VOID
DbgPrintBackTrace(PULONG Frame, ULONG StackBase, ULONG StackLimit)
{
ULONG i = 1;
DbgPrint("Frames: ");
while (Frame != NULL && (ULONG)Frame >= StackLimit &&
(ULONG)Frame < StackBase)
{
DbgPrint("%.8x ", Frame[1]);
Frame = (PULONG)Frame[0];
i++;
}
if ((i % 10) != 0)
{
DbgPrint("\n");
}
}
ULONG
DbgBackTraceCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
ULONG StackBase, StackLimit;
extern unsigned int init_stack, init_stack_top;
/* Without an argument we print the current stack. */
if (Argc == 1)
{
if (PsGetCurrentThread() != NULL)
{
StackBase = (ULONG)PsGetCurrentThread()->Tcb.StackBase;
StackLimit = PsGetCurrentThread()->Tcb.StackLimit;
}
else
{
StackBase = (ULONG)&init_stack_top;
StackLimit = (ULONG)&init_stack;
}
DbgPrintBackTrace((PULONG)Tf->Ebp, StackBase, StackLimit);
}
/*
* If there are two arguments and the second begins with a asterik treat it
* as the address of a frame to start printing the back trace from.
*/
else if (Argc == 2 && Argv[1][0] == '*')
{
PULONG Frame;
Frame = (PULONG)strtoul(&Argv[1][1], NULL, 0);
DbgPrintBackTrace(Frame, ULONG_MAX, 0);
}
/*
* Otherwise treat the argument as the id of a thread whose back trace is to
* be printed.
*/
else
{
}
return(1);
}
VOID
DbgPrintCr0(ULONG Cr0)
{
ULONG i;
DbgPrint("CR0:");
if (Cr0 & (1 << 0))
{
DbgPrint(" PE");
}
if (Cr0 & (1 << 1))
{
DbgPrint(" MP");
}
if (Cr0 & (1 << 2))
{
DbgPrint(" EM");
}
if (Cr0 & (1 << 3))
{
DbgPrint(" TS");
}
if (!(Cr0 & (1 << 4)))
{
DbgPrint(" !BIT5");
}
if (Cr0 & (1 << 5))
{
DbgPrint(" NE");
}
for (i = 6; i < 16; i++)
{
if (Cr0 & (1 << i))
{
DbgPrint(" BIT%d", i);
}
}
if (Cr0 & (1 << 16))
{
DbgPrint(" WP");
}
if (Cr0 & (1 << 17))
{
DbgPrint(" BIT17");
}
if (Cr0 & (1 << 18))
{
DbgPrint(" AM");
}
for (i = 19; i < 29; i++)
{
if (Cr0 & (1 << i))
{
DbgPrint(" BIT%d", i);
}
}
if (Cr0 & (1 << 29))
{
DbgPrint(" NW");
}
if (Cr0 & (1 << 30))
{
DbgPrint(" CD");
}
if (Cr0 & (1 << 31))
{
DbgPrint(" PG");
}
DbgPrint("\n");
}
ULONG
DbgCRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
ULONG Cr0, Cr1, Cr2, Cr3, Cr4;
ULONG Ldtr;
USHORT Tr;
__asm__ __volatile__ ("movl %%cr0, %0\n\t" : "=d" (Cr0));
/* __asm__ __volatile__ ("movl %%cr1, %0\n\t" : "=d" (Cr1)); */
Cr1 = 0;
__asm__ __volatile__ ("movl %%cr2, %0\n\t" : "=d" (Cr2));
__asm__ __volatile__ ("movl %%cr3, %0\n\t" : "=d" (Cr3));
__asm__ __volatile__ ("movl %%cr4, %0\n\t" : "=d" (Cr4));
__asm__ __volatile__ ("str %0\n\t" : "=d" (Tr));
__asm__ __volatile__ ("sldt %0\n\t" : "=d" (Ldtr));
DbgPrintCr0(Cr0);
DbgPrint("CR1 %.8x CR2 %.8x CR3 %.8x CR4 %.8x TR %.8x LDTR %.8x\n",
Cr1, Cr2, Cr3, Cr4, (ULONG)Tf, Ldtr);
return(1);
}
ULONG
DbgDRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
DbgPrint("DR0 %.8x DR1 %.8x DR2 %.8x DR3 %.8x DR6 %.8x DR7 %.8x\n",
Tf->Dr0, Tf->Dr1, Tf->Dr2, Tf->Dr3, Tf->Dr6, Tf->Dr7);
return(1);
}
ULONG
DbgContCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
/* Not too difficult. */
return(0);
}
VOID
DbgPrintEflags(ULONG Eflags)
{
DbgPrint("EFLAGS:");
if (Eflags & (1 << 0))
{
DbgPrint(" CF");
}
if (!(Eflags & (1 << 1)))
{
DbgPrint(" !BIT1");
}
if (Eflags & (1 << 2))
{
DbgPrint(" PF");
}
if (Eflags & (1 << 3))
{
DbgPrint(" BIT3");
}
if (Eflags & (1 << 4))
{
DbgPrint(" AF");
}
if (Eflags & (1 << 5))
{
DbgPrint(" BIT5");
}
if (Eflags & (1 << 6))
{
DbgPrint(" ZF");
}
if (Eflags & (1 << 7))
{
DbgPrint(" SF");
}
if (Eflags & (1 << 8))
{
DbgPrint(" TF");
}
if (Eflags & (1 << 9))
{
DbgPrint(" IF");
}
if (Eflags & (1 << 10))
{
DbgPrint(" DF");
}
if (Eflags & (1 << 11))
{
DbgPrint(" OF");
}
if ((Eflags & ((1 << 12) | (1 << 13))) == 0)
{
DbgPrint(" IOPL0");
}
else if ((Eflags & ((1 << 12) | (1 << 13))) == 1)
{
DbgPrint(" IOPL1");
}
else if ((Eflags & ((1 << 12) | (1 << 13))) == 2)
{
DbgPrint(" IOPL2");
}
else if ((Eflags & ((1 << 12) | (1 << 13))) == 3)
{
DbgPrint(" IOPL3");
}
if (Eflags & (1 << 14))
{
DbgPrint(" NT");
}
if (Eflags & (1 << 15))
{
DbgPrint(" BIT15");
}
if (Eflags & (1 << 16))
{
DbgPrint(" RF");
}
if (Eflags & (1 << 17))
{
DbgPrint(" VF");
}
if (Eflags & (1 << 18))
{
DbgPrint(" AC");
}
if (Eflags & (1 << 19))
{
DbgPrint(" VIF");
}
if (Eflags & (1 << 20))
{
DbgPrint(" VIP");
}
if (Eflags & (1 << 21))
{
DbgPrint(" ID");
}
if (Eflags & (1 << 22))
{
DbgPrint(" BIT22");
}
if (Eflags & (1 << 23))
{
DbgPrint(" BIT23");
}
if (Eflags & (1 << 24))
{
DbgPrint(" BIT24");
}
if (Eflags & (1 << 25))
{
DbgPrint(" BIT25");
}
if (Eflags & (1 << 26))
{
DbgPrint(" BIT26");
}
if (Eflags & (1 << 27))
{
DbgPrint(" BIT27");
}
if (Eflags & (1 << 28))
{
DbgPrint(" BIT28");
}
if (Eflags & (1 << 29))
{
DbgPrint(" BIT29");
}
if (Eflags & (1 << 30))
{
DbgPrint(" BIT30");
}
if (Eflags & (1 << 31))
{
DbgPrint(" BIT31");
}
DbgPrint("\n");
}
ULONG
DbgRegsCommand(PCH Args, PKTRAP_FRAME Tf)
DbgRegsCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
DbgPrint("CS:EIP %.4x:%.8x, EAX %.8x EBX %.8x ECX %.8x EDX %.8x\n",
Tf->Cs, Tf->Eip, Tf->Eax, Tf->Ebx, Tf->Ecx, Tf->Edx);
Tf->Cs & 0xFFFF, Tf->Eip, Tf->Eax, Tf->Ebx, Tf->Ecx, Tf->Edx);
DbgPrint("ESI %.8x EDI %.8x EBP %.8x SS:ESP %.4x:%.8x\n",
Tf->Esi, Tf->Edi, Tf->Ebp, Tf->Ss, Tf->Esp);
Tf->Esi, Tf->Edi, Tf->Ebp, Tf->Ss & 0xFFFF, Tf->Esp);
DbgPrintEflags(Tf->Eflags);
return(1);
}
ULONG
DbgBugCheckCommand(PCH Args, PKTRAP_FRAME Tf)
DbgBugCheckCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
KeBugCheck(1);
return(1);
}
VOID
ULONG
KdbDoCommand(PCH CommandLine, PKTRAP_FRAME Tf)
{
ULONG i;
PCH Next;
PCH s1;
PCH s;
static PCH Argv[256];
ULONG Argc;
static CHAR OrigCommand[256];
s = strpbrk(CommandLine, "\t ");
if (s != NULL)
strcpy(OrigCommand, CommandLine);
Argc = 0;
s = CommandLine;
while ((s1 = strpbrk(s, "\t ")) != NULL)
{
*s = 0;
Next = s + 1;
}
else
{
Next = NULL;
Argv[Argc] = s;
*s1 = 0;
s = s1 + 1;
Argc++;
}
Argv[Argc] = s;
Argc++;
for (i = 0; DebuggerCommands[i].Name != NULL; i++)
{
if (strcmp(DebuggerCommands[i], CommandLine) == 0)
if (strcmp(DebuggerCommands[i].Name, Argv[0]) == 0)
{
return(DebuggerCommands[i](Tf, Next));
return(DebuggerCommands[i].Fn(Argc, Argv, Tf));
}
}
DbgPrint("Command '%s %s' is unknown\n", CommandLine, Next);
DbgPrint("Command '%s' is unknown.", OrigCommand);
return(1);
}
@ -134,6 +584,7 @@ KdbMainLoop(PKTRAP_FRAME Tf)
CHAR Command[256];
ULONG s;
DbgPrint("\n");
do
{
DbgPrint("kdb:> ");

View file

@ -1,4 +1,4 @@
/* $Id: halinit.c,v 1.18 2001/04/13 16:12:25 chorns Exp $
/* $Id: halinit.c,v 1.19 2001/04/16 02:02:04 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -30,14 +30,14 @@ BOOLEAN STDCALL
HalInitSystem (ULONG BootPhase,
PLOADER_PARAMETER_BLOCK LoaderBlock)
{
if (BootPhase == 0)
{
if (BootPhase == 0)
{
HalInitializeDisplay (LoaderBlock);
#ifdef MP
HalpInitMPS();
#else
HalpInitPICs();
@ -47,13 +47,13 @@ HalInitSystem (ULONG BootPhase,
#endif /* MP */
}
else
{
}
else
{
HalpInitBusHandlers ();
}
}
return TRUE;
return TRUE;
}
/* EOF */

View file

@ -31,6 +31,9 @@ extern ULONG DpcQueueSize;
static VOID KeSetCurrentIrql(KIRQL newlvl);
#define DIRQL_TO_IRQ(x) (PROFILE_LEVEL - x)
#define IRQ_TO_DIRQL(x) (PROFILE_LEVEL - x)
/* FUNCTIONS ****************************************************************/
VOID HalpInitPICs(VOID)
@ -53,24 +56,13 @@ VOID HalpInitPICs(VOID)
WRITE_PORT_UCHAR((PUCHAR)0xa1, 0xff);
}
#if 0
static unsigned int HiGetCurrentPICMask(void)
static ULONG
HiSetCurrentPICMask(unsigned int mask)
{
unsigned int mask;
mask = READ_PORT_UCHAR((PUCHAR)0x21);
mask = mask | (READ_PORT_UCHAR((PUCHAR)0xa1)<<8);
return mask;
}
#endif
static unsigned int HiSetCurrentPICMask(unsigned int mask)
{
WRITE_PORT_UCHAR((PUCHAR)0x21,mask & 0xff);
WRITE_PORT_UCHAR((PUCHAR)0xa1,(mask >> 8) & 0xff);
return mask;
WRITE_PORT_UCHAR((PUCHAR)0x21,mask & 0xff);
WRITE_PORT_UCHAR((PUCHAR)0xa1,(mask >> 8) & 0xff);
return mask;
}
static VOID HiSwitchIrql(KIRQL oldIrql)
@ -84,25 +76,48 @@ static VOID HiSwitchIrql(KIRQL oldIrql)
CurrentThread = KeGetCurrentThread();
if (CurrentIrql == HIGH_LEVEL)
/*
* Disable all interrupts
*/
if (CurrentIrql >= IPI_LEVEL)
{
HiSetCurrentPICMask(0xffff);
return;
HiSetCurrentPICMask(0xFFFF);
__asm__("sti\n\t");
return;
}
if (CurrentIrql > DISPATCH_LEVEL)
/*
* Disable all interrupts but the timer
*/
if (CurrentIrql == PROFILE_LEVEL ||
CurrentIrql == CLOCK1_LEVEL ||
CurrentIrql == CLOCK2_LEVEL)
{
unsigned int current_mask = 0;
for (i=CurrentIrql; i>DISPATCH_LEVEL; i--)
{
current_mask = current_mask | (1 << (HIGH_LEVEL - i));
}
HiSetCurrentPICMask(current_mask);
HiSetCurrentPICMask(0xFFFE);
__asm__("sti\n\t");
return;
}
/*
* Disable all interrupts of lesser priority
*/
if (CurrentIrql > DISPATCH_LEVEL)
{
unsigned int current_mask = 0;
for (i = CurrentIrql; i > (PROFILE_LEVEL - 15); i--)
{
current_mask = current_mask | (1 << (PROFILE_LEVEL - i));
}
HiSetCurrentPICMask(current_mask);
__asm__("sti\n\t");
return;
}
/*
* Enable all interrupts
*/
if (CurrentIrql == DISPATCH_LEVEL)
{
HiSetCurrentPICMask(0);
@ -110,40 +125,46 @@ static VOID HiSwitchIrql(KIRQL oldIrql)
return;
}
HiSetCurrentPICMask(0);
/*
* APCs are disabled but execute any pending DPCs
*/
if (CurrentIrql == APC_LEVEL)
{
if (DpcQueueSize > 0 )
HiSetCurrentPICMask(0);
__asm__("sti\n\t");
if (DpcQueueSize > 0)
{
KeSetCurrentIrql(DISPATCH_LEVEL);
__asm__("sti\n\t");
KiDispatchInterrupt();
__asm__("cli\n\t");
KeSetCurrentIrql(PASSIVE_LEVEL);
CurrentIrql = DISPATCH_LEVEL;
KiDispatchInterrupt();
CurrentIrql = APC_LEVEL;
}
__asm__("sti\n\t");
return;
}
if (CurrentIrql == PASSIVE_LEVEL &&
CurrentThread != NULL &&
CurrentThread->ApcState.KernelApcPending)
/*
* Execute any pending DPCs or APCs
*/
if (CurrentIrql == PASSIVE_LEVEL)
{
KeSetCurrentIrql(APC_LEVEL);
__asm__("sti\n\t");
KiDeliverApc(0, 0, 0);
__asm__("cli\n\t");
KeSetCurrentIrql(PASSIVE_LEVEL);
__asm__("sti\n\t");
}
else
{
__asm__("sti\n\t");
if (DpcQueueSize > 0)
{
CurrentIrql = DISPATCH_LEVEL;
KiDispatchInterrupt();
CurrentIrql = PASSIVE_LEVEL;
}
if (CurrentThread != NULL &&
CurrentThread->ApcState.KernelApcPending)
{
CurrentIrql = APC_LEVEL;
KiDeliverApc(0, 0, 0);
CurrentIrql = PASSIVE_LEVEL;
}
}
}
KIRQL STDCALL KeGetCurrentIrql (VOID)
KIRQL STDCALL
KeGetCurrentIrql (VOID)
/*
* PURPOSE: Returns the current irq level
* RETURNS: The current irq level
@ -153,13 +174,13 @@ KIRQL STDCALL KeGetCurrentIrql (VOID)
}
static VOID KeSetCurrentIrql(KIRQL newlvl)
STATIC VOID
KeSetCurrentIrql(KIRQL newlvl)
/*
* PURPOSE: Sets the current irq level without taking any action
*/
{
// DPRINT("KeSetCurrentIrql(newlvl %x)\n",newlvl);
CurrentIrql = newlvl;
CurrentIrql = newlvl;
}
@ -181,27 +202,25 @@ static VOID KeSetCurrentIrql(KIRQL newlvl)
*/
VOID FASTCALL
KfLowerIrql (
KIRQL NewIrql
)
KfLowerIrql (KIRQL NewIrql)
{
KIRQL OldIrql;
__asm__("cli\n\t");
DPRINT("KfLowerIrql(NewIrql %d)\n", NewIrql);
if (NewIrql > CurrentIrql)
{
DbgPrint ("(%s:%d) NewIrql %x CurrentIrql %x\n",
__FILE__, __LINE__, NewIrql, CurrentIrql);
KeDumpStackFrames (0, 32);
for(;;);
}
OldIrql = CurrentIrql;
CurrentIrql = NewIrql;
HiSwitchIrql(OldIrql);
KIRQL OldIrql;
__asm__("cli\n\t");
DPRINT("KfLowerIrql(NewIrql %d)\n", NewIrql);
if (NewIrql > CurrentIrql)
{
DbgPrint ("(%s:%d) NewIrql %x CurrentIrql %x\n",
__FILE__, __LINE__, NewIrql, CurrentIrql);
KeDumpStackFrames (0, 32);
for(;;);
}
OldIrql = CurrentIrql;
CurrentIrql = NewIrql;
HiSwitchIrql(OldIrql);
}
@ -221,13 +240,10 @@ KfLowerIrql (
* NOTES
*/
VOID
STDCALL
KeLowerIrql (
KIRQL NewIrql
)
VOID STDCALL
KeLowerIrql (KIRQL NewIrql)
{
KfLowerIrql (NewIrql);
KfLowerIrql (NewIrql);
}
@ -248,33 +264,30 @@ KeLowerIrql (
* Uses fastcall convention
*/
KIRQL
FASTCALL
KfRaiseIrql (
KIRQL NewIrql
)
KIRQL FASTCALL
KfRaiseIrql (KIRQL NewIrql)
{
KIRQL OldIrql;
DPRINT("KfRaiseIrql(NewIrql %d)\n", NewIrql);
if (NewIrql < CurrentIrql)
{
DbgPrint ("%s:%d CurrentIrql %x NewIrql %x\n",
__FILE__,__LINE__,CurrentIrql,NewIrql);
KeBugCheck (0);
for(;;);
}
__asm__("cli\n\t");
OldIrql = CurrentIrql;
CurrentIrql = NewIrql;
DPRINT ("NewIrql %x OldIrql %x CurrentIrql %x\n",
NewIrql, OldIrql, CurrentIrql);
HiSwitchIrql(OldIrql);
return OldIrql;
KIRQL OldIrql;
DPRINT("KfRaiseIrql(NewIrql %d)\n", NewIrql);
if (NewIrql < CurrentIrql)
{
DbgPrint ("%s:%d CurrentIrql %x NewIrql %x\n",
__FILE__,__LINE__,CurrentIrql,NewIrql);
KeBugCheck (0);
for(;;);
}
__asm__("cli\n\t");
OldIrql = CurrentIrql;
CurrentIrql = NewIrql;
DPRINT ("NewIrql %x OldIrql %x CurrentIrql %x\n",
NewIrql, OldIrql, CurrentIrql);
HiSwitchIrql(OldIrql);
return OldIrql;
}
@ -295,15 +308,11 @@ KfRaiseIrql (
* NOTES
* Calls KfRaiseIrql
*/
VOID
STDCALL
KeRaiseIrql (
KIRQL NewIrql,
PKIRQL OldIrql
)
VOID STDCALL
KeRaiseIrql (KIRQL NewIrql,
PKIRQL OldIrql)
{
*OldIrql = KfRaiseIrql (NewIrql);
*OldIrql = KfRaiseIrql (NewIrql);
}
@ -324,11 +333,10 @@ KeRaiseIrql (
* Calls KfRaiseIrql
*/
KIRQL
STDCALL
KIRQL STDCALL
KeRaiseIrqlToDpcLevel (VOID)
{
return KfRaiseIrql (DISPATCH_LEVEL);
return KfRaiseIrql (DISPATCH_LEVEL);
}
@ -349,66 +357,68 @@ KeRaiseIrqlToDpcLevel (VOID)
* Calls KfRaiseIrql
*/
KIRQL
STDCALL
KIRQL STDCALL
KeRaiseIrqlToSynchLevel (VOID)
{
// return KfRaiseIrql (CLOCK2_LEVEL);
UNIMPLEMENTED;
// return KfRaiseIrql (CLOCK2_LEVEL);
UNIMPLEMENTED;
}
BOOLEAN STDCALL HalBeginSystemInterrupt (ULONG Vector,
KIRQL Irql,
PKIRQL OldIrql)
BOOLEAN STDCALL
HalBeginSystemInterrupt (ULONG Vector,
KIRQL Irql,
PKIRQL OldIrql)
{
if (Vector < IRQ_BASE || Vector > IRQ_BASE + NR_IRQS)
return FALSE;
/* Send EOI to the PICs */
WRITE_PORT_UCHAR((PUCHAR)0x20,0x20);
if ((Vector-IRQ_BASE)>=8)
{
WRITE_PORT_UCHAR((PUCHAR)0xa0,0x20);
}
*OldIrql = KeGetCurrentIrql();
if (Vector-IRQ_BASE != 0)
{
DPRINT("old_level %d\n",*OldIrql);
}
KeSetCurrentIrql(Irql);
return TRUE;
if (Vector < IRQ_BASE || Vector > IRQ_BASE + NR_IRQS)
return FALSE;
/* Send EOI to the PICs */
WRITE_PORT_UCHAR((PUCHAR)0x20,0x20);
if ((Vector-IRQ_BASE)>=8)
{
WRITE_PORT_UCHAR((PUCHAR)0xa0,0x20);
}
*OldIrql = KeGetCurrentIrql();
if (Vector-IRQ_BASE != 0)
{
DPRINT("old_level %d\n",*OldIrql);
}
KeSetCurrentIrql(Irql);
return TRUE;
}
VOID STDCALL HalEndSystemInterrupt (KIRQL Irql,
ULONG Unknown2)
{
KeSetCurrentIrql(Irql);
KeSetCurrentIrql(Irql);
}
BOOLEAN STDCALL HalDisableSystemInterrupt (ULONG Vector,
ULONG Unknown2)
{
ULONG irq;
ULONG irq;
if (Vector < IRQ_BASE || Vector > IRQ_BASE + NR_IRQS)
return FALSE;
if (Vector < IRQ_BASE || Vector > IRQ_BASE + NR_IRQS)
return FALSE;
irq = Vector - IRQ_BASE;
if (irq<8)
irq = Vector - IRQ_BASE;
if (irq < 8)
{
WRITE_PORT_UCHAR((PUCHAR)0x21, READ_PORT_UCHAR((PUCHAR)0x21)|(1<<irq));
WRITE_PORT_UCHAR((PUCHAR)0x21,
READ_PORT_UCHAR((PUCHAR)0x21)|(1<<irq));
}
else
{
WRITE_PORT_UCHAR((PUCHAR)0xa1, READ_PORT_UCHAR((PUCHAR)0xa1)|(1<<(irq-8)));
}
return TRUE;
else
{
WRITE_PORT_UCHAR((PUCHAR)0xa1,
READ_PORT_UCHAR((PUCHAR)0xa1)|(1<<(irq-8)));
}
return TRUE;
}
@ -416,22 +426,24 @@ BOOLEAN STDCALL HalEnableSystemInterrupt (ULONG Vector,
ULONG Unknown2,
ULONG Unknown3)
{
ULONG irq;
ULONG irq;
if (Vector < IRQ_BASE || Vector > IRQ_BASE + NR_IRQS)
return FALSE;
if (Vector < IRQ_BASE || Vector > IRQ_BASE + NR_IRQS)
return FALSE;
irq = Vector - IRQ_BASE;
if (irq<8)
irq = Vector - IRQ_BASE;
if (irq < 8)
{
WRITE_PORT_UCHAR((PUCHAR)0x21,
READ_PORT_UCHAR((PUCHAR)0x21)&(~(1<<irq)));
}
else
{
WRITE_PORT_UCHAR((PUCHAR)0x21, READ_PORT_UCHAR((PUCHAR)0x21)&(~(1<<irq)));
}
else
{
WRITE_PORT_UCHAR((PUCHAR)0xa1, READ_PORT_UCHAR((PUCHAR)0xa1)&(~(1<<(irq-8))));
WRITE_PORT_UCHAR((PUCHAR)0xa1,
READ_PORT_UCHAR((PUCHAR)0xa1)&(~(1<<(irq-8))));
}
return TRUE;
return TRUE;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: mp.c,v 1.7 2001/04/16 00:48:04 chorns Exp $
/* $Id: mp.c,v 1.8 2001/04/16 02:02:04 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1802,7 +1802,7 @@ ULONG MPChecksum(
while (Size--)
Sum += *Base++;
return (Sum & 0xFF);
return((UCHAR)Sum);
}
@ -2016,11 +2016,12 @@ HaliReadMPConfigTable(
PUCHAR Entry;
ULONG Count;
if ((ULONG)Table->Signature != MPC_SIGNATURE)
if (Table->Signature != MPC_SIGNATURE)
{
PCHAR pc = (PCHAR)&Table->Signature;
PUCHAR pc = (PUCHAR)&Table->Signature;
DbgPrint("Bad MP configuration block signature: %c%c%c%c\n", pc[0], pc[1], pc[2], pc[3]);
DbgPrint("Bad MP configuration block signature: %c%c%c%c/%x/%x\n", pc[0],
pc[1], pc[2], pc[3], MPC_SIGNATURE, (ULONG)Table->Signature);
KeBugCheck(0);
return;
}
@ -2225,17 +2226,19 @@ HaliScanForMPConfigTable(
*/
{
PULONG bp = (PULONG)Base;
PMP_FLOATING_POINTER mpf;
MP_FLOATING_POINTER* mpf;
while (Size > 0)
{
if (*bp == MPF_SIGNATURE)
{
if (!MPChecksum((PUCHAR)bp, 16))
DbgPrint("Found MPF signature at %x, checksum %x\n", bp,
MPChecksum((PUCHAR)bp, 16));
if (MPChecksum((PUCHAR)bp, 16) == 0)
{
mpf = (PMP_FLOATING_POINTER)bp;
mpf = (MP_FLOATING_POINTER*)bp;
DPRINT("Intel MultiProcessor Specification v1.%d compliant system.\n",
DbgPrint("Intel MultiProcessor Specification v1.%d compliant system.\n",
mpf->Specification);
if (mpf->Feature2 & FEATURE2_IMCRP) {
@ -2273,7 +2276,7 @@ HaliScanForMPConfigTable(
DPRINT("MCA and PCI\n");
break;
default:
DPRINT("Unknown standard configuration %d\n", mpf->Feature1);
DbgPrint("Unknown standard configuration %d\n", mpf->Feature1);
return FALSE;
}
@ -2337,7 +2340,7 @@ HalpInitMPS(
if (!HaliScanForMPConfigTable(0xF0000, 0x10000)) {
EBDA = *((PUSHORT)0x040E);
EBDA <<= 4;
if (!HaliScanForMPConfigTable((ULONG)EBDA, 0x400)) {
if (!HaliScanForMPConfigTable((ULONG)EBDA, 0x1000)) {
DbgPrint("No multiprocessor compliant system found.\n");
KeBugCheck(0);
}

View file

@ -2,6 +2,6 @@
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H
#define __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H
#define DBG
#define UP
#define CONFIG "DBG UP"
#define MP
#define CONFIG "DBG MP"
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H */

View file

@ -220,7 +220,7 @@ typedef struct _IOAPIC_INFO
typedef struct __attribute__((packed)) _MP_FLOATING_POINTER
{
ULONG Signature[4]; /* _MP_ */
ULONG Signature; /* _MP_ */
ULONG Address; /* Physical Address Pointer (0 means no configuration table exist) */
UCHAR Length; /* Structure length in 16-byte paragraphs */
UCHAR Specification; /* Specification revision */
@ -230,7 +230,7 @@ typedef struct __attribute__((packed)) _MP_FLOATING_POINTER
UCHAR Feature3; /* Unused (0) */
UCHAR Feature4; /* Unused (0) */
UCHAR Feature5; /* Unused (0) */
} MP_FLOATING_POINTER, *PMP_FLOATING_POINTER;
} __attribute__((packed)) MP_FLOATING_POINTER, *PMP_FLOATING_POINTER;
#define FEATURE2_IMCRP 0x80
@ -239,7 +239,7 @@ typedef struct __attribute__((packed)) _MP_FLOATING_POINTER
typedef struct __attribute__((packed)) _MP_CONFIGURATION_TABLE
{
ULONG Signature[4]; /* PCMP */
ULONG Signature; /* PCMP */
USHORT Length; /* Size of configuration table */
CHAR Specification; /* Specification Revision */
CHAR Checksum; /* Checksum */
@ -429,4 +429,6 @@ VOID APICSendIPI(ULONG Target,
VOID IOAPICDump(VOID);
VOID APICDump(VOID);
#endif /* __INCLUDE_HAL_MPS */
#endif /* __INCLUDE_HAL_MPS */
/* EOF */

View file

@ -193,4 +193,6 @@ VOID KeTrapFrameToContext(PKTRAP_FRAME TrapFrame,
#endif /* not __ASM__ */
#define MAXIMUM_PROCESSORS 32
#endif

View file

@ -75,6 +75,7 @@ RtlImageDirectoryEntryToData (
OUT PULONG Size);
VOID
LdrInit1(VOID);
VOID
LdrInitDebug(PLOADER_MODULE Module, PWCH Name);
#endif /* __INCLUDE_INTERNAL_LDR_H */

View file

@ -31,8 +31,10 @@ typedef struct _MODULE_TEXT_SECTION
LIST_ENTRY ListEntry;
PWCH Name;
#ifdef KDBG
SYMBOL_TABLE Symbols;
SYMBOL_TABLE Symbols;
#endif /* KDBG */
PVOID SymbolsBase;
ULONG SymbolsLength;
} MODULE_TEXT_SECTION;
typedef struct _MODULE_OBJECT

View file

@ -38,7 +38,7 @@
#define ETHREAD_THREADS_PROCESS 0x258
#define KPROCESS_PAGE_TABLE_DIRECTORY 0x10
#define KPROCESS_DIRECTORY_TABLE_BASE 0x18
#define KPCR_BASE 0xFF000000
@ -278,92 +278,179 @@ typedef struct _ETHREAD
* Added by David Welch (welch@cwcom.net)
*/
struct _EPROCESS* OldProcess; /* 240/26C */
struct _WIN32THREADDATA *Win32ThreadData; // Pointer to win32 private thread data
/* Pointer to win32 private thread data */
struct _WIN32THREADDATA *Win32ThreadData;
} __attribute__((packed)) ETHREAD, *PETHREAD;
typedef struct _KPROCESS
{
/* So it's possible to wait for the process to terminate */
DISPATCHER_HEADER DispatcherHeader; /* 000 */
PVOID PageTableDirectory; /* 010 */
TIME ElapsedTime;
TIME KernelTime;
TIME UserTime;
LIST_ENTRY InMemoryList;
LIST_ENTRY SwappedOutList;
KSPIN_LOCK SpinLock;
KAFFINITY Affinity;
ULONG StackCount;
KPRIORITY BasePriority;
ULONG DefaultThreadQuantum;
UCHAR ProcessState;
ULONG ThreadSeed;
UCHAR DisableBoost;
/*
* Presumably a list of profile objects associated with this process,
* currently unused.
*/
LIST_ENTRY ProfileListHead; /* 010 */
/*
* We use the first member of this array to hold the physical address of
* the page directory for this process.
*/
PVOID DirectoryTableBase[2]; /* 018 */
/*
* Presumably a descriptor for the process's LDT, currently unused.
*/
ULONG LdtDescriptor[2]; /* 020 */
/*
* Presumably for processing int 0x21 from V86 mode DOS, currently
* unused.
*/
ULONG Int21Descriptor[2]; /* 028 */
/* Don't know. */
USHORT IopmOffset; /* 030 */
/*
* Presumably I/O privilege level to be used for this process, currently
* unused.
*/
UCHAR Iopl; /* 032 */
/* Set if this process is a virtual dos machine? */
UCHAR VdmFlag; /* 033 */
/* Bitmask of the processors being used by this process's threads? */
ULONG ActiveProcessors; /* 034 */
/* Aggregate of the time this process's threads have spent in kernel mode? */
ULONG KernelTime; /* 038 */
/* Aggregate of the time this process's threads have spent in user mode? */
ULONG UserTime; /* 03C */
/* List of this process's threads that are ready for execution? */
LIST_ENTRY ReadyListHead; /* 040 */
/* List of this process's threads that have their stacks swapped out? */
LIST_ENTRY SwapListEntry; /* 048 */
/* List of this process's threads? */
LIST_ENTRY ThreadListHead; /* 050 */
/* Maybe a lock for this data structure, the type is assumed. */
KSPIN_LOCK ProcessLock; /* 058 */
/* Default affinity mask for this process's threads? */
ULONG Affinity; /* 05C */
/* Count of the stacks allocated for this process's threads? */
USHORT StackCount; /* 060 */
/* Base priority for this process's threads? */
KPRIORITY BasePriority; /* 062 */
/* Default quantum for this process's threads */
UCHAR ThreadQuantum; /* 063 */
/* Unknown. */
UCHAR AutoAlignment; /* 064 */
/* Process execution state, currently either active or terminated. */
UCHAR State; /* 065 */
/* Seed for generating thread ids for this process's threads? */
UCHAR ThreadSeed; /* 066 */
/* Disable priority boosts? */
UCHAR DisableBoost; /* 067 */
} KPROCESS, *PKPROCESS;
struct _WIN32PROCESSDATA;
typedef struct _EPROCESS
{
KPROCESS Pcb;
NTSTATUS ExitStatus;
KEVENT LockEvent;
ULONG LockCount;
TIME CreateTime;
TIME ExitTime;
PVOID LockOwner;
ULONG UniqueProcessId;
LIST_ENTRY ActiveProcessLinks;
ULONG QuotaPeakPoolUsage[2];
ULONG QuotaPoolUsage[2];
ULONG PagefileUsage;
ULONG CommitCharge;
ULONG PeakPagefileUsage;
ULONG PeakVirtualUsage;
LARGE_INTEGER VirtualSize;
PVOID Vm; // Actually 48 bytes
PVOID LastProtoPteFault;
struct _EPORT* DebugPort;
struct _EPORT* ExceptionPort;
PVOID ObjectTable;
PVOID Token;
KMUTEX WorkingSetLock;
PVOID WorkingSetPage;
UCHAR ProcessOutswapEnabled;
UCHAR ProcessOutswapped;
UCHAR AddressSpaceInitialized;
UCHAR AddressSpaceDeleted;
KMUTEX AddressCreationLock;
PVOID ForkInProgress;
PVOID VmOperation;
PKEVENT VmOperationEvent;
PVOID PageDirectoryPte;
LARGE_INTEGER LastFaultCount;
PVOID VadRoot;
PVOID VadHint;
PVOID CloneRoot;
ULONG NumberOfPrivatePages;
ULONG NumberOfLockedPages;
UCHAR ForkWasSuccessFul;
UCHAR ExitProcessCalled;
UCHAR CreateProcessReported;
HANDLE SectionHandle;
PPEB Peb;
PVOID SectionBaseAddress;
PVOID QuotaBlock;
NTSTATUS LastThreadExitStatus;
LARGE_INTEGER WorkingSetWatch; //
ULONG InheritedFromUniqueProcessId;
ACCESS_MASK GrantedAccess;
ULONG DefaultHardErrorProcessing;
PVOID LdtInformation;
ULONG VadFreeHint;
PVOID VdmObjects;
KMUTANT ProcessMutant;
CHAR ImageFileName[16];
LARGE_INTEGER VmTrimFaultValue;
struct _WIN32PROCESSDATA *Win32Process;
/* Microkernel specific process state. */
KPROCESS Pcb; /* 000 */
/* Exit status of the process. */
NTSTATUS ExitStatus; /* 068 */
/* Unknown. */
KEVENT LockEvent; /* 06C */
/* Unknown. */
ULONG LockCount; /* 07C */
/* Time of process creation. */
TIME CreateTime; /* 080 */
/* Time of process exit. */
TIME ExitTime; /* 088 */
/* Unknown. */
PVOID LockOwner; /* 090 */
/* Process id. */
ULONG UniqueProcessId; /* 094 */
/* Unknown. */
LIST_ENTRY ActiveProcessLinks; /* 098 */
/* Unknown. */
ULONG QuotaPeakPoolUsage[2]; /* 0A0 */
/* Unknown. */
ULONG QuotaPoolUsage[2]; /* 0A8 */
/* Unknown. */
ULONG PagefileUsage; /* 0B0 */
/* Unknown. */
ULONG CommitCharge; /* 0B4 */
/* Unknown. */
ULONG PeakPagefileUsage; /* 0B8 */
/* Unknown. */
ULONG PeakVirtualSize; /* 0BC */
/* Unknown. */
LARGE_INTEGER VirtualSize; /* 0C0 */
struct
{
ULONG LastTrimTime;
ULONG LastTrimFaultCount;
ULONG PageFaultCount;
ULONG PeakWorkingSetSize;
ULONG WorkingSetSize;
ULONG MinimumWorkingSetSize;
ULONG MaximumWorkingSetSize;
ULONG VmWorkingSetList;
LIST_ENTRY WorkingSetExpansionList;
UCHAR AllowWorkingSetAdjustment;
UCHAR AddressSpaceBeingDeleted;
UCHAR ForegroundPrioritySwitch;
UCHAR MemoryPriority;
} Vm;
PVOID LastProtoPteFault;
struct _EPORT* DebugPort;
struct _EPORT* ExceptionPort;
PVOID ObjectTable;
PVOID Token;
// FAST_MUTEX WorkingSetLock;
KMUTEX WorkingSetLock;
PVOID WorkingSetPage;
UCHAR ProcessOutswapEnabled;
UCHAR ProcessOutswapped;
UCHAR AddressSpaceInitialized;
UCHAR AddressSpaceDeleted;
FAST_MUTEX AddressCreationLock;
KSPIN_LOCK HyperSpaceLock;
PETHREAD ForkInProgress;
USHORT VmOperation;
UCHAR ForkWasSuccessful;
UCHAR MmAgressiveWsTrimMask;
PKEVENT VmOperationEvent;
PVOID PageDirectoryPte;
ULONG LastFaultCount;
PVOID VadRoot;
PVOID VadHint;
PVOID CloneRoot;
ULONG NumberOfPrivatePages;
ULONG NumberOfLockedPages;
USHORT NextProcessColour;
UCHAR ExitProcessCalled;
UCHAR CreateProcessReported;
HANDLE SectionHandle;
PPEB Peb;
PVOID SectionBaseAddress;
PVOID QuotaBlock;
NTSTATUS LastThreadExitStatus;
PVOID WorkingSetWatch;
HANDLE InheritedFromUniqueProcessId;
ACCESS_MASK GrantedAccess;
ULONG DefaultHardErrorProcessing;
PVOID LdtInformation;
ULONG VadFreeHint;
PVOID VdmObjects;
KMUTANT ProcessMutant;
CHAR ImageFileName[16];
ULONG VmTrimFaultValue;
UCHAR SetTimerResolution;
UCHAR PriorityClass;
UCHAR SubSystemMinorVersion;
UCHAR SubSystemMajorVersion;
USHORT SubSystemVersion;
struct _WIN32PROCESSDATA *Win32Process;
/*
* Added by David Welch (welch@mcmail.com)

View file

@ -664,7 +664,7 @@ void KeInitExceptions(void)
{
int i;
ULONG base, length;
extern USHORT KiGdt[];
extern USHORT KiBootGdt[];
extern unsigned int trap_stack_top;
extern KTSS KiTss;
extern KTSS KiTrapTss;
@ -681,10 +681,10 @@ void KeInitExceptions(void)
base = (unsigned int)&KiNullLdt;
length = sizeof(KiNullLdt) - 1;
KiGdt[(LDT_SELECTOR / 2) + 0] = (length & 0xFFFF);
KiGdt[(LDT_SELECTOR / 2) + 1] = (base & 0xFFFF);
KiGdt[(LDT_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8200;
KiGdt[(LDT_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
KiBootGdt[(LDT_SELECTOR / 2) + 0] = (length & 0xFFFF);
KiBootGdt[(LDT_SELECTOR / 2) + 1] = (base & 0xFFFF);
KiBootGdt[(LDT_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8200;
KiBootGdt[(LDT_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
((base & 0xFF000000) >> 16);
/*
@ -694,10 +694,10 @@ void KeInitExceptions(void)
base = (unsigned int)&KiTss;
length = sizeof(KiTss) - 1;
KiGdt[(TSS_SELECTOR / 2) + 0] = (length & 0xFFFF);
KiGdt[(TSS_SELECTOR / 2) + 1] = (base & 0xFFFF);
KiGdt[(TSS_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8900;
KiGdt[(TSS_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
KiBootGdt[(TSS_SELECTOR / 2) + 0] = (length & 0xFFFF);
KiBootGdt[(TSS_SELECTOR / 2) + 1] = (base & 0xFFFF);
KiBootGdt[(TSS_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8900;
KiBootGdt[(TSS_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
((base & 0xFF000000) >> 16);
/*
@ -724,10 +724,10 @@ void KeInitExceptions(void)
base = (unsigned int)&KiTrapTss;
length = sizeof(KiTrapTss) - 1;
KiGdt[(TRAP_TSS_SELECTOR / 2) + 0] = (length & 0xFFFF);
KiGdt[(TRAP_TSS_SELECTOR / 2) + 1] = (base & 0xFFFF);
KiGdt[(TRAP_TSS_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8900;
KiGdt[(TRAP_TSS_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
KiBootGdt[(TRAP_TSS_SELECTOR / 2) + 0] = (length & 0xFFFF);
KiBootGdt[(TRAP_TSS_SELECTOR / 2) + 1] = (base & 0xFFFF);
KiBootGdt[(TRAP_TSS_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8900;
KiBootGdt[(TRAP_TSS_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
((base & 0xFF000000) >> 16);
KiTrapTss.Eflags = 0;

View file

@ -28,13 +28,17 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/ke.h>
#include <internal/ps.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS *******************************************************************/
USHORT KiGdt[11 * 4] =
PUSHORT KiGdtArray[MAXIMUM_PROCESSORS];
USHORT KiBootGdt[11 * 4] =
{
0x0, 0x0, 0x0, 0x0, /* Null */
0xffff, 0x0, 0x9a00, 0xcf, /* Kernel CS */
@ -53,12 +57,42 @@ struct
{
USHORT Length;
ULONG Base;
} __attribute__((packed)) KiGdtDescriptor = { 11 * 8, (ULONG)KiGdt };
} __attribute__((packed)) KiGdtDescriptor = { 11 * 8, (ULONG)KiBootGdt };
static KSPIN_LOCK GdtLock;
/* FUNCTIONS *****************************************************************/
VOID
KiInitializeGdt(ULONG Id, PKPCR Pcr)
{
PUSHORT Gdt;
if (Id == 0)
{
KiGdtArray[0] = KiBootGdt;
return;
}
/*
* Allocate a GDT
*/
Gdt = ExAllocatePool(NonPagedPool, sizeof(USHORT) * 4 * 11);
if (Gdt == NULL)
{
KeBugCheck(0);
}
/*
* Copy the boot processor's GDT onto this processor's GDT. Note that
* the only entries that can change are the PCR, TEB and LDT descriptors.
* We will be initializing these later so their current values are
* irrelevant.
*/
memcpy(Gdt, KiGdtArray, sizeof(USHORT) * 4 * 11);
KiGdtArray[Id] = Gdt;
}
VOID
KeSetBaseGdtSelector(ULONG Entry,
PVOID Base)
@ -72,14 +106,14 @@ KeSetBaseGdtSelector(ULONG Entry,
Entry = (Entry & (~0x3)) / 2;
KiGdt[Entry + 1] = ((ULONG)Base) & 0xffff;
KiBootGdt[Entry + 1] = ((ULONG)Base) & 0xffff;
KiGdt[Entry + 2] = KiGdt[Entry + 2] & ~(0xff);
KiGdt[Entry + 2] = KiGdt[Entry + 2] |
KiBootGdt[Entry + 2] = KiBootGdt[Entry + 2] & ~(0xff);
KiBootGdt[Entry + 2] = KiBootGdt[Entry + 2] |
((((ULONG)Base) & 0xff0000) >> 16);
KiGdt[Entry + 3] = KiGdt[Entry + 3] & ~(0xff00);
KiGdt[Entry + 3] = KiGdt[Entry + 3] |
KiBootGdt[Entry + 3] = KiBootGdt[Entry + 3] & ~(0xff00);
KiBootGdt[Entry + 3] = KiBootGdt[Entry + 3] |
((((ULONG)Base) & 0xff000000) >> 16);
DPRINT("%x %x %x %x\n",
@ -97,10 +131,10 @@ KeDumpGdtSelector(ULONG Entry)
USHORT a, b, c, d;
ULONG RawLimit;
a = KiGdt[Entry*4];
b = KiGdt[Entry*4 + 1];
c = KiGdt[Entry*4 + 2];
d = KiGdt[Entry*4 + 3];
a = KiBootGdt[Entry*4];
b = KiBootGdt[Entry*4 + 1];
c = KiBootGdt[Entry*4 + 2];
d = KiBootGdt[Entry*4 + 3];
DbgPrint("Base: %x\n", b + ((c & 0xff) * (1 << 16)) +
((d & 0xff00) * (1 << 16)));
@ -123,65 +157,4 @@ KeDumpGdtSelector(ULONG Entry)
DbgPrint("G: %d\n", (d & 0x80) >> 7);
}
#if 0
VOID KeFreeGdtSelector(ULONG Entry)
/*
* FUNCTION: Free a gdt selector
* ARGUMENTS:
* Entry = Entry to free
*/
{
KIRQL oldIrql;
DPRINT("KeFreeGdtSelector(Entry %d)\n",Entry);
if (Entry > (8 + NR_TASKS))
{
DPRINT1("Entry too large\n");
KeBugCheck(0);
}
KeAcquireSpinLock(&GdtLock, &oldIrql);
KiGdt[Entry*4] = 0;
KiGdt[Entry*4 + 1] = 0;
KiGdt[Entry*4 + 2] = 0;
KiGdt[Entry*4 + 3] = 0;
KeReleaseSpinLock(&GdtLock, oldIrql);
}
#endif
#if 0
ULONG
KeAllocateGdtSelector(ULONG Desc[2])
/*
* FUNCTION: Allocate a gdt selector
* ARGUMENTS:
* Desc = Contents for descriptor
* RETURNS: The index of the entry allocated
*/
{
ULONG i;
KIRQL oldIrql;
DPRINT("KeAllocateGdtSelector(Desc[0] %x, Desc[1] %x)\n",
Desc[0], Desc[1]);
KeAcquireSpinLock(&GdtLock, &oldIrql);
for (i=8; i<(8 + NR_TASKS); i++)
{
if (KiGdt[i*4] == 0 &&
KiGdt[i*4 + 1] == 0 &&
KiGdt[i*4 + 2] == 0 &&
KiGdt[i*4 + 3] == 0)
{
((PULONG)KiGdt)[i*2] = Desc[0];
((PULONG)KiGdt)[i*2 + 1] = Desc[1];
KeReleaseSpinLock(&GdtLock, oldIrql);
DPRINT("KeAllocateGdtSelector() = %x\n",i);
return(i);
}
}
KeReleaseSpinLock(&GdtLock, oldIrql);
return(0);
}
#endif
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: irq.c,v 1.9 2001/04/13 16:12:26 chorns Exp $
/* $Id: irq.c,v 1.10 2001/04/16 02:02:05 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -344,8 +344,8 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
/*
* Notify the rest of the kernel of the raised irq level
*/
HalBeginSystemInterrupt (irq+IRQ_BASE,
HIGH_LEVEL-irq,
HalBeginSystemInterrupt (irq + IRQ_BASE,
PROFILE_LEVEL - irq,
&old_level);
/*
@ -354,7 +354,7 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
*/
__asm__("sti\n\t");
if (irq==0)
if (irq == 0)
{
KiUpdateSystemTime(old_level, Trapframe->Eip);
}

View file

@ -46,21 +46,23 @@ VOID
KeInit1(VOID)
{
PKPCR KPCR;
extern USHORT KiGdt[];
extern USHORT KiBootGdt[];
KiCheckFPU();
KeInitExceptions ();
KeInitInterrupts ();
/* Initialize the initial PCR region. We can't allocate a page
with MmAllocPage() here because MmInit1() has not yet been
called, so we use a predefined page in low memory */
/*
* Initialize the initial PCR region. We can't allocate a page
* with MmAllocPage() here because MmInit1() has not yet been
* called, so we use a predefined page in low memory
*/
KPCR = (PKPCR)KPCR_BASE;
memset(KPCR, 0, PAGESIZE);
KPCR->Self = (PKPCR)KPCR_BASE;
KPCR->Irql = HIGH_LEVEL;
KPCR->GDT = (PUSHORT)&KiGdt;
KPCR->GDT = (PUSHORT)&KiBootGdt;
KPCR->IDT = (PUSHORT)&KiIdt;
KiPcrInitDone = 1;
}

View file

@ -64,10 +64,10 @@ multiboot_header:
/* entry_addr */
.long (0x200000 + _start - KERNEL_BASE)
_multiboot_entry:
_multiboot_entry:
/*
* This must be PIC because we haven't set up paging yet
*/
*/
/*
* Gcc expects this at all times
@ -76,13 +76,13 @@ _multiboot_entry:
#ifdef MP
/*
* Save the multiboot or application processor magic
*/
movl %eax, %edx
/*
* Save the multiboot or application processor magic
*/
movl %eax, %edx
cmpl $AP_MAGIC, %edx
je .m1
cmpl $AP_MAGIC, %edx
je .m1
#endif /* MP */
@ -109,9 +109,9 @@ _multiboot_entry:
movl $(V2P(lowmem_pagetable) + 0x7), 0xD00(%esi)
movl $(V2P(startup_pagedirectory) + 0x7), 0xF00(%esi)
#ifdef MP
movl $(V2P(apic_pagetable) + 0x7), 0xFEC(%esi)
movl $(V2P(apic_pagetable) + 0x7), 0xFEC(%esi)
#endif /* MP */
movl $(V2P(kpcr_pagetable) + 0x7), 0xFF0(%esi)
movl $(V2P(kpcr_pagetable) + 0x7), 0xFF0(%esi)
/*
* Initialize the page table that maps low memory
@ -145,8 +145,10 @@ _multiboot_entry:
* Initialize the page table that maps the APIC register address space
*/
/* FIXME: APIC register address space can be non-standard so do the mapping later */
/*
* FIXME: APIC register address space can be non-standard so do the
* mapping later
*/
movl $V2P(apic_pagetable), %esi
movl $0, %edi
movl $0xFEC0001B, %eax
@ -171,7 +173,6 @@ _multiboot_entry:
#endif /* MP */
/*
* Set up the PDBR
*/
@ -186,7 +187,7 @@ _multiboot_entry:
movl %eax, %cr0
/*
* Do an absolute jump because we now want to execute at 0xc0000000
* Do an absolute jump because we now want to execute above 0xc0000000
*/
movl $.l2, %eax
jmp *%eax
@ -197,8 +198,7 @@ _multiboot_entry:
* 0xc0000000
*/
/* FIXME: Application processors should have their own GDT/IDT */
/* FIXME: Application processors should have their own GDT/IDT */
lgdt _KiGdtDescriptor
lidt _KiIdtDescriptor
@ -215,12 +215,12 @@ _multiboot_entry:
#ifdef MP
cmpl $AP_MAGIC, %edx
jne .m2
cmpl $AP_MAGIC, %edx
jne .m2
/*
* This is an application processor executing
*/
/*
* This is an application processor executing
*/
/*
* Initialize EFLAGS
@ -232,16 +232,29 @@ _multiboot_entry:
* Call the application processor initialization code
*/
pushl $0
pushl $.l7
pushl $KERNEL_CS
pushl $_KiSystemStartup
lret
lret
popl %eax
/*
* Catch illegal returns from KiSystemStartup
*/
.l7:
pushl $0
call _KeBugCheck@4
popl %eax
.l8:
jmp .l8
.m2:
#endif /* MP */
/*
* Load the initial ring0 stack
* Load the initial kernel stack
*/
movl $_init_stack_top, %esp
@ -252,15 +265,30 @@ _multiboot_entry:
popfl
/*
* Call the main ring0 initialization
* Call the main kernel initialization
*/
movl $0, %ebp
pushl %ebx
pushl %edx
pushl $0
pushl $.l5
pushl $KERNEL_CS
pushl $__main
lret
popl %eax
popl %eax
/*
* Catch illegal returns from main, try bug checking the system,
* if that fails then loop forever.
*/
.l5:
pushl $0
call _KeBugCheck@4
popl %eax
.l6:
jmp .l6
/*
* This needs to be page aligned so put it at the beginning of the bss
* segment

View file

@ -108,7 +108,7 @@ _Ki386ContextSwitch:
* Change the address space
*/
movl ETHREAD_THREADS_PROCESS(%ebx), %ebx
movl KPROCESS_PAGE_TABLE_DIRECTORY(%ebx), %eax
movl KPROCESS_DIRECTORY_TABLE_BASE(%ebx), %eax
movl %eax, %cr3
/*

View file

@ -211,7 +211,6 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
Thread->ApcStateIndex = 0;
Thread->ApcQueueable = 0;
Thread->AutoAlignment = 0;
Thread->StackBase = KernelStack;
KeInitializeApc(&Thread->SuspendApc,
Thread,
0,

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.88 2001/04/16 00:48:04 chorns Exp $
/* $Id: main.c,v 1.89 2001/04/16 02:02:04 dwelch Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@ -383,307 +383,207 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
KeBugCheck (0x0);
}
}
#if 0
VOID
TestV86Mode(VOID)
{
ULONG i;
extern UCHAR OrigIVT[1024];
KV86M_REGISTERS regs;
NTSTATUS Status;
struct vesa_info* vi;
for (i = 0; i < (640 / 4); i++)
{
MmCreateVirtualMapping(NULL,
(PVOID)(i * 4096),
PAGE_EXECUTE_READWRITE,
(ULONG)MmAllocPage(0));
}
for (; i < (1024 / 4); i++)
{
MmCreateVirtualMapping(NULL,
(PVOID)(i * 4096),
PAGE_EXECUTE_READ,
i * 4096);
}
vi = (struct vesa_info*)0x20000;
vi->Signature[0] = 'V';
vi->Signature[1] = 'B';
vi->Signature[2] = 'E';
vi->Signature[3] = '2';
memset(&regs, 0, sizeof(regs));
regs.Eax = 0x4F00;
regs.Es = 0x2000;
regs.Edi = 0x0;
memcpy((PVOID)0x0, OrigIVT, 1024);
Status = Ke386CallBios(0x10, &regs);
DbgPrint("Finished (Status %x, CS:EIP %x:%x)\n", Status, regs.Cs,
regs.Eip);
DbgPrint("Eax %x\n", regs.Eax);
DbgPrint("Signature %.4s\n", vi->Signature);
DbgPrint("TotalVideoMemory %dKB\n", vi->TotalVideoMemory * 64);
}
#endif
VOID
ExpInitializeExecutive(VOID)
{
/*
* Initialization phase 0
*/
HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
ULONG i;
ULONG start;
PCHAR name;
CHAR str[50];
/* Execute executive initialization code on bootstrap processor only */
if (!Initialized)
{
Initialized = TRUE;
DPRINT("Phase 0 initialization started...\n");
/*
* Fail at runtime if someone has changed various structures without
* updating the offsets used for the assembler code.
*/
assert(FIELD_OFFSET(KTHREAD, InitialStack) == KTHREAD_INITIAL_STACK);
assert(FIELD_OFFSET(KTHREAD, Teb) == KTHREAD_TEB);
assert(FIELD_OFFSET(KTHREAD, KernelStack) == KTHREAD_KERNEL_STACK);
assert(FIELD_OFFSET(KTHREAD, PreviousMode) == KTHREAD_PREVIOUS_MODE);
assert(FIELD_OFFSET(KTHREAD, TrapFrame) == KTHREAD_TRAP_FRAME);
assert(FIELD_OFFSET(ETHREAD, ThreadsProcess) == ETHREAD_THREADS_PROCESS);
assert(FIELD_OFFSET(KPROCESS, DirectoryTableBase) ==
KPROCESS_DIRECTORY_TABLE_BASE);
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, Self) == KPCR_SELF);
assert(FIELD_OFFSET(KPCR, CurrentThread) == KPCR_CURRENT_THREAD);
LdrInit1();
KeLowerIrql(DISPATCH_LEVEL);
NtEarlyInitVdm();
MmInit1(FirstKrnlPhysAddr, LastKrnlPhysAddr, LastKernelAddress);
/*
* Initialize the kernel debugger
*/
KdInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
if (KdPollBreakIn ())
{
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
}
MmInit2();
KeInit2();
KeLowerIrql(PASSIVE_LEVEL);
ObInit();
PiInitProcessManager();
/*
* Display version number and copyright/warranty message
*/
HalDisplayString("Starting ReactOS "KERNEL_VERSION_STR" (Build "
KERNEL_VERSION_BUILD_STR")\n");
HalDisplayString(RES_STR_LEGAL_COPYRIGHT);
HalDisplayString("\n\nReactOS is free software, covered by the GNU General "
"Public License, and you\n");
HalDisplayString("are welcome to change it and/or distribute copies of it "
"under certain\n");
HalDisplayString("conditions. There is absolutely no warranty for "
"ReactOS.\n");
/*
* Fail at runtime if someone has changed various structures without
* updating the offsets used for the assembler code.
*/
assert(FIELD_OFFSET(KTHREAD, InitialStack) == KTHREAD_INITIAL_STACK);
assert(FIELD_OFFSET(KTHREAD, Teb) == KTHREAD_TEB);
assert(FIELD_OFFSET(KTHREAD, KernelStack) == KTHREAD_KERNEL_STACK);
assert(FIELD_OFFSET(KTHREAD, PreviousMode) == KTHREAD_PREVIOUS_MODE);
assert(FIELD_OFFSET(KTHREAD, TrapFrame) == KTHREAD_TRAP_FRAME);
assert(FIELD_OFFSET(ETHREAD, ThreadsProcess) == ETHREAD_THREADS_PROCESS);
assert(FIELD_OFFSET(KPROCESS, PageTableDirectory) ==
KPROCESS_PAGE_TABLE_DIRECTORY);
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);
/* Initialize all processors */
KeNumberProcessors = 0;
assert(FIELD_OFFSET(KPCR, ExceptionList) == KPCR_EXCEPTION_LIST);
assert(FIELD_OFFSET(KPCR, Self) == KPCR_SELF);
assert(FIELD_OFFSET(KPCR, CurrentThread) == KPCR_CURRENT_THREAD);
while (!HalAllProcessorsStarted())
{
HalInitializeProcessor(KeNumberProcessors);
KeNumberProcessors++;
}
LdrInit1();
KeLowerIrql(DISPATCH_LEVEL);
NtEarlyInitVdm();
MmInit1(FirstKrnlPhysAddr, LastKrnlPhysAddr, LastKernelAddress);
/*
* Initialize the kernel debugger
*/
KdInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
if (KdPollBreakIn ())
{
DbgBreakPointWithStatus (DBG_STATUS_CONTROL_C);
}
MmInit2();
KeInit2();
{
char tmpbuf[80];
sprintf(tmpbuf,"System with %d/%d MB memory\n",
(unsigned int)(KeLoaderBlock.MemLower)/1024,
(unsigned int)(KeLoaderBlock.MemHigher)/1024);
HalDisplayString(tmpbuf);
}
KeLowerIrql(PASSIVE_LEVEL);
ObInit();
PiInitProcessManager();
/*
* Allow interrupts
*/
__asm__ ("sti\n\t");
#ifdef MP
//Phase1Initialization(NULL);
#endif
}
}
VOID
KiSystemStartup(VOID)
{
ExpInitializeExecutive();
for (;;)
{
NtYieldExecution();
}
}
/* Initialization phase 1 */
VOID Phase1Initialization(PVOID Context)
{
ULONG i;
ULONG start;
PCHAR name;
CHAR str[50];
DPRINT("Initialization phase 1 started...\n");
/*
* Display version number and copyright/warranty message
*/
HalDisplayString("Starting ReactOS "KERNEL_VERSION_STR" (Build "
KERNEL_VERSION_BUILD_STR")\n");
HalDisplayString(RES_STR_LEGAL_COPYRIGHT);
HalDisplayString("\n\nReactOS is free software, covered by the GNU General "
"Public License, and you\n");
HalDisplayString("are welcome to change it and/or distribute copies of it "
"under certain\n");
HalDisplayString("conditions. There is absolutely no warranty for ReactOS.\n");
/* Initialize all processors */
KeNumberProcessors = 0;
while (!HalAllProcessorsStarted())
{
HalInitializeProcessor(
KeNumberProcessors);
KeNumberProcessors++;
}
if (KeNumberProcessors > 1)
{
if (KeNumberProcessors > 1)
{
sprintf(str, "Found %d system processors.\n",
KeNumberProcessors);
}
else
{
KeNumberProcessors);
}
else
{
strcpy(str, "Found 1 system processor.\n");
}
HalDisplayString(str);
}
HalDisplayString(str);
#ifdef MP
DbgPrint("BSP halted\n");
for (;;);
DbgPrint("BSP halted\n");
for (;;);
#endif /* MP */
/*
* Initialize various critical subsystems
*/
HalInitSystem (1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
HalInitSystem (1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
ExInit();
IoInit();
LdrInitModuleManagement();
CmInitializeRegistry();
NtInit();
MmInit3();
/* Report all resources used by hal */
HalReportResourceUsage ();
/*
* Enter the kernel debugger before starting up the boot drivers
*/
ExInit();
IoInit();
LdrInitModuleManagement();
CmInitializeRegistry();
NtInit();
MmInit3();
/* Report all resources used by hal */
HalReportResourceUsage ();
/*
* Enter the kernel debugger before starting up the boot drivers
*/
#ifdef KDBG
KdbEnter();
KdbEnter();
#endif /* KDBG */
/*
* Initalize services loaded at boot time
*/
DPRINT1("%d files loaded\n",KeLoaderBlock.ModsCount);
for (i=0; i < KeLoaderBlock.ModsCount; i++)
{
DPRINT1("module: %s\n", KeLoaderModules[i].String);
}
/*
* Initalize services loaded at boot time
*/
DPRINT1("%d files loaded\n",KeLoaderBlock.ModsCount);
for (i=0; i < KeLoaderBlock.ModsCount; i++)
{
DPRINT1("module: %s\n", KeLoaderModules[i].String);
}
/* Pass 1: load registry chunks passed in */
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
start = KeLoaderModules[i].ModStart;
if (strcmp ((PCHAR) start, "REGEDIT4") == 0)
{
DPRINT1("process registry chunk at %08lx\n", start);
CmImportHive((PCHAR) start);
}
}
/* Pass 2: process boot loaded drivers */
for (i=1; i < KeLoaderBlock.ModsCount; i++)
{
start = KeLoaderModules[i].ModStart;
name = (PCHAR)KeLoaderModules[i].String;
if (strcmp ((PCHAR) start, "REGEDIT4") != 0)
{
DPRINT1("process module '%s' at %08lx\n", name, start);
LdrProcessDriver((PVOID)start, name);
}
/* Pass 1: load registry chunks passed in */
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
start = KeLoaderModules[i].ModStart;
if (strcmp ((PCHAR) start, "REGEDIT4") == 0)
{
DPRINT1("process registry chunk at %08lx\n", start);
CmImportHive((PCHAR) start);
}
}
DPRINT("About to try MmAllocateContiguousAlignedMemory\n");
do
{
extern PVOID STDCALL
MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
IN ULONG Alignment);
PVOID v;
PHYSICAL_ADDRESS p;
p.QuadPart = 16*1024*1024;
v = MmAllocateContiguousAlignedMemory(12*1024, p,
64*1024);
if (v != NULL)
{
DPRINT("Worked\n");
}
else
{
DPRINT("Failed\n");
}
}
while (0);
/* Pass 2: process boot loaded drivers */
for (i=1; i < KeLoaderBlock.ModsCount; i++)
{
start = KeLoaderModules[i].ModStart;
name = (PCHAR)KeLoaderModules[i].String;
if (strcmp ((PCHAR) start, "REGEDIT4") != 0)
{
DPRINT1("process module '%s' at %08lx\n", name, start);
LdrProcessDriver((PVOID)start, name);
}
}
/* Create the SystemRoot symbolic link */
DbgPrint("CommandLine: %s\n", (PUCHAR)KeLoaderBlock.CommandLine);
/* Create the SystemRoot symbolic link */
DbgPrint("CommandLine: %s\n", (PUCHAR)KeLoaderBlock.CommandLine);
CreateSystemRootLink ((PUCHAR)KeLoaderBlock.CommandLine);
CreateSystemRootLink ((PUCHAR)KeLoaderBlock.CommandLine);
#ifdef DBGPRINT_FILE_LOG
/* On the assumption that we can now access disks start up the debug
logger thread */
DebugLogInit2();
/* On the assumption that we can now access disks start up the debug
logger thread */
DebugLogInit2();
#endif /* DBGPRINT_FILE_LOG */
CmInitializeRegistry2();
CmInitializeRegistry2();
/*
* Load Auto configured drivers
*/
LdrLoadAutoConfigDrivers();
/*
* Load Auto configured drivers
*/
LdrLoadAutoConfigDrivers();
/*
* Assign drive letters
*/
IoAssignDriveLetters ((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock,
NULL,
NULL,
NULL);
/*
* Initialize shared user page:
* - set dos system path, dos device map, etc.
*/
InitSystemSharedUserPage ((PUCHAR)KeLoaderBlock.CommandLine);
/*
* Assign drive letters
*/
IoAssignDriveLetters ((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock,
NULL,
NULL,
NULL);
/*
* Launch initial process
*/
LdrLoadInitialProcess();
PsTerminateSystemThread(STATUS_SUCCESS);
}
/*
* Initialize shared user page:
* - set dos system path, dos device map, etc.
*/
InitSystemSharedUserPage ((PUCHAR)KeLoaderBlock.CommandLine);
/*
* Launch initial process
*/
LdrLoadInitialProcess();
DbgPrint("Finished kernel initialization.\n");
/* FIXME: Call zero page thread function */
PsTerminateSystemThread(STATUS_SUCCESS);
VOID
KiSystemStartup(BOOLEAN BootProcessor)
{
HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
if (BootProcessor)
{
/* Never returns */
ExpInitializeExecutive();
KeBugCheck(0);
}
/* Do application processor initialization */
for(;;);
}
VOID
@ -697,58 +597,51 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
* invalid after the memory managment is initialized so we make a local copy.
*/
{
ULONG i;
ULONG last_kernel_address;
extern ULONG _bss_end__;
ULONG i;
ULONG last_kernel_address;
extern ULONG _bss_end__;
/*
* Copy the parameters to a local buffer because lowmem will go away
*/
memcpy (&KeLoaderBlock, _LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK));
memcpy (&KeLoaderModules[1], (PVOID)KeLoaderBlock.ModsAddr,
sizeof(LOADER_MODULE) * KeLoaderBlock.ModsCount);
KeLoaderBlock.ModsCount++;
KeLoaderBlock.ModsAddr = (ULONG)&KeLoaderModules;
/*
* FIXME: Preliminary hack!!!! Add boot device to beginning of command line.
* This should be done by the boot loader.
*/
strcpy (KeLoaderCommandLine,
"multi(0)disk(0)rdisk(0)partition(1)\\reactos /DEBUGPORT=SCREEN");
strcat (KeLoaderCommandLine, (PUCHAR)KeLoaderBlock.CommandLine);
KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine;
strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe");
KeLoaderModules[0].String = (ULONG)KeLoaderModuleStrings[0];
KeLoaderModules[0].ModStart = 0xC0000000;
KeLoaderModules[0].ModEnd = PAGE_ROUND_UP((ULONG)&_bss_end__);
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
strcpy(KeLoaderModuleStrings[i], (PUCHAR)KeLoaderModules[i].String);
KeLoaderModules[i].ModStart -= 0x200000;
KeLoaderModules[i].ModStart += 0xc0000000;
KeLoaderModules[i].ModEnd -= 0x200000;
KeLoaderModules[i].ModEnd += 0xc0000000;
KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i];
}
last_kernel_address = KeLoaderModules[KeLoaderBlock.ModsCount - 1].ModEnd;
FirstKrnlPhysAddr = KeLoaderModules[0].ModStart - 0xc0000000 + 0x200000;
LastKrnlPhysAddr = last_kernel_address - 0xc0000000 + 0x200000;
LastKernelAddress = last_kernel_address;
/*
* Copy the parameters to a local buffer because lowmem will go away
*/
memcpy (&KeLoaderBlock, _LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK));
memcpy (&KeLoaderModules[1], (PVOID)KeLoaderBlock.ModsAddr,
sizeof(LOADER_MODULE) * KeLoaderBlock.ModsCount);
KeLoaderBlock.ModsCount++;
KeLoaderBlock.ModsAddr = (ULONG)&KeLoaderModules;
/*
* FIXME: Preliminary hack!!!! Add boot device to beginning of command line.
* This should be done by the boot loader.
*/
strcpy (KeLoaderCommandLine,
"multi(0)disk(0)rdisk(0)partition(1)\\reactos /DEBUGPORT=SCREEN");
strcat (KeLoaderCommandLine, (PUCHAR)KeLoaderBlock.CommandLine);
KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine;
strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe");
KeLoaderModules[0].String = (ULONG)KeLoaderModuleStrings[0];
KeLoaderModules[0].ModStart = 0xC0000000;
KeLoaderModules[0].ModEnd = PAGE_ROUND_UP((ULONG)&_bss_end__);
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{
strcpy(KeLoaderModuleStrings[i], (PUCHAR)KeLoaderModules[i].String);
KeLoaderModules[i].ModStart -= 0x200000;
KeLoaderModules[i].ModStart += 0xc0000000;
KeLoaderModules[i].ModEnd -= 0x200000;
KeLoaderModules[i].ModEnd += 0xc0000000;
KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i];
}
last_kernel_address = KeLoaderModules[KeLoaderBlock.ModsCount - 1].ModEnd;
FirstKrnlPhysAddr = KeLoaderModules[0].ModStart - 0xc0000000 + 0x200000;
LastKrnlPhysAddr = last_kernel_address - 0xc0000000 + 0x200000;
LastKernelAddress = last_kernel_address;
KeInit1();
#if 0
/*
* Allow interrupts
*/
__asm__ ("sti\n\t");
#endif
KiSystemStartup();
KeInit1();
KiSystemStartup(1);
}
/* EOF */

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: process.c,v 1.7 2001/03/16 23:04:59 dwelch Exp $
/* $Id: process.c,v 1.8 2001/04/16 02:02:04 dwelch Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/process.c
@ -60,7 +60,7 @@ KeAttachProcess (PEPROCESS Process)
CurrentThread->OldProcess = PsGetCurrentProcess();
CurrentThread->ThreadsProcess = Process;
PageDir = (ULONG)CurrentThread->ThreadsProcess->Pcb.PageTableDirectory;
PageDir = (ULONG)CurrentThread->ThreadsProcess->Pcb.DirectoryTableBase[0];
DPRINT("Switching process context to %x\n",PageDir)
__asm__("movl %0,%%cr3\n\t"
: /* no inputs */
@ -91,7 +91,7 @@ KeDetachProcess (VOID)
CurrentThread->ThreadsProcess = CurrentThread->OldProcess;
CurrentThread->OldProcess = NULL;
PageDir = (ULONG)CurrentThread->ThreadsProcess->Pcb.PageTableDirectory;
PageDir = (ULONG)CurrentThread->ThreadsProcess->Pcb.DirectoryTableBase[0];
__asm__("movl %0,%%cr3\n\t"
: /* no inputs */
: "r" (PageDir));

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.72 2001/04/11 12:46:05 chorns Exp $
/* $Id: loader.c,v 1.73 2001/04/16 02:02:05 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -20,6 +20,7 @@
* CSH 11/04/2001 Added automatic loading of module symbols if they exist
*/
/* INCLUDES *****************************************************************/
#include <limits.h>
@ -79,6 +80,33 @@ static PVOID LdrPEFixupForward(PCHAR ForwardName);
/* FUNCTIONS *****************************************************************/
VOID
LdrInitDebug(PLOADER_MODULE Module, PWCH Name)
{
PLIST_ENTRY current_entry;
MODULE_TEXT_SECTION* current;
current_entry = ModuleTextListHead.Flink;
while (current_entry != &ModuleTextListHead)
{
current =
CONTAINING_RECORD(current_entry, MODULE_TEXT_SECTION, ListEntry);
if (wcscmp(current->Name, Name) == 0)
{
break;
}
current_entry = current_entry->Flink;
}
if (current_entry == &ModuleTextListHead)
{
return;
}
current->SymbolsBase = (PVOID)Module->ModStart;
current->SymbolsLength = Module->ModEnd - Module->ModStart;
}
VOID
LdrInit1(VOID)
{
@ -101,6 +129,8 @@ LdrInit1(VOID)
NtoskrnlTextSection.Length = SectionList[0].Misc.VirtualSize +
SectionList[0].VirtualAddress;
NtoskrnlTextSection.Name = L"ntoskrnl.exe";
NtoskrnlTextSection.SymbolsBase = NULL;
NtoskrnlTextSection.SymbolsLength = 0;
InsertTailList(&ModuleTextListHead, &NtoskrnlTextSection.ListEntry);
}
@ -359,7 +389,7 @@ PSYMBOL LdrParseLine(PCHAR Line,
}
VOID LdrLoadModuleSymbols(PMODULE_OBJECT ModuleObject,
MODULE_TEXT_SECTION* ModuleTextSection)
MODULE_TEXT_SECTION* ModuleTextSection)
/*
Symbols must be sorted by address, e.g.
"nm --numeric-sort module.sys > module.sym"
@ -1303,6 +1333,8 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING FileName)
sizeof(MODULE_TEXT_SECTION));
ModuleTextSection->Base = (ULONG)DriverBase;
ModuleTextSection->Length = DriverSize;
ModuleTextSection->SymbolsBase = NULL;
ModuleTextSection->SymbolsLength = 0;
ModuleTextSection->Name =
ExAllocatePool(NonPagedPool,
(wcslen(NameBuffer) + 1) * sizeof(WCHAR));

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: page.c,v 1.26 2001/04/13 16:12:26 chorns Exp $
/* $Id: page.c,v 1.27 2001/04/16 02:02:05 dwelch Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/i386/page.c
@ -117,8 +117,8 @@ NTSTATUS Mmi386ReleaseMmInfo(PEPROCESS Process)
{
DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process);
MmDereferencePage(Process->Pcb.PageTableDirectory);
Process->Pcb.PageTableDirectory = NULL;
MmDereferencePage(Process->Pcb.DirectoryTableBase[0]);
Process->Pcb.DirectoryTableBase[0] = NULL;
DPRINT("Finished Mmi386ReleaseMmInfo()\n");
return(STATUS_SUCCESS);
@ -140,7 +140,7 @@ NTSTATUS MmCopyMmInfo(PEPROCESS Src, PEPROCESS Dest)
return(STATUS_UNSUCCESSFUL);
}
PhysPageDirectory = (PULONG)(MmGetPhysicalAddress(PageDirectory)).u.LowPart;
KProcess->PageTableDirectory = PhysPageDirectory;
KProcess->DirectoryTableBase[0] = PhysPageDirectory;
CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP;
memset(PageDirectory,0,PAGESIZE);

View file

@ -203,18 +203,18 @@ PiTerminateProcess(PEPROCESS Process, NTSTATUS ExitStatus)
Process, ExitStatus, ObGetReferenceCount(Process),
ObGetHandleCount(Process));
if (Process->Pcb.ProcessState == PROCESS_STATE_TERMINATED)
if (InterlockedExchange((PLONG)&Process->Pcb.State,
PROCESS_STATE_TERMINATED) ==
PROCESS_STATE_TERMINATED)
{
return(STATUS_SUCCESS);
}
ObCloseAllHandles(Process);
KeAcquireDispatcherDatabaseLock(FALSE);
Process->Pcb.ProcessState = PROCESS_STATE_TERMINATED;
Process->Pcb.DispatcherHeader.SignalState = TRUE;
KeDispatcherObjectWake(&Process->Pcb.DispatcherHeader);
KeReleaseDispatcherDatabaseLock(FALSE);
DPRINT("RC %d\n", ObGetReferenceCount(Process));
return(STATUS_SUCCESS);
}
@ -234,9 +234,9 @@ NTSTATUS STDCALL NtTerminateProcess(IN HANDLE ProcessHandle,
(PVOID*)&Process,
NULL);
if (!NT_SUCCESS(Status))
{
return(Status);
}
{
return(Status);
}
PiTerminateProcessThreads(Process, ExitStatus);
if (PsGetCurrentThread()->ThreadsProcess == Process)

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.60 2001/03/25 02:34:29 dwelch Exp $
/* $Id: process.c,v 1.61 2001/04/16 02:02:06 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -36,7 +36,7 @@ HANDLE SystemProcessHandle = NULL;
POBJECT_TYPE EXPORTED PsProcessType = NULL;
static LIST_ENTRY PsProcessListHead;
LIST_ENTRY PsProcessListHead;
static KSPIN_LOCK PsProcessListLock;
static ULONG PiNextProcessUniqueId = 0;
@ -216,7 +216,7 @@ VOID PsInitProcessManagment(VOID)
MmInitializeAddressSpace(PsInitialSystemProcess,
&PsInitialSystemProcess->AddressSpace);
ObCreateHandleTable(NULL,FALSE,PsInitialSystemProcess);
KProcess->PageTableDirectory = MmGetPageDirectory();
KProcess->DirectoryTableBase[0] = MmGetPageDirectory();
PsInitialSystemProcess->UniqueProcessId =
InterlockedIncrement(&PiNextProcessUniqueId);
@ -396,7 +396,8 @@ NtCreateProcess (OUT PHANDLE ProcessHandle,
MmInitializeAddressSpace(Process,
&Process->AddressSpace);
Process->UniqueProcessId = InterlockedIncrement(&PiNextProcessUniqueId);
Process->InheritedFromUniqueProcessId = ParentProcess->UniqueProcessId;
Process->InheritedFromUniqueProcessId =
(HANDLE)ParentProcess->UniqueProcessId;
ObCreateHandleTable(ParentProcess,
InheritObjectTable,
Process);
@ -407,7 +408,7 @@ NtCreateProcess (OUT PHANDLE ProcessHandle,
InitializeListHead(&Process->ThreadListHead);
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
Process->Pcb.ProcessState = PROCESS_STATE_ACTIVE;
Process->Pcb.State = PROCESS_STATE_ACTIVE;
/*
* Add the debug port
@ -678,7 +679,7 @@ NTSTATUS STDCALL NtQueryInformationProcess (IN HANDLE ProcessHandle,
ProcessBasicInformationP->UniqueProcessId =
Process->UniqueProcessId;
ProcessBasicInformationP->InheritedFromUniqueProcessId =
Process->InheritedFromUniqueProcessId;
(ULONG)Process->InheritedFromUniqueProcessId;
Status = STATUS_SUCCESS;
break;

View file

@ -1,4 +1,4 @@
/* $Id: psmgr.c,v 1.8 2001/04/13 16:12:26 chorns Exp $
/* $Id: psmgr.c,v 1.9 2001/04/16 02:02:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -27,32 +27,10 @@ VOID PiShutdownProcessManager(VOID)
VOID PiInitProcessManager(VOID)
{
#ifndef MP
HANDLE Phase1InitializationHandle;
NTSTATUS Status;
#endif
PsInitProcessManagment();
PsInitThreadManagment();
PsInitIdleThread();
PiInitApcManagement();
#ifndef MP
/* Create thread for Phase1Initialization */
Status = PsCreateSystemThread(
&Phase1InitializationHandle, /* Thread handle */
0, /* Desired access */
NULL, /* Object attributes */
NULL, /* Process handle */
NULL, /* Client id */
(PKSTART_ROUTINE)Phase1Initialization, /* Start routine */
NULL); /* Start context */
if (!NT_SUCCESS(Status)) {
DPRINT1("Could not create system thread (Status 0x%X)\n", Status);
KeBugCheck(0);
}
ZwClose(Phase1InitializationHandle);
#endif
}

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.73 2001/03/25 02:34:29 dwelch Exp $
/* $Id: thread.c,v 1.74 2001/04/16 02:02:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -454,7 +454,8 @@ NtContinue(IN PCONTEXT Context,
NTSTATUS STDCALL
NtYieldExecution(VOID)
{
return(STATUS_SUCCESS);
PsDispatchThread(THREAD_STATE_RUNNABLE);
return(STATUS_SUCCESS);
}

View file

@ -1,4 +1,4 @@
/* $Id: ctype.c,v 1.4 2000/01/11 01:16:50 ekohl Exp $
/* $Id: ctype.c,v 1.5 2001/04/16 02:02:07 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -290,12 +290,13 @@ int iswctype(wint_t wc, wctype_t wctypeFlags)
return (_pwctype[(unsigned char)(wc & 0xFF)] & wctypeFlags);
}
/*
int isalpha(int c)
{
return(_isctype(c, _ALPHA));
}
/*
int isalnum(int c)
{
return(_isctype(c, _ALPHA | _DIGIT));