~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to modules/linux/pvscsi/vm_basic_defs.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-11-20 21:56:00 UTC
  • mfrom: (1.1.3 upstream) (2.2.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20081120215600-0jujiv17a2ja92xu
Tags: 2008.11.18-130226-1
* Replacing obsolete dh_clean -k with dh_prep.
* Merging upstream version 2008.11.18-130226.
* Updating debian directory for addition of pvscsi and vmxnet3 modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************
 
2
 * Copyright (C) 2003 VMware, Inc. All rights reserved.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the
 
6
 * Free Software Foundation version 2 and no later version.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
10
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
11
 * for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
15
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
16
 *
 
17
 *********************************************************/
 
18
 
 
19
/*
 
20
 * vm_basic_defs.h --
 
21
 *
 
22
 *      Standard macros for VMware source code.
 
23
 */
 
24
 
 
25
#ifndef _VM_BASIC_DEFS_H_
 
26
#define _VM_BASIC_DEFS_H_
 
27
 
 
28
#define INCLUDE_ALLOW_USERLEVEL
 
29
#define INCLUDE_ALLOW_VMMEXT
 
30
#define INCLUDE_ALLOW_MODULE
 
31
#define INCLUDE_ALLOW_VMMON
 
32
#define INCLUDE_ALLOW_VMNIXMOD
 
33
#define INCLUDE_ALLOW_VMKERNEL
 
34
#define INCLUDE_ALLOW_VMKDRIVERS
 
35
#define INCLUDE_ALLOW_VMK_MODULE
 
36
#define INCLUDE_ALLOW_DISTRIBUTE
 
37
#define INCLUDE_ALLOW_VMCORE
 
38
#define INCLUDE_ALLOW_VMIROM
 
39
#include "includeCheck.h"
 
40
#include "vm_basic_types.h" // For INLINE.
 
41
 
 
42
/* Checks for FreeBSD, filtering out VMKERNEL. */
 
43
#define __IS_FREEBSD__ (!defined(VMKERNEL) && defined(__FreeBSD__))
 
44
#define __IS_FREEBSD_VER__(ver) (__IS_FREEBSD__ && __FreeBSD_version >= (ver))
 
45
 
 
46
#if defined _WIN32 && defined USERLEVEL
 
47
   #include <stddef.h>  /*
 
48
                         * We re-define offsetof macro from stddef, make 
 
49
                         * sure that its already defined before we do it
 
50
                         */
 
51
   #include <windows.h> // for Sleep() and LOWORD() etc.
 
52
#endif
 
53
 
 
54
 
 
55
/*
 
56
 * Simple macros
 
57
 */
 
58
 
 
59
#if (defined __APPLE__ || defined __FreeBSD__) && \
 
60
    (!defined KERNEL && !defined _KERNEL && !defined VMKERNEL && !defined __KERNEL__)
 
61
#   include <stddef.h>
 
62
#else
 
63
// XXX the __cplusplus one matches that of VC++, to prevent redefinition warning
 
64
// XXX the other one matches that of gcc3.3.3/glibc2.2.4 to prevent redefinition warnings
 
65
#ifndef offsetof
 
66
#ifdef __cplusplus
 
67
#define offsetof(s,m)   (size_t)&(((s *)0)->m)
 
68
#else
 
69
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
70
#endif
 
71
#endif
 
72
#endif // __APPLE__
 
73
 
 
74
#ifndef ARRAYSIZE
 
75
#define ARRAYSIZE(a) (sizeof (a) / sizeof *(a))
 
76
#endif
 
77
 
 
78
#ifndef MIN
 
79
#define MIN(_a, _b)   (((_a) < (_b)) ? (_a) : (_b))
 
80
#endif
 
81
 
 
82
/* The Solaris 9 cross-compiler complains about these not being used */
 
83
#ifndef sun
 
84
static INLINE int 
 
85
Min(int a, int b)
 
86
{
 
87
   return a < b ? a : b;
 
88
}
 
89
#endif
 
90
 
 
91
#ifndef MAX
 
92
#define MAX(_a, _b)   (((_a) > (_b)) ? (_a) : (_b))
 
93
#endif
 
94
 
 
95
#ifndef sun
 
96
static INLINE int 
 
97
Max(int a, int b)
 
98
{
 
99
   return a > b ? a : b;
 
100
}
 
101
#endif
 
102
 
 
103
#define ROUNDUP(x,y)            (((x) + (y) - 1) / (y) * (y))
 
104
#define ROUNDDOWN(x,y)          ((x) / (y) * (y))
 
105
#define ROUNDUPBITS(x, bits)    (((uintptr_t) (x) + MASK(bits)) & ~MASK(bits))
 
106
#define ROUNDDOWNBITS(x, bits)  ((uintptr_t) (x) & ~MASK(bits))
 
107
#define CEILING(x, y)           (((x) + (y) - 1) / (y))
 
108
#if defined __APPLE__
 
109
#include <machine/param.h>
 
110
#undef MASK
 
111
#endif
 
112
#define MASK(n)                 ((1 << (n)) - 1)        /* make an n-bit mask */
 
113
#define DWORD_ALIGN(x)          ((((x)+3) >> 2) << 2)
 
114
#define QWORD_ALIGN(x)          ((((x)+4) >> 3) << 3)
 
115
 
 
116
#define IMPLIES(a,b) (!(a) || (b))
 
117
 
 
118
/*
 
119
 * Not everybody (e.g., the monitor) has NULL
 
120
 */
 
121
 
 
122
#ifndef NULL
 
123
#ifdef  __cplusplus
 
124
#define NULL    0
 
125
#else
 
126
#define NULL    ((void *)0)
 
127
#endif
 
128
#endif
 
129
 
 
130
 
 
131
/* 
 
132
 * Token concatenation
 
133
 *
 
134
 * The C preprocessor doesn't prescan arguments when they are
 
135
 * concatenated or stringified.  So we need extra levels of
 
136
 * indirection to convince the preprocessor to expand its
 
137
 * arguments.
 
138
 */
 
139
 
 
140
#define CONC(x, y)              x##y
 
141
#define XCONC(x, y)             CONC(x, y)
 
142
#define XXCONC(x, y)            XCONC(x, y)
 
143
#define MAKESTR(x)              #x
 
144
#define XSTR(x)                 MAKESTR(x)
 
145
 
 
146
 
 
147
/*
 
148
 * Page operations
 
149
 *
 
150
 * It has been suggested that these definitions belong elsewhere
 
151
 * (like x86types.h).  However, I deem them common enough
 
152
 * (since even regular user-level programs may want to do
 
153
 * page-based memory manipulation) to be here.
 
154
 * -- edward
 
155
 */
 
156
 
 
157
#ifndef PAGE_SHIFT // {
 
158
#if defined VM_I386
 
159
   #define PAGE_SHIFT    12
 
160
#elif defined __APPLE__
 
161
   #define PAGE_SHIFT    12
 
162
#else
 
163
   #error
 
164
#endif
 
165
#endif // }
 
166
 
 
167
#ifndef PAGE_SIZE
 
168
#define PAGE_SIZE     (1<<PAGE_SHIFT)
 
169
#endif
 
170
 
 
171
#ifndef PAGE_MASK
 
172
#define PAGE_MASK     (PAGE_SIZE - 1)
 
173
#endif
 
174
 
 
175
#ifndef PAGE_OFFSET
 
176
#define PAGE_OFFSET(_addr)  ((uintptr_t)(_addr)&(PAGE_SIZE-1))
 
177
#endif
 
178
 
 
179
#ifndef VM_PAGE_BASE
 
180
#define VM_PAGE_BASE(_addr)  ((_addr)&~(PAGE_SIZE-1))
 
181
#endif
 
182
 
 
183
#ifndef VM_PAGES_SPANNED
 
184
#define VM_PAGES_SPANNED(_addr, _size) \
 
185
   ((((_addr) & (PAGE_SIZE - 1)) + (_size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)
 
186
#endif
 
187
 
 
188
#ifndef BYTES_2_PAGES
 
189
#define BYTES_2_PAGES(_nbytes) ((_nbytes) >> PAGE_SHIFT)
 
190
#endif
 
191
 
 
192
#ifndef PAGES_2_BYTES
 
193
#define PAGES_2_BYTES(_npages) (((uint64)(_npages)) << PAGE_SHIFT)
 
194
#endif
 
195
 
 
196
#ifndef MBYTES_2_PAGES
 
197
#define MBYTES_2_PAGES(_nbytes) ((_nbytes) << (20 - PAGE_SHIFT))
 
198
#endif
 
199
 
 
200
#ifndef PAGES_2_MBYTES
 
201
#define PAGES_2_MBYTES(_npages) ((_npages) >> (20 - PAGE_SHIFT))
 
202
#endif
 
203
 
 
204
#ifndef VM_PAE_LARGE_PAGE_SHIFT
 
205
#define VM_PAE_LARGE_PAGE_SHIFT 21
 
206
#endif 
 
207
 
 
208
#ifndef VM_PAE_LARGE_PAGE_SIZE
 
209
#define VM_PAE_LARGE_PAGE_SIZE (1 << VM_PAE_LARGE_PAGE_SHIFT)
 
210
#endif
 
211
 
 
212
#ifndef VM_PAE_LARGE_PAGE_MASK
 
213
#define VM_PAE_LARGE_PAGE_MASK (VM_PAE_LARGE_PAGE_SIZE - 1)
 
214
#endif
 
215
 
 
216
#ifndef VM_PAE_LARGE_2_SMALL_PAGES
 
217
#define VM_PAE_LARGE_2_SMALL_PAGES (BYTES_2_PAGES(VM_PAE_LARGE_PAGE_SIZE))
 
218
#endif
 
219
 
 
220
/*
 
221
 * Word operations
 
222
 */
 
223
 
 
224
#ifndef LOWORD
 
225
#define LOWORD(_dw)   ((_dw) & 0xffff)
 
226
#endif
 
227
#ifndef HIWORD
 
228
#define HIWORD(_dw)   (((_dw) >> 16) & 0xffff)
 
229
#endif
 
230
 
 
231
#ifndef LOBYTE
 
232
#define LOBYTE(_w)    ((_w) & 0xff)
 
233
#endif
 
234
#ifndef HIBYTE
 
235
#define HIBYTE(_w)    (((_w) >> 8) & 0xff)
 
236
#endif
 
237
 
 
238
#define HIDWORD(_qw)   ((uint32)((_qw) >> 32))
 
239
#define LODWORD(_qw)   ((uint32)(_qw))
 
240
#define QWORD(_hi, _lo)   ((((uint64)(_hi)) << 32) | ((uint32)(_lo)))
 
241
 
 
242
 
 
243
/*
 
244
 * Deposit a field _src at _pos bits from the right,
 
245
 * with a length of _len, into the integer _target.
 
246
 */
 
247
 
 
248
#define DEPOSIT_BITS(_src,_pos,_len,_target) { \
 
249
        unsigned mask = ((1 << _len) - 1); \
 
250
        unsigned shiftedmask = ((1 << _len) - 1) << _pos; \
 
251
        _target = (_target & ~shiftedmask) | ((_src & mask) << _pos); \
 
252
}
 
253
 
 
254
 
 
255
/*
 
256
 * Get return address.
 
257
 */
 
258
 
 
259
#ifdef _MSC_VER
 
260
#ifdef __cplusplus
 
261
extern "C"
 
262
#endif 
 
263
void *_ReturnAddress(void);
 
264
#pragma intrinsic(_ReturnAddress)
 
265
#define GetReturnAddress() _ReturnAddress()
 
266
#elif __GNUC__
 
267
#define GetReturnAddress() __builtin_return_address(0)
 
268
#endif
 
269
 
 
270
 
 
271
#ifdef __GNUC__
 
272
#ifndef sun
 
273
 
 
274
/*
 
275
 * Get the frame pointer. We use this assembly hack instead of
 
276
 * __builtin_frame_address() due to a bug introduced in gcc 4.1.1
 
277
 */
 
278
static INLINE_SINGLE_CALLER uintptr_t
 
279
GetFrameAddr(void)
 
280
{
 
281
   uintptr_t bp;
 
282
#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0))
 
283
   bp = (uintptr_t)__builtin_frame_address(0);
 
284
#elif (__GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 3)
 
285
#  if defined(VMM64) || defined(VM_X86_64)
 
286
     __asm__ __volatile__("movq %%rbp, %0\n" : "=g" (bp));
 
287
#  else
 
288
     __asm__ __volatile__("movl %%ebp, %0\n" : "=g" (bp));
 
289
#  endif
 
290
#else
 
291
   __asm__ __volatile__(
 
292
#ifdef __linux__
 
293
      ".print \"This newer version of GCC may or may not have the "
 
294
               "__builtin_frame_address bug.  Need to update this. "
 
295
               "See bug 147638.\"\n"
 
296
      ".abort"
 
297
#else /* MacOS */
 
298
      ".abort \"This newer version of GCC may or may not have the "
 
299
               "__builtin_frame_address bug.  Need to update this. "
 
300
               "See bug 147638.\"\n"
 
301
#endif
 
302
      : "=g" (bp)
 
303
   );
 
304
#endif
 
305
   return bp;
 
306
}
 
307
 
 
308
 
 
309
/*
 
310
 * Returns the frame pointer of the calling function.
 
311
 * Equivalent to __builtin_frame_address(1).
 
312
 */
 
313
static INLINE_SINGLE_CALLER uintptr_t
 
314
GetCallerFrameAddr(void)
 
315
{
 
316
   return *(uintptr_t*)GetFrameAddr();
 
317
}
 
318
 
 
319
#endif // sun
 
320
#endif // __GNUC__
 
321
 
 
322
/*
 
323
 * Data prefetch was added in gcc 3.1.1
 
324
 * http://www.gnu.org/software/gcc/gcc-3.1/changes.html
 
325
 */
 
326
#ifdef __GNUC__
 
327
#  if ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 1) || \
 
328
       (__GNUC__ == 3 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 1))
 
329
#     define PREFETCH_R(var) __builtin_prefetch((var), 0 /* read */, \
 
330
                                                3 /* high temporal locality */)
 
331
#     define PREFETCH_W(var) __builtin_prefetch((var), 1 /* write */, \
 
332
                                                3 /* high temporal locality */)
 
333
#  else
 
334
#     define PREFETCH_R(var) ((void)(var))
 
335
#     define PREFETCH_W(var) ((void)(var))
 
336
#  endif
 
337
#endif /* __GNUC__ */
 
338
 
 
339
 
 
340
#ifdef USERLEVEL // {
 
341
 
 
342
/*
 
343
 * Note this might be a problem on NT b/c while sched_yield guarantees it
 
344
 * moves you to the end of your priority list, Sleep(0) offers no such
 
345
 * guarantee.  Bummer.  --Jeremy.
 
346
 */
 
347
 
 
348
#if defined(N_PLAT_NLM)
 
349
/* We do not have YIELD() as we do not need it yet... */
 
350
#elif defined(_WIN32)
 
351
#      define YIELD()           Sleep(0)
 
352
#else
 
353
#      include <sched.h>        // For sched_yield.  Don't ask.  --Jeremy.
 
354
#      define YIELD()           sched_yield()
 
355
#endif 
 
356
 
 
357
 
 
358
/*
 
359
 * Standardize some Posix names on Windows.
 
360
 */
 
361
 
 
362
#ifdef _WIN32 // {
 
363
 
 
364
#define snprintf  _snprintf
 
365
#define vsnprintf _vsnprintf
 
366
#define strtok_r  strtok_s
 
367
 
 
368
typedef int uid_t;
 
369
typedef int gid_t;
 
370
 
 
371
static INLINE void
 
372
sleep(unsigned int sec)
 
373
{
 
374
   Sleep(sec * 1000);
 
375
}
 
376
 
 
377
static INLINE void
 
378
usleep(unsigned long usec)
 
379
{
 
380
   Sleep(CEILING(usec, 1000));
 
381
}
 
382
 
 
383
typedef int pid_t;
 
384
#define       F_OK          0
 
385
#define       X_OK          1
 
386
#define       W_OK          2
 
387
#define       R_OK          4
 
388
 
 
389
#endif // }
 
390
 
 
391
/*
 
392
 * Macro for username comparison.
 
393
 */
 
394
 
 
395
#ifdef _WIN32 // {
 
396
#define USERCMP(x,y)  Str_Strcasecmp(x,y)
 
397
#else
 
398
#define USERCMP(x,y)  strcmp(x,y)
 
399
#endif // }
 
400
 
 
401
 
 
402
#endif // }
 
403
 
 
404
#ifndef va_copy
 
405
 
 
406
#ifdef _WIN32
 
