ReactOS 0.4.17-dev-116-ga4b6fe9
section_attribs.h
Go to the documentation of this file.
1/*++ NDK Version: 0099
2
3Copyright (c) Alex Ionescu. All rights reserved.
4
5Header Name:
6
7 section_attribs.h
8
9Abstract:
10
11 Preprocessor definitions to put code and data into specific sections.
12
13Author:
14
15 Timo Kreuzer (timo.kreuzer@reactos.org)
16
17--*/
18
19#pragma once
20
21#if defined(__GNUC__) || defined(__clang__)
22
23#define DATA_SEG(segment) __attribute__((section(segment)))
24#define CODE_SEG(segment) __attribute__((section(segment)))
25
26#elif defined(_MSC_VER)
27
28#define DATA_SEG(segment) __declspec(allocate(segment))
29#define CODE_SEG(segment) __declspec(code_seg(segment))
30
31#else
32
33#error Invalid compiler!
34
35#endif
36
37/*
38 * This attribute should be applied to a function that
39 * is called from pageable code and raises the IRQL at DISPATCH_LEVEL or higher,
40 * and restores the IRQL before it returns. We must make sure that function is not inlined.
41 */
42#define DECLSPEC_NOINLINE_FROM_PAGED DECLSPEC_NOINLINE
43
44/*
45 * This attribute should be applied to a pageable function that
46 * is called from non-pageable code at IRQL lower than DISPATCH_LEVEL.
47 * We should make sure that function is not inlined. Some compilers (GCC)
48 * can do inlining even if the function is in another section.
49 * See the discussion https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31362
50 * for more details.
51 */
52#define DECLSPEC_NOINLINE_FROM_NOT_PAGED DECLSPEC_NOINLINE