mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:15:59 +00:00
[NDK][NTOS] Add global definition of INIT_FUNCTION/INIT_SECTION (#779)
* Add an NDK header to define INIT_FUNCTION/INIT_SECTION globally * Use _declspec(allocate(x)) and _declspec(code_seg(x)) on MSVC versions that support it * Use INIT_FUNCTION on functions only and INIT_SECTION on data only (required by MSVC) * Place INIT_FUNCTION before the return type (required by MSVC) * Make sure declarations and implementations share the same modifiers (required by MSVC) * Add a global linker option to suppress warnings about defined but unused INIT section * Merge INIT section into .text in freeldr
This commit is contained in:
parent
7c66247343
commit
71fefa32db
108 changed files with 522 additions and 296 deletions
|
@ -753,7 +753,7 @@ VfatReleaseFromLazyWrite(
|
|||
ExReleaseResourceLite(&(Fcb->MainResource));
|
||||
}
|
||||
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
VfatInitFastIoRoutines(
|
||||
PFAST_IO_DISPATCH FastIoDispatch)
|
||||
|
|
|
@ -48,7 +48,7 @@ PVFAT_GLOBAL_DATA VfatGlobalData;
|
|||
* RegistryPath = path to our configuration entries
|
||||
* RETURNS: Success or failure
|
||||
*/
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(
|
||||
|
|
|
@ -5,17 +5,12 @@
|
|||
#include <ntdddisk.h>
|
||||
#include <dos.h>
|
||||
#include <pseh/pseh2.h>
|
||||
#include <section_attribs.h>
|
||||
#ifdef KDBG
|
||||
#include <ndk/kdfuncs.h>
|
||||
#include <reactos/kdros.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define INIT_SECTION __attribute__((section ("INIT")))
|
||||
#else
|
||||
#define INIT_SECTION /* Done via alloc_text for MSC */
|
||||
#endif
|
||||
|
||||
|
||||
#define USE_ROS_CC_AND_FS
|
||||
#define ENABLE_SWAPOUT
|
||||
|
@ -823,6 +818,7 @@ VfatSetExtendedAttributes(
|
|||
|
||||
/* fastio.c */
|
||||
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
VfatInitFastIoRoutines(
|
||||
PFAST_IO_DISPATCH FastIoDispatch);
|
||||
|
@ -1127,6 +1123,7 @@ VfatFileSystemControl(
|
|||
|
||||
/* iface.c */
|
||||
|
||||
INIT_FUNCTION
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(
|
||||
|
|
|
@ -82,7 +82,7 @@ DfsUnload(PDRIVER_OBJECT DriverObject)
|
|||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
NTSTATUS
|
||||
DfsDriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
PUNICODE_STRING RegistryPath)
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
#ifndef _DFS_PCH_
|
||||
#define _DFS_PCH_
|
||||
|
||||
#ifndef INIT_SECTION
|
||||
#ifdef __GNUC__
|
||||
#define INIT_SECTION __attribute__((section ("INIT")))
|
||||
#else
|
||||
#define INIT_SECTION /* Done via alloc_text for MSC */
|
||||
#endif
|
||||
#define INIT_FUNCTION INIT_SECTION
|
||||
#endif
|
||||
|
||||
#define DFS_OPEN_CONTEXT 0xFF444653
|
||||
#define DFS_DOWNLEVEL_OPEN_CONTEXT 0x11444653
|
||||
#define DFS_CSCAGENT_NAME_CONTEXT 0xAAAAAAAA
|
||||
|
@ -49,6 +58,7 @@ DfsUnload(
|
|||
PDRIVER_OBJECT DriverObject
|
||||
);
|
||||
|
||||
INIT_FUNCTION
|
||||
NTSTATUS
|
||||
DfsDriverEntry(
|
||||
PDRIVER_OBJECT DriverObject,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
INIT_FUNCTION
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(
|
||||
|
@ -39,11 +40,13 @@ DriverEntry(
|
|||
PUNICODE_STRING RegistryPath
|
||||
);
|
||||
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
MupInitializeData(
|
||||
VOID
|
||||
);
|
||||
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
MupInitializeVcb(
|
||||
PMUP_VCB Vcb
|
||||
|
@ -76,7 +79,7 @@ NTSTATUS MupOrderedErrorList[] = { STATUS_UNSUCCESSFUL,
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
MupInitializeData(VOID)
|
||||
{
|
||||
|
@ -102,7 +105,7 @@ MupUninitializeData()
|
|||
ExDeleteResourceLite(&MupVcbLock);
|
||||
}
|
||||
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
MupInitializeVcb(PMUP_VCB Vcb)
|
||||
{
|
||||
|
@ -2507,7 +2510,7 @@ MupUnload(PDRIVER_OBJECT DriverObject)
|
|||
* RegistryPath = path to our configuration entries
|
||||
* RETURNS: Success or failure
|
||||
*/
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
|
|
|
@ -5,12 +5,7 @@
|
|||
#include <ntifs.h>
|
||||
#include <pseh/pseh2.h>
|
||||
#include <ndk/muptypes.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define INIT_SECTION __attribute__((section ("INIT")))
|
||||
#else
|
||||
#define INIT_SECTION /* Done via alloc_text for MSC */
|
||||
#endif
|
||||
#include <section_attribs.h>
|
||||
|
||||
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
||||
#define IO_METHOD_FROM_CTL_CODE(C) (C & 0x00000003)
|
||||
|
|
|
@ -49,7 +49,7 @@ PNTFS_GLOBAL_DATA NtfsGlobalData = NULL;
|
|||
* RegistryPath = path to our configuration entries
|
||||
* RETURNS: Success or failure
|
||||
*/
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
|
@ -169,7 +169,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
* DriverObject = object describing this driver
|
||||
* RETURNS: Nothing
|
||||
*/
|
||||
INIT_SECTION
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
NTAPI
|
||||
NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
|
||||
|
|
|
@ -3,12 +3,7 @@
|
|||
|
||||
#include <ntifs.h>
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define INIT_SECTION __attribute__((section ("INIT")))
|
||||
#else
|
||||
#define INIT_SECTION /* Done via alloc_text for MSC */
|
||||
#endif
|
||||
#include <section_attribs.h>
|
||||
|
||||
#define CACHEPAGESIZE(pDeviceExt) \
|
||||
((pDeviceExt)->NtfsInfo.UCHARsPerCluster > PAGE_SIZE ? \
|
||||
|
@ -1260,8 +1255,10 @@ NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
|
|||
|
||||
/* ntfs.c */
|
||||
|
||||
INIT_FUNCTION
|
||||
DRIVER_INITIALIZE DriverEntry;
|
||||
|
||||
INIT_FUNCTION
|
||||
VOID
|
||||
NTAPI
|
||||
NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue