2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>

* tools/help.mk: Make the install target depend on all the
	files to be installed.

2002-06-16  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* ntoskrnl/ps/thread.c (NtCallbackReturn): Set TSS.Esp0 to the
	top of the old stack.
	* ntoskrnl/ps/thread.c (NtW32Call): Set TSS.Esp0 to the top of
	the new stack. Free the callback stack correctly. Don't copy
	portion of the trap frame that doesn't exist in non-v86-mode
	interrupts.
	* ntoskrnl/ps/thread.c (PsFreeCallbackStack): New function to
	free a stack allocated with PsAllocateCallbackStack.

2002-06-16  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* drivers/dd/null/makefile: Commented out local LDFLAGS as
	these cause bad relocations in the stripped image.

2002-06-16  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>

	* config: Corrected spelling error.

svn path=/trunk/; revision=3107
This commit is contained in:
David Welch 2002-06-16 21:41:16 +00:00
parent 78f1caa4a9
commit 279f0b0ed5
5 changed files with 84 additions and 44 deletions

View file

@ -1,3 +1,28 @@
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* tools/help.mk: Make the install target depend on all the
files to be installed.
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* ntoskrnl/ps/thread.c (NtCallbackReturn): Set TSS.Esp0 to the
top of the old stack.
* ntoskrnl/ps/thread.c (NtW32Call): Set TSS.Esp0 to the top of
the new stack. Free the callback stack correctly. Don't copy
portion of the trap frame that doesn't exist in none v86-mode
interrupts.
* ntoskrnl/ps/thread.c (PsFreeCallbackStack): New function to
free a stack allocated with PsAllocateCallbackStack.
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* drivers/dd/null/makefile: Commented out local LDFLAGS as
these cause bad relocations in the stripped image.
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* config: Corrected spelling error.
2002-06-11 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
* subsys/system/winlogon/winlogon.c (WinMain): Check for

View file

