Author: sginsberg Date: Thu Sep 3 15:31:09 2015 New Revision: 68937
URL: http://svn.reactos.org/svn/reactos?rev=68937&view=rev Log: - Enable placing kernel functions in the .INIT section (GCC only, MSVC is TBD). This allows them to be freed from memory after initialization is finished. - PspMapSystemDll and IopDisplayLoadingMessage are called from non-initialization code, so don't put them in .INIT. CmpHiveRootSecurityDescriptor is called from initialization code, but too late in boot, so don't discard it either. - Trying to enable this for HAL as well leads to a weird crash very early in boot. Investigation is ongoing. Until then we will just have to keep the huge PCI Class/Vendor tables in memory... - Enable it for Win32k though as it seems to work fine there. - Remove INIT_FUNCTION from function prototypes, it serves no purpose there. See issue 10097 for more details.
Modified: trunk/reactos/ntoskrnl/config/cmse.c trunk/reactos/ntoskrnl/include/internal/dbgk.h trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h trunk/reactos/ntoskrnl/io/iomgr/driver.c trunk/reactos/ntoskrnl/ps/psmgr.c trunk/reactos/win32ss/win32kp.h
Modified: trunk/reactos/ntoskrnl/config/cmse.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmse.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/config/cmse.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cmse.c [iso-8859-1] Thu Sep 3 15:31:09 2015 @@ -16,9 +16,9 @@
/* FUNCTIONS *****************************************************************/
+//INIT_FUNCTION PSECURITY_DESCRIPTOR NTAPI -INIT_FUNCTION CmpHiveRootSecurityDescriptor(VOID) { NTSTATUS Status;
Modified: trunk/reactos/ntoskrnl/include/internal/dbgk.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/d... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/dbgk.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/dbgk.h [iso-8859-1] Thu Sep 3 15:31:09 2015 @@ -47,7 +47,6 @@ #endif
VOID -INIT_FUNCTION NTAPI DbgkInitialize( VOID
Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/i... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] Thu Sep 3 15:31:09 2015 @@ -662,7 +662,6 @@ );
NTSTATUS -INIT_FUNCTION IopInitPlugPlayEvents(VOID);
NTSTATUS
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/n... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h [iso-8859-1] Thu Sep 3 15:31:09 2015 @@ -3,16 +3,15 @@ /* * Use these to place a function in a specific section of the executable */ -#define PLACE_IN_SECTION(s) __attribute__((section (s))) #ifdef __GNUC__ -#define INIT_FUNCTION -#define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") -#define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") +#define INIT_SECTION __attribute__((section ("INIT"))) +#define INIT_FUNCTION INIT_SECTION #else -#define INIT_FUNCTION -#define PAGE_LOCKED_FUNCTION -#define PAGE_UNLOCKED_FUNCTION -#endif +#define INIT_SECTION /* Done via alloc_text for MSC */ +#define INIT_FUNCTION INIT_SECTION +#endif + +
#ifdef _NTOSKRNL_
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c?... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Thu Sep 3 15:31:09 2015 @@ -197,7 +197,6 @@ */ VOID FASTCALL -INIT_FUNCTION IopDisplayLoadingMessage(PUNICODE_STRING ServiceName) { CHAR TextBuffer[256];
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=689... ============================================================================== --- trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] Thu Sep 3 15:31:09 2015 @@ -242,7 +242,6 @@
NTSTATUS NTAPI -INIT_FUNCTION PspMapSystemDll(IN PEPROCESS Process, IN PVOID *DllBase, IN BOOLEAN UseLargePages)
Modified: trunk/reactos/win32ss/win32kp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/win32kp.h?rev=68937... ============================================================================== --- trunk/reactos/win32ss/win32kp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/win32kp.h [iso-8859-1] Thu Sep 3 15:31:09 2015 @@ -10,15 +10,12 @@
#pragma once
-#if 0 -#ifndef _MSC_VER -#define PLACE_IN_SECTION(s) __attribute__((section(s))) -#define INIT_FUNCTION PLACE_IN_SECTION("INIT") +#ifdef __GNUC__ +#define INIT_SECTION __attribute__((section ("INIT"))) +#define INIT_FUNCTION INIT_SECTION #else -#define INIT_FUNCTION -#endif -#else -#define INIT_FUNCTION +#define INIT_SECTION /* Done via alloc_text for MSC */ +#define INIT_FUNCTION INIT_SECTION #endif
/* Enable debugging features */