From 81a9f1c4b055744027b127c8b8651522d52d6d4f Mon Sep 17 00:00:00 2001 From: Emanuele Aliberti Date: Tue, 12 Oct 1999 21:19:40 +0000 Subject: [PATCH] Little changes in the psxdll library. svn path=/trunk/; revision=694 --- reactos/Makefile | 2 +- reactos/include/reactos/config.h | 6 ++- reactos/lib/ntdll/def/ntdll.def | 4 +- reactos/lib/ntdll/def/ntdll.edf | 4 +- reactos/lib/ntdll/makefile | 6 +-- reactos/lib/psxdll/libc/stdlib/exit.c | 24 +++++++++ reactos/lib/psxdll/makefile | 8 ++- reactos/lib/psxdll/misc/dllmain.c | 77 +++++++++++++++++++++++---- reactos/lib/psxdll/misc/special.c | 3 +- reactos/lib/psxdll/psxdll.def | 4 +- reactos/lib/psxdll/psxdll.edf | 4 +- 11 files changed, 116 insertions(+), 26 deletions(-) create mode 100644 reactos/lib/psxdll/libc/stdlib/exit.c diff --git a/reactos/Makefile b/reactos/Makefile index 264fe72fc6c..a6161c3839b 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -15,7 +15,7 @@ include rules.mak # Required to run the system # COMPONENTS = iface_native ntoskrnl -DLLS = ntdll kernel32 crtdll fmifs gdi32 +DLLS = ntdll kernel32 crtdll fmifs gdi32 psxdll #DLLS = advapi32 mingw32 user32 SUBSYS = smss win32k #SUBSYS = csrss diff --git a/reactos/include/reactos/config.h b/reactos/include/reactos/config.h index cf05426db98..31ebf8e758a 100644 --- a/reactos/include/reactos/config.h +++ b/reactos/include/reactos/config.h @@ -1,6 +1,6 @@ #ifndef _INC_REACTOS_CONFIG_H #define _INC_REACTOS_CONFIG_H -/* $Id: config.h,v 1.1 1999/08/29 07:01:32 ea Exp $ */ +/* $Id: config.h,v 1.2 1999/10/12 21:17:03 ea Exp $ */ /* ReactOS global configuration options */ #define CONFIG_PROCESSOR_FAMILY_I386 "i386" @@ -15,6 +15,10 @@ */ #define CONFIG_PROCESSOR_FAMILY CONFIG_PROCESSOR_FAMILY_I586 #define CONFIG_ARCHITECTURE CONFIG_ARCHITECTURE_IBMPC +/* + * Hardware page size + */ +#define CONFIG_MEMORY_PAGE_SIZE 4096 /* * Use __fastcall calling conventions when needed * in system components that require it. diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index 04bd3e8c2b2..06a5341e89e 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -1,8 +1,8 @@ -; $Id: ntdll.def,v 1.15 1999/09/12 22:06:26 ea Exp $ +; $Id: ntdll.def,v 1.16 1999/10/12 21:17:04 ea Exp $ ; ; ReactOS Operating System ; -LIBRARY ntdll +LIBRARY ntdll.dll EXPORTS InitializeObjectAttributes diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index a7112cd6a78..db2e50436d4 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -1,8 +1,8 @@ -; $Id: ntdll.edf,v 1.6 1999/09/12 22:06:26 ea Exp $ +; $Id: ntdll.edf,v 1.7 1999/10/12 21:17:04 ea Exp $ ; ; ReactOS Operating System ; -LIBRARY ntdll +LIBRARY ntdll.dll EXPORTS InitializeObjectAttributes diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index 6898ae20355..d180266b046 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.23 1999/09/04 18:35:48 ekohl Exp $ +# $Id: makefile,v 1.24 1999/10/12 21:17:03 ea Exp $ # # ReactOS Operating System # @@ -65,7 +65,7 @@ $(TARGET).dll: $(DLLMAIN) $(OBJECTS) def/ntdll.def def/ntdll.edf $(OBJECTS) \ -o $(TARGET).o $(DLLTOOL) \ - --dllname $(TARGET).dll \ + --dllname $(TARGET) \ --def def/$(TARGET).def \ --kill-at \ --output-lib $(TARGET).a @@ -77,7 +77,7 @@ $(TARGET).dll: $(DLLMAIN) $(OBJECTS) def/ntdll.def def/ntdll.edf $(TARGET).o - $(RM) junk.tmp $(DLLTOOL) \ - --dllname $(TARGET).dll \ + --dllname $(TARGET) \ --base-file base.tmp \ --output-exp temp.exp \ --def def/$(TARGET).edf diff --git a/reactos/lib/psxdll/libc/stdlib/exit.c b/reactos/lib/psxdll/libc/stdlib/exit.c new file mode 100644 index 00000000000..e8e2d410246 --- /dev/null +++ b/reactos/lib/psxdll/libc/stdlib/exit.c @@ -0,0 +1,24 @@ +/* $Id: exit.c,v 1.1 1999/10/12 21:19:40 ea Exp $ + * + * reactos/lib/psxdll/libc/stdlib/exit.c + * + * POSIX+ Subsystem client shared library + */ +#define NTOS_MODE_USER +#include + + +void +_exit ( + int code + ) +{ + /* FIXME: call atexit registered functions */ + NtTerminateProcess ( + NtCurrentProcess(), + code + ); +} + + +/* EOF */ diff --git a/reactos/lib/psxdll/makefile b/reactos/lib/psxdll/makefile index 3e9a0677ba1..7a8f192897f 100644 --- a/reactos/lib/psxdll/makefile +++ b/reactos/lib/psxdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.1 1999/09/12 21:54:16 ea Exp $ +# $Id: makefile,v 1.2 1999/10/12 21:17:04 ea Exp $ # # ReactOS psxdll.dll makefile # @@ -19,11 +19,15 @@ BASE_CFLAGS = -I../../include all: $(DLLTARGET) +OBJECTS_LIBC_STDLIB = libc/stdlib/exit.o + +OBJECTS_LIBC = $(OBJECTS_LIBC_STDLIB) + OBJECTS_MISC = misc/dllmain.o misc/special.o misc/heap.o misc/rtl.o OBJECTS_RESOURCE = $(TARGETNAME).coff -OBJECTS = $(OBJECTS_MISC) $(OBJECTS_RESOURCE) +OBJECTS = $(OBJECTS_LIBC) $(OBJECTS_LIBM) $(OBJECTS_MISC) $(OBJECTS_RESOURCE) DEFS=$(TARGETNAME).def $(TARGETNAME).edf diff --git a/reactos/lib/psxdll/misc/dllmain.c b/reactos/lib/psxdll/misc/dllmain.c index 52cfcb38268..904dcf7b762 100644 --- a/reactos/lib/psxdll/misc/dllmain.c +++ b/reactos/lib/psxdll/misc/dllmain.c @@ -1,22 +1,79 @@ -/* $Id: dllmain.c,v 1.1 1999/09/12 21:54:16 ea Exp $ +/* $Id: dllmain.c,v 1.2 1999/10/12 21:17:05 ea Exp $ * * reactos/subsys/psxdll/dllmain.c * * ReactOS Operating System * - POSIX+ client side DLL (ReactOS POSIX+ Subsystem) */ -#include +#define NTOS_MODE_USER +#include +#include -BOOL -WINAPI -DllMain ( - HINSTANCE hinstDll, - DWORD fdwReason, - LPVOID fImpLoad - ) + +/* --- Data --- */ + +PVOID +__PdxHeap = NULL; + +HANDLE +__PdxApiPort = INVALID_HANDLE_VALUE; + +HINSTANCE +__PdxModuleHandle; + +/* --- Internal functions --- */ + + +BOOLEAN +__PdxConnectToPsxSs (VOID) { - /* FIXME: Connect to psxss.exe */ + /* FIXME: call NtConnectPort(); */ return TRUE; } +/* --- Library entry point --- */ + + +BOOL +WINAPI +DllMain ( + HINSTANCE hInstDll, + DWORD fdwReason, + LPVOID fImpLoad + ) +{ + if (DLL_PROCESS_ATTACH == fdwReason) + { + /* + * Save the module handle. + */ + __PdxModuleHandle = hInstDll; + /* + * Create a heap for the client process. + * Initially its size is the same as the + * memory page size; it is growable and + * grows 512 bytes a time. + */ + __PdxHeap = RtlCreateHeap ( + 3, /* Flags */ + NULL, /* Base address */ + CONFIG_MEMORY_PAGE_SIZE, /* Initial size */ + 512, /* Maximum size/grow by */ + 0, /* unknown */ + NULL /* PHEAP_DEFINITION */ + ); + /* + * Connect to the POSIX+ subsystem + * process (psxss.exe). + */ + if (FALSE == __PdxConnectToPsxSs()) + { + return FALSE; + } + } + return TRUE; +} + + +/* EOF */ diff --git a/reactos/lib/psxdll/misc/special.c b/reactos/lib/psxdll/misc/special.c index c2fc7d1a630..d36eaa6b828 100644 --- a/reactos/lib/psxdll/misc/special.c +++ b/reactos/lib/psxdll/misc/special.c @@ -1,10 +1,11 @@ -/* $Id: special.c,v 1.1 1999/09/12 21:54:16 ea Exp $ +/* $Id: special.c,v 1.2 1999/10/12 21:17:05 ea Exp $ * * reactos/subsys/psxdll/misc/special.c * * ReactOS Operating System * - POSIX+ client side DLL (ReactOS POSIX+ Subsystem) */ +#define NTOS_MODE_USER #include diff --git a/reactos/lib/psxdll/psxdll.def b/reactos/lib/psxdll/psxdll.def index 9c46a45b952..70eb8417016 100644 --- a/reactos/lib/psxdll/psxdll.def +++ b/reactos/lib/psxdll/psxdll.def @@ -1,4 +1,4 @@ -; $Id: psxdll.def,v 1.2 1999/09/12 21:54:16 ea Exp $ +; $Id: psxdll.def,v 1.3 1999/10/12 21:17:04 ea Exp $ ; ; psxdll.def ; @@ -41,7 +41,7 @@ RtlZeroMemory@8 __PdxGetCmdLine@0 __PdxInitializeData@8 ;__findenv -;_exit +_exit ;_fdptcheck ;_sigjmp_store_mask ;accept diff --git a/reactos/lib/psxdll/psxdll.edf b/reactos/lib/psxdll/psxdll.edf index 67a45d0a562..5deff2e7282 100644 --- a/reactos/lib/psxdll/psxdll.edf +++ b/reactos/lib/psxdll/psxdll.edf @@ -1,4 +1,4 @@ -; $Id: psxdll.edf,v 1.1 1999/09/12 21:54:16 ea Exp $ +; $Id: psxdll.edf,v 1.2 1999/10/12 21:17:04 ea Exp $ ; ; psxdll.edf ; @@ -41,7 +41,7 @@ RtlZeroMemory=RtlZeroMemory@8 __PdxGetCmdLine=__PdxGetCmdLine@0 __PdxInitializeData=__PdxInitializeData@8 ;__findenv -;_exit +_exit ;_fdptcheck ;_sigjmp_store_mask ;accept