@ -2,7 +2,7 @@
# Architecture to build for
#
# Specify one of: i386
# Possibble values in the future: alpha,i386,m68k,mips,powerpc
# Possible values in the future: alpha,i386,m68k,mips,powerpc
ARCH := i386
#

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.15 2002/04/29 23:06:42 hyperion Exp $
# $Id: makefile,v 1.16 2002/06/16 21:41:15 dwelch Exp $
PATH_TO_TOP = ../../..
@ -8,7 +8,7 @@ TARGET_NAME = null
TARGET_OBJECTS = null.o
TARGET_LFLAGS = -Wl,--file-alignment,0x20 -Wl,--section-alignment,0x20
#TARGET_LFLAGS = -Wl,--file-alignment,0x20 -Wl,--section-alignment,0x20
include $(PATH_TO_TOP)/rules.mak

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.96 2002/06/16 20:52:07 jfilby Exp $
/* $Id: thread.c,v 1.97 2002/06/16 21:41:16 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -561,6 +561,7 @@ NtCallbackReturn (PVOID Result,
Thread->Tcb.InitialStack = InitialStack;
Thread->Tcb.StackBase = StackBase;
Thread->Tcb.StackLimit = StackLimit;
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack;
KeStackSwitchAndRet((PVOID)(OldStack + 6));
/* Should never return. */
@ -568,6 +569,30 @@ NtCallbackReturn (PVOID Result,
return(STATUS_UNSUCCESSFUL);
}
VOID STATIC
PsFreeCallbackStackPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
PHYSICAL_ADDRESS PhysAddr, SWAPENTRY SwapEntry,
BOOLEAN Dirty)
{
assert(SwapEntry == 0);
if (PhysAddr.QuadPart != 0)
{
MmReleasePageMemoryConsumer(MC_NPPOOL, PhysAddr);
}
}
VOID STATIC
PsFreeCallbackStack(PVOID StackLimit)
{
MmLockAddressSpace(MmGetKernelAddressSpace());
MmFreeMemoryArea(MmGetKernelAddressSpace(),
StackLimit,
MM_STACK_SIZE,
PsFreeCallbackStackPage,
NULL);
MmUnlockAddressSpace(MmGetKernelAddressSpace());
}
PVOID STATIC
PsAllocateCallbackStack(ULONG StackSize)
{
@ -636,9 +661,10 @@ NtW32Call (IN ULONG RoutineIndex,
/* Set up the new kernel and user environment. */
StackSize = (ULONG)(Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
NewStack = PsAllocateCallbackStack(StackSize);
memcpy(NewStack + StackSize - 124, Thread->Tcb.TrapFrame,
124);
NewFrame = (PKTRAP_FRAME)(NewStack + StackSize - 124);
/* FIXME: Need to check whether we were interrupted from v86 mode. */
memcpy(NewStack + StackSize - sizeof(KTRAP_FRAME), Thread->Tcb.TrapFrame,
sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD)));
NewFrame = (PKTRAP_FRAME)(NewStack + StackSize - sizeof(KTRAP_FRAME));
NewFrame->Esp -= (ArgumentLength + (4 * sizeof(ULONG)));
NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher();
UserEsp = (PULONG)NewFrame->Esp;
@ -655,7 +681,8 @@ NtW32Call (IN ULONG RoutineIndex,
SavedInitialStack = Thread->Tcb.InitialStack;
Thread->Tcb.InitialStack = Thread->Tcb.StackBase = NewStack + StackSize;
Thread->Tcb.StackLimit = (ULONG)NewStack;
Thread->Tcb.KernelStack = NewStack + StackSize - 124;
Thread->Tcb.KernelStack = NewStack + StackSize - sizeof(KTRAP_FRAME);
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack;
KePushAndStackSwitchAndSysRet(SavedStackLimit,
(ULONG)SavedStackBase,
(ULONG)SavedInitialStack, (ULONG)Result,
@ -667,7 +694,7 @@ NtW32Call (IN ULONG RoutineIndex,
* modified.
*/
KeLowerIrql(PASSIVE_LEVEL);
ExFreePool(NewStack);
PsFreeCallbackStack(NewStack);
return(CallbackStatus);
}

View file

@ -1,4 +1,4 @@
# $Id: helper.mk,v 1.15 2002/06/14 17:17:38 chorns Exp $
# $Id: helper.mk,v 1.16 2002/06/16 21:41:16 dwelch Exp $
#
# Helper makefile for ReactOS modules
# Variables this makefile accepts:
@ -138,8 +138,8 @@ ifeq ($(TARGET_TYPE),library)
MK_IMPLIBONLY := no
MK_IMPLIBDEFPATH :=
MK_IMPLIB_EXT :=
MK_INSTALLDIR := # Don't install
MK_DISTDIR := # Don't include in distribution
MK_INSTALLDIR := system32
MK_DISTDIR := # FIXME
MK_RES_BASE :=
endif
@ -350,12 +350,12 @@ endif
ifeq ($(MK_MODE),user)
MK_DEFBASE := 0x400000
MK_LIBS := $(addprefix $(SDK_PATH_LIB)/, $(MK_SDKLIBS) $(TARGET_SDKLIBS)) $(TARGET_LIBS)
MK_LIBS := $(addprefix $(SDK_PATH_LIB)/, $(MK_SDKLIBS) $(TARGET_SDKLIBS))
endif
ifeq ($(MK_MODE),kernel)
MK_DEFBASE := 0x10000
MK_LIBS := $(addprefix $(DDK_PATH_LIB)/, $(MK_DDKLIBS) $(TARGET_DDKLIBS)) $(TARGET_LIBS)
MK_LIBS := $(addprefix $(DDK_PATH_LIB)/, $(MK_DDKLIBS) $(TARGET_DDKLIBS))
endif
@ -374,16 +374,20 @@ endif
#
include $(PATH_TO_TOP)/config
TARGET_CFLAGS += $(MK_CFLAGS)
TARGET_CFLAGS += $(PIPE) -march=$(ARCH)
TARGET_CFLAGS += -pipe -march=$(ARCH)
ifeq ($(DBG),1)
#TARGET_CFLAGS += -g
endif
TARGET_CPPFLAGS += $(MK_CPPFLAGS)
TARGET_CPPFLAGS += $(PIPE) -march=$(ARCH)
TARGET_CPPFLAGS += -pipe -march=$(ARCH)
TARGET_RCFLAGS += $(MK_RCFLAGS)
TARGET_ASFLAGS += $(MK_ASFLAGS)
TARGET_ASFLAGS += $(PIPE) -march=$(ARCH)
TARGET_ASFLAGS += -pipe -march=$(ARCH)
TARGET_NFLAGS += $(MK_NFLAGS)
@ -396,7 +400,7 @@ MK_IMPLIB_FULLNAME := $(MK_BASENAME)$(MK_IMPLIB_EXT)
MK_NOSTRIPNAME := $(MK_BASENAME).nostrip$(MK_EXT)
# We don't want to link header files
MK_OBJECTS := $(filter-out %.h,$(TARGET_OBJECTS))
MK_OBJECTS := $(filter-out %.h,$(TARGET_OBJECTS))
MK_STRIPPED_OBJECT := $(MK_BASENAME).stripped.o
ifeq ($(MK_IMPLIBONLY),yes)
@ -416,7 +420,7 @@ else # MK_IMPLIBONLY
all: $(MK_FULLNAME) $(MK_NOSTRIPNAME)
ifeq ($(MK_IMPLIB),yes)
MK_EXTRACMD := --def $(MK_EDFNAME)
@ -481,21 +485,20 @@ $(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
--base-file base.tmp \
--output-exp temp.exp $(MK_EXTRACMD)
- $(RM) base.tmp
$(CC) \
$(CC) $(TARGET_LFLAGS) \
-Wl,--subsystem,native \
-Wl,--image-base,$(TARGET_BASE) \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--entry,$(TARGET_ENTRY) \
-Wl,temp.exp \
$(TARGET_LFLAGS) \
-mdll -nostartfiles -nostdlib \
-o $(MK_NOSTRIPNAME) \
$(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
- $(RM) temp.exp
- $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).sym
$(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).sym
$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) $(MK_NOSTRIPNAME)
$(LD) -r -o $(MK_STRIPPED_OBJECT) $(MK_OBJECTS)
$(STRIP) --strip-debug $(MK_STRIPPED_OBJECT)
$(CC) -Wl,--base-file,base.tmp \
@ -509,14 +512,13 @@ $(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
--base-file base.tmp \
--output-exp temp.exp $(MK_EXTRACMD)
- $(RM) base.tmp
$(CC) \
$(CC) $(TARGET_LFLAGS) \
-Wl,--subsystem,native \
-Wl,--image-base,$(TARGET_BASE) \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--entry,$(TARGET_ENTRY) \
-Wl,temp.exp \
$(TARGET_LFLAGS) \
-mdll -nostartfiles -nostdlib \
-o $(MK_FULLNAME) \
$(MK_FULLRES) $(MK_STRIPPED_OBJECT) $(MK_LIBS) $(MK_GCCLIBS)
@ -527,12 +529,8 @@ endif # MK_MODE
# Static library target
ifeq ($(MK_MODE),static)
$(MK_NOSTRIPNAME): $(TARGET_OBJECTS)
$(AR) -r $(MK_NOSTRIPNAME) $(TARGET_OBJECTS)
# FIXME: dummy rule
$(MK_FULLNAME): $(MK_NOSTRIPNAME)
$(CP) $(MK_NOSTRIPNAME) $(MK_FULLNAME)
$(MK_FULLNAME): $(TARGET_OBJECTS)
$(AR) -r $(MK_FULLNAME) $(TARGET_OBJECTS)
endif # MK_MODE
@ -550,10 +548,10 @@ ifeq ($(MK_IMPLIB),yes)
endif
# Be carefull not to clean non-object files
MK_CLEANFILES := $(filter %.o,$(MK_OBJECTS))
MK_CLEANFILES := $(filter %.o,$(MK_OBJECTS))
clean:
- $(RM) .*.d *.o $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(MK_RES_BASE).coff \
- $(RM) *.o $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(MK_RES_BASE).coff \
$(MK_FULLNAME) $(MK_NOSTRIPNAME) $(MK_CLEANFILES) \
junk.tmp base.tmp temp.exp \
$(TARGET_CLEAN)
@ -574,19 +572,10 @@ dist:
else # MK_IMPLIBONLY
ifeq ($(MK_MODE),static)
# Don't install static libraries
install:
dist:
else # MK_MODE
install: $(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_FULLNAME)
$(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_FULLNAME): $(MK_FULLNAME)
$(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_FULLNAME): $(MK_FULLNAME) $(MK_BASENAME).sym
$(CP) $(MK_FULLNAME) $(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_FULLNAME)
$(CP) $(MK_BASENAME).sym $(INSTALL_DIR)/symbols/$(MK_BASENAME).sym
@ -596,7 +585,6 @@ $(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME): $(MK_FULLNAME)
$(CP) $(MK_FULLNAME) $(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME)
$(CP) $(MK_BASENAME).sym $(DIST_DIR)/symbols/$(MK_BASENAME).sym
endif # MK_MODE
endif # MK_IMPLIBONLY