ReactOS 0.4.17-dev-150-g85f2a67
acwin.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Name: acwin.h - OS specific defines, etc.
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACWIN_H__
45#define __ACWIN_H__
46
47#include <io.h>
48
49#define ACPI_USE_STANDARD_HEADERS
50#define ACPI_USE_SYSTEM_CLIBRARY
51
52 /* Note: do not include any C library headers here */
53
54 /*
55 * Note: MSVC project files should define ACPI_DEBUGGER and ACPI_DISASSEMBLER
56 * as appropriate to enable editor functions like "Find all references".
57 * The editor isn't smart enough to dig through the include files to find
58 * out if these are actually defined.
59 */
60
61 /* Eliminate warnings for "old" (non-secure) versions of clib functions */
62
63#ifndef _CRT_SECURE_NO_WARNINGS
64#define _CRT_SECURE_NO_WARNINGS
65#endif
66
67/* Eliminate warnings for POSIX clib function names (open, write, etc.) */
68
69#ifndef _CRT_NONSTDC_NO_DEPRECATE
70#define _CRT_NONSTDC_NO_DEPRECATE
71#endif
72
73
74#define ACPI_MACHINE_WIDTH 32
75#define ACPI_USE_NATIVE_DIVIDE
76#define ACPI_USE_NATIVE_MATH64
77
78#ifdef ACPI_DEFINE_ALTERNATE_TYPES
79/*
80 * Types used only in (Linux) translated source, defined here to enable
81 * cross-platform compilation (i.e., generate the Linux code on Windows,
82 * for test purposes only)
83 */
84typedef int s32;
85typedef unsigned char u8;
86typedef unsigned short u16;
87typedef unsigned int u32;
89#endif
90
91#ifndef __REACTOS__
92/*
93 * Map low I/O functions for MS. This allows us to disable MS language
94 * extensions for maximum portability.
95 */
96#define open _open
97#define read _read
98#define write _write
99#define close _close
100#define stat _stat
101#define fstat _fstat
102#define mkdir _mkdir
103#define fileno _fileno
104#define isatty _isatty
105#endif // __REACTOS__
106
107#if _MSC_VER <= 1200 /* Versions below VC++ 6 */
108#define vsnprintf _vsnprintf
109#endif
110#define O_RDONLY _O_RDONLY
111#define O_BINARY _O_BINARY
112#define O_CREAT _O_CREAT
113#define O_WRONLY _O_WRONLY
114#define O_TRUNC _O_TRUNC
115#define S_IREAD _S_IREAD
116#define S_IWRITE _S_IWRITE
117#define S_IFDIR _S_IFDIR
118#if _MSC_VER < 1900
119#define snprintf _snprintf
120#endif
121
122
123/*
124 * Handle platform- and compiler-specific assembly language differences.
125 *
126 * Notes:
127 * 1) Interrupt 3 is used to break into a debugger
128 * 2) Interrupts are turned off during ACPI register setup
129 */
130
133#ifndef __REACTOS__
134#ifdef ACPI_APPLICATION
135#define ACPI_FLUSH_CPU_CACHE()
136#else
137#define ACPI_FLUSH_CPU_CACHE() __asm {WBINVD}
138#endif
139#endif /* __REACTOS__ */
140
141#ifdef _DEBUG
142#define ACPI_SIMPLE_RETURN_MACROS
143#endif
144
147#ifndef __REACTOS__
148/*
149 * Global Lock acquire/release code
150 *
151 * Note: Handles case where the FACS pointer is null
152 */
153#define ACPI_ACQUIRE_GLOBAL_LOCK(FacsPtr, Acq) __asm \
154{ \
155 __asm mov eax, 0xFF \
156 __asm mov ecx, FacsPtr \
157 __asm or ecx, ecx \
158 __asm jz exit_acq \
159 __asm lea ecx, [ecx].GlobalLock \
160 \
161 __asm acq10: \
162 __asm mov eax, [ecx] \
163 __asm mov edx, eax \
164 __asm and edx, 0xFFFFFFFE \
165 __asm bts edx, 1 \
166 __asm adc edx, 0 \
167 __asm lock cmpxchg dword ptr [ecx], edx \
168 __asm jnz acq10 \
169 \
170 __asm cmp dl, 3 \
171 __asm sbb eax, eax \
172 \
173 __asm exit_acq: \
174 __asm mov Acq, al \
175}
176
177#define ACPI_RELEASE_GLOBAL_LOCK(FacsPtr, Pnd) __asm \
178{ \
179 __asm xor eax, eax \
180 __asm mov ecx, FacsPtr \
181 __asm or ecx, ecx \
182 __asm jz exit_rel \
183 __asm lea ecx, [ecx].GlobalLock \
184 \
185 __asm Rel10: \
186 __asm mov eax, [ecx] \
187 __asm mov edx, eax \
188 __asm and edx, 0xFFFFFFFC \
189 __asm lock cmpxchg dword ptr [ecx], edx \
190 __asm jnz Rel10 \
191 \
192 __asm cmp dl, 3 \
193 __asm and eax, 1 \
194 \
195 __asm exit_rel: \
196 __asm mov Pnd, al \
197}
198#endif /* __REACTOS__ */
199
200#endif /* __ACWIN_H__ */
#define COMPILER_DEPENDENT_UINT64
Definition: accygwin.h:73
signed int s32
Definition: linux.h:57
#define u16
Definition: types.h:8
#define u32
Definition: types.h:9
#define u64
Definition: types.h:10
#define u8
Definition: types.h:7