407
 
 
408
/*
 
409
 * Windows needs va_copy. This works for both 32 and 64-bit Windows
 
410
 * based on inspection of how varags.h from the Visual C CRTL is
 
411
 * implemented. (Future versions of the RTL may break this).
 
412
 */
 
413
 
 
414
#define va_copy(dest, src) ((dest) = (src))
 
415
 
 
416
#elif defined(__APPLE__) && defined(KERNEL)
 
417
 
 
418
/*
 
419
 * MacOS kernel-mode needs va_copy. Based on inspection of stdarg.h
 
420
 * from the MacOSX10.4u.sdk kernel framework, this should work.
 
421
 * (Future versions of the SDK may break this).
 
422
 */
 
423
 
 
424
#define va_copy(dest, src) ((dest) = (src))
 
425
 
 
426
#elif defined(__GNUC__) && (__GNUC__ < 3)
 
427
 
 
428
/*
 
429
 * Old versions of gcc recognize __va_copy, but not va_copy.
 
430
 */
 
431
 
 
432
#define va_copy(dest, src) __va_copy(dest, src)
 
433
 
 
434
#endif // _WIN32
 
435
 
 
436
#endif // va_copy
 
437
 
 
438
/*
 
439
 * This one is outside USERLEVEL because it's used by
 
440
 * files compiled into the Windows hgfs driver or the display
 
441
 * driver.
 
442
 */
 
