- 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.

svn path=/trunk/; revision=68937
This commit is contained in:
Stefan Ginsberg 2015-09-03 15:31:09 +00:00
parent 42a15c9829
commit 72a849ff44
7 changed files with 12 additions and 20 deletions

View file

@ -16,9 +16,9 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
//INIT_FUNCTION
PSECURITY_DESCRIPTOR PSECURITY_DESCRIPTOR
NTAPI NTAPI
INIT_FUNCTION
CmpHiveRootSecurityDescriptor(VOID) CmpHiveRootSecurityDescriptor(VOID)
{ {
NTSTATUS Status; NTSTATUS Status;

View file

@ -47,7 +47,6 @@
#endif #endif
VOID VOID
INIT_FUNCTION
NTAPI NTAPI
DbgkInitialize( DbgkInitialize(
VOID VOID

View file

@ -662,7 +662,6 @@ IoDestroyDriverList(
); );
NTSTATUS NTSTATUS
INIT_FUNCTION
IopInitPlugPlayEvents(VOID); IopInitPlugPlayEvents(VOID);
NTSTATUS NTSTATUS

View file

@ -3,17 +3,16 @@
/* /*
* Use these to place a function in a specific section of the executable * Use these to place a function in a specific section of the executable
*/ */
#define PLACE_IN_SECTION(s) __attribute__((section (s)))
#ifdef __GNUC__ #ifdef __GNUC__
#define INIT_FUNCTION #define INIT_SECTION __attribute__((section ("INIT")))
#define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") #define INIT_FUNCTION INIT_SECTION
#define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo")
#else #else
#define INIT_FUNCTION #define INIT_SECTION /* Done via alloc_text for MSC */
#define PAGE_LOCKED_FUNCTION #define INIT_FUNCTION INIT_SECTION
#define PAGE_UNLOCKED_FUNCTION
#endif #endif
#ifdef _NTOSKRNL_ #ifdef _NTOSKRNL_
#ifndef _ARM_ #ifndef _ARM_

View file

@ -197,7 +197,6 @@ IopSuffixUnicodeString(
*/ */
VOID VOID
FASTCALL FASTCALL
INIT_FUNCTION
IopDisplayLoadingMessage(PUNICODE_STRING ServiceName) IopDisplayLoadingMessage(PUNICODE_STRING ServiceName)
{ {
CHAR TextBuffer[256]; CHAR TextBuffer[256];

View file

@ -242,7 +242,6 @@ PspLookupKernelUserEntryPoints(VOID)
NTSTATUS NTSTATUS
NTAPI NTAPI
INIT_FUNCTION
PspMapSystemDll(IN PEPROCESS Process, PspMapSystemDll(IN PEPROCESS Process,
IN PVOID *DllBase, IN PVOID *DllBase,
IN BOOLEAN UseLargePages) IN BOOLEAN UseLargePages)

View file

@ -10,15 +10,12 @@
#pragma once #pragma once
#if 0 #ifdef __GNUC__
#ifndef _MSC_VER #define INIT_SECTION __attribute__((section ("INIT")))
#define PLACE_IN_SECTION(s) __attribute__((section(s))) #define INIT_FUNCTION INIT_SECTION
#define INIT_FUNCTION PLACE_IN_SECTION("INIT")
#else #else
#define INIT_FUNCTION #define INIT_SECTION /* Done via alloc_text for MSC */
#endif #define INIT_FUNCTION INIT_SECTION
#else
#define INIT_FUNCTION
#endif #endif
/* Enable debugging features */ /* Enable debugging features */