From a80496b963f17a21ead7e949dc9eb5786e03598f Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Sun, 27 Apr 2003 14:45:52 +0000 Subject: [PATCH] 2003-04-27 Casper S. Hornstrup * tools/helper.mk (TARGET_ASFLAGS): Add -march and define MK_ARCH_ID. * lib/ntdll/makefile (TARGET_ASFLAGS): Define as "-I $(PATH_TO_TOP)/include". (TARGET_OBJECTS): Add ldr/entry.o. * lib/ntdll/ldr/startup.c: Move inline assembly code... * lib/ntdll/ldr/entry.S: ...here. New file. svn path=/trunk/; revision=4598 --- reactos/ChangeLog | 9 ++++++++ reactos/lib/ntdll/ldr/entry.S | 18 +++++++++++++++ reactos/lib/ntdll/ldr/startup.c | 39 +-------------------------------- reactos/lib/ntdll/makefile | 5 ++++- reactos/tools/helper.mk | 3 ++- 5 files changed, 34 insertions(+), 40 deletions(-) create mode 100755 reactos/lib/ntdll/ldr/entry.S diff --git a/reactos/ChangeLog b/reactos/ChangeLog index b61b2b3905a..2e81fb27663 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,12 @@ +2003-04-27 Casper S. Hornstrup + + * tools/helper.mk (TARGET_ASFLAGS): Add -march and define MK_ARCH_ID. + * lib/ntdll/makefile (TARGET_ASFLAGS): Define as + "-I $(PATH_TO_TOP)/include". + (TARGET_OBJECTS): Add ldr/entry.o. + * lib/ntdll/ldr/startup.c: Move inline assembly code... + * lib/ntdll/ldr/entry.S: ...here. New file. + 2003-04-27 Casper S. Hornstrup * include/kernel32/kernel32.h (assert): Define. diff --git a/reactos/lib/ntdll/ldr/entry.S b/reactos/lib/ntdll/ldr/entry.S new file mode 100755 index 00000000000..7e239860013 --- /dev/null +++ b/reactos/lib/ntdll/ldr/entry.S @@ -0,0 +1,18 @@ +#include + +.extern ___true_LdrInitializeThunk@16 + +.globl _LdrInitializeThunk@16 +_LdrInitializeThunk@16: +#if defined(_M_IX86) + nop /* breakin overwrites this with "int 3" */ + jmp ___true_LdrInitializeThunk@16 +#elif defined(_M_ALPHA) + nop /* breakin overwrites this with "call_pal bpt" */ + "br" +#elif defined(_M_MIPS) + nop /* breakin overwrites this with "break" */ + j ___true_LdrInitializeThunk@16 +#else +#error Unsupported architecture. +#endif diff --git a/reactos/lib/ntdll/ldr/startup.c b/reactos/lib/ntdll/ldr/startup.c index 7365a437b3e..004c1cd4908 100644 --- a/reactos/lib/ntdll/ldr/startup.c +++ b/reactos/lib/ntdll/ldr/startup.c @@ -1,4 +1,4 @@ -/* $Id: startup.c,v 1.49 2003/04/26 23:13:29 hyperion Exp $ +/* $Id: startup.c,v 1.50 2003/04/27 14:45:52 chorns Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -38,43 +38,6 @@ ULONG NtGlobalFlag = 0; /* FUNCTIONS *****************************************************************/ -#if 0 -/* FIXME: why doesn't gcc recognize __declspec(naked)? */ -__declspec(naked) VOID STDCALL LdrInitializeThunk -( - ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3, - ULONG Unknown4 -) -{ - __asm__ - ( -#else - __asm__ - ( - "\n" - ".global _LdrInitializeThunk@16\n" - "_LdrInitializeThunk@16:\n" -#endif - -#if defined(_M_IX86) - "nop\n" /* breakin overwrites this with "int 3" */ - "jmp" -#elif defined(_M_ALPHA) - "nop\n" /* breakin overwrites this with "call_pal bpt" */ - "br" -#elif defined(_M_MIPS) - "nop\n" /* breakin overwrites this with "break" */ - "j" -#else -#error Unsupported architecture. -#endif - " ___true_LdrInitializeThunk@16\n" - ); -#if 0 -} -#endif VOID STDCALL __true_LdrInitializeThunk (ULONG Unknown1, diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index 5e9215f779d..ffef2e751c5 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.81 2003/04/23 22:58:02 gvg Exp $ +# $Id: makefile,v 1.82 2003/04/27 14:45:52 chorns Exp $ PATH_TO_TOP = ../.. @@ -10,6 +10,8 @@ TARGET_NAME = ntdll TARGET_CFLAGS = -g -D__NTDLL__ +TARGET_ASFLAGS = -I $(PATH_TO_TOP)/include + TARGET_LFLAGS = -Wl,--file-alignment,0x1000 \ -Wl,--section-alignment,0x1000 \ -nostartfiles @@ -64,6 +66,7 @@ ARCH_OBJECTS = \ TARGET_OBJECTS = \ napi.o \ + ldr/entry.o \ ldr/startup.o \ $(ARCH_OBJECTS) \ $(DBG_OBJECTS) \ diff --git a/reactos/tools/helper.mk b/reactos/tools/helper.mk index 46c953cd941..1a4218b3fc1 100644 --- a/reactos/tools/helper.mk +++ b/reactos/tools/helper.mk @@ -1,4 +1,4 @@ -# $Id: helper.mk,v 1.34 2003/04/13 17:38:27 chorns Exp $ +# $Id: helper.mk,v 1.35 2003/04/27 14:45:52 chorns Exp $ # # Helper makefile for ReactOS modules # Variables this makefile accepts: @@ -488,6 +488,7 @@ endif include $(PATH_TO_TOP)/config +TARGET_ASFLAGS += -march=$(ARCH) -D$(MK_ARCH_ID) TARGET_CFLAGS += $(MK_CFLAGS) TARGET_CFLAGS += -pipe -march=$(ARCH) -D$(MK_ARCH_ID) ifeq ($(DBG),1)