443
 
 
444
#ifdef _WIN32
 
445
#define PATH_MAX 256
 
446
#ifndef strcasecmp
 
447
#define strcasecmp(_s1,_s2)   _stricmp((_s1),(_s2))
 
448
#endif
 
449
#ifndef strncasecmp
 
450
#define strncasecmp(_s1,_s2,_n)   _strnicmp((_s1),(_s2),(_n))
 
451
#endif
 
452
#endif
 
453
 
 
454
/* 
 
455
 * Convenience macro for COMMUNITY_SOURCE
 
456
 */
 
457
#undef EXCLUDE_COMMUNITY_SOURCE
 
458
#ifdef COMMUNITY_SOURCE
 
459
   #define EXCLUDE_COMMUNITY_SOURCE(x) 
 
460
#else
 
461
   #define EXCLUDE_COMMUNITY_SOURCE(x) x
 
462
#endif
 
463
 
 
464
#undef COMMUNITY_SOURCE_INTEL_SECRET
 
465
#if !defined(COMMUNITY_SOURCE) || defined(INTEL_SOURCE)
 
466
/*
 
467
 * It's ok to include INTEL_SECRET source code for non-commsrc,
 
468
 * or for drops directed at Intel.
 
469
 */
 
470
   #define COMMUNITY_SOURCE_INTEL_SECRET
 
471
#endif
 
472
 
 
473
/*
 
474
 * Convenience macros and definitions. Can often be used instead of #ifdef.
 
475
 */
 
476
 
 
477
#undef DEBUG_ONLY
 
478
#undef SL_DEBUG_ONLY
 
479
#undef VMX86_SL_DEBUG
 
480
#ifdef VMX86_DEBUG
 
481
#define vmx86_debug      1
 
482
#define DEBUG_ONLY(x)    x
 
483
/*
 
484
 * Be very, very, very careful with SL_DEBUG. Pls ask ganesh or min before 
 
485
 * using it.
 
486
 */
 
487
#define VMX86_SL_DEBUG
 
488
#define vmx86_sl_debug   1
 
489
#define SL_DEBUG_ONLY(x) x
 
490
#else
 
491
#define vmx86_debug      0
 
492
#define DEBUG_ONLY(x)
 
493
#define vmx86_sl_debug   0
 
494
#define SL_DEBUG_ONLY(x)
 
495
#endif
 
496
 
 
497
#ifdef VMX86_STATS
 
498
#define vmx86_stats   1
 
499
#define STATS_ONLY(x) x
 
500
#else
 
501
#define vmx86_stats   0
 
502
#define STATS_ONLY(x)
 
503
#endif
 
504
 
 
505
#ifdef VMX86_DEVEL
 
506
#define vmx86_devel   1
 
507
#define DEVEL_ONLY(x) x
 
508
#else
 
509
#define vmx86_devel   0
 
510
#define DEVEL_ONLY(x)
 
511
#endif
 
512
 
 
513
#ifdef VMX86_LOG
 
514
#define vmx86_log     1
 
515
#define LOG_ONLY(x)   x
 
516
#else
 
517
#define vmx86_log     0
 
518
#define LOG_ONLY(x)
 
519
#endif
 
520
 
 
521
#ifdef VMX86_VMM_SERIAL_LOGGING
 
522
#define vmx86_vmm_serial_log     1
 
523
#define VMM_SERIAL_LOG_ONLY(x)   x
 
524
#else
 
525
#define vmx86_vmm_serial_log     0
 
526
#define VMM_SERIAL_LOG_ONLY(x)
 
527
#endif
 
528
 
 
529
#ifdef VMX86_SERVER
 
530
#define vmx86_server 1
 
531
#define SERVER_ONLY(x) x
 
532
#define HOSTED_ONLY(x)
 
533
#else
 
534
#define vmx86_server 0
 
535
#define SERVER_ONLY(x)
 
536
#define HOSTED_ONLY(x) x
 
537
#endif
 
538
 
 
539
#ifdef VMX86_WGS
 
540
#define vmx86_wgs 1
 
541
#define WGS_ONLY(x) x
 
542
#else
 
543
#define vmx86_wgs 0
 
544
#define WGS_ONLY(x) 
 
545
#endif
 
546
 
 
547
#ifdef VMKERNEL
 
548
#define vmkernel 1
 
549
#define VMKERNEL_ONLY(x) x
 
550
#else
 
551
#define vmkernel 0
 
552
#define VMKERNEL_ONLY(x)
 
553
#endif
 
554
 
 
555
#ifdef _WIN32
 
556
#define WIN32_ONLY(x) x
 
557
#define POSIX_ONLY(x)
 
558
#else
 
559
#define WIN32_ONLY(x)
 
560
#define POSIX_ONLY(x) x
 
561
#endif
 
562
 
 
563
#ifdef VMM
 
564
#define VMM_ONLY(x) x
 
565
#define USER_ONLY(x)
 
566
#else
 
567
#define VMM_ONLY(x)
 
568
#define USER_ONLY(x) x
 
569
#endif
 
570
 
 
571
/* VMVISOR ifdef only allowed in the vmkernel */
 
572
#ifdef VMKERNEL
 
573
#ifdef VMVISOR
 
574
#define vmvisor 1
 
575
#define VMVISOR_ONLY(x) x
 
576
#else
 
577
#define vmvisor 0
 
578
#define VMVISOR_ONLY(x)
 
579
#endif
 
580
#endif
 
581
 
 
582
#ifdef _WIN32
 
583
#define VMW_INVALID_HANDLE INVALID_HANDLE_VALUE
 
584
#else
 
585
#define VMW_INVALID_HANDLE (-1)
 
586
#endif
 
587
 
 
588
#ifdef _WIN32
 
589
#define fsync(fd) _commit(fd)
 
590
#define fileno(f) _fileno(f)
 
591
#else
 
592
#endif
 
593
 
 
594
/*
 
595
 * Debug output macros for Windows drivers (the Eng variant is for
 
596
 * display/printer drivers only.
 
597
 */
 
598
#ifdef _WIN32
 
599
#ifndef USES_OLD_WINDDK
 
600
#if defined(VMX86_DEBUG) || defined(ASSERT_ALWAYS_AVAILABLE)
 
601
#define WinDrvPrint(arg, ...) DbgPrint(arg, __VA_ARGS__)
 
602
#define WinDrvEngPrint(arg, ...) EngDbgPrint(arg, __VA_ARGS__)
 
603
#else
 
604
#define WinDrvPrint(arg, ...)
 
605
#define WinDrvEngPrint(arg, ...)
 
606
#endif
 
607
#endif
 
608
#endif // _WIN32
 
609
 
 
610
#endif // ifndef _VM_BASIC_DEFS_H_