win-pvdrivers

view common/include/xen_windows.h @ 62:edd4a2ad5b44

Removed old inf files
author James Harper <james.harper@bendigoit.com.au>
date Wed Dec 19 10:22:50 2007 +1100 (2007-12-19)
parents a54ad4e0e083
children 06b4321b7068
line source
1 #if !defined(_XEN_WINDOWS_H_)
2 #define _XEN_WINDOWS_H_
4 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
5 #pragma warning( disable : 4214 ) // nonstandard extension used : bit field types other than int
7 #define __XEN_INTERFACE_VERSION__ 0x00030205
8 #define __i386__
9 typedef INT8 int8_t;
10 typedef UINT8 uint8_t;
11 typedef INT16 int16_t;
12 typedef UINT16 uint16_t;
13 typedef INT32 int32_t;
14 typedef UINT32 uint32_t;
15 typedef UINT64 uint64_t;
16 typedef unsigned long pgentry_t;
18 #include <xen.h>
20 #define _PAGE_PRESENT 0x001UL
21 #define _PAGE_RW 0x002UL
22 #define _PAGE_USER 0x004UL
23 #define _PAGE_PWT 0x008UL
24 #define _PAGE_PCD 0x010UL
25 #define _PAGE_ACCESSED 0x020UL
26 #define _PAGE_DIRTY 0x040UL
27 #define _PAGE_PAT 0x080UL
28 #define _PAGE_PSE 0x080UL
29 #define _PAGE_GLOBAL 0x100UL
31 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
33 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
35 typedef unsigned long xenbus_transaction_t;
36 typedef uint32_t XENSTORE_RING_IDX;
38 #define XBT_NIL ((xenbus_transaction_t)0)
40 #define SPLITSTRING_POOL_TAG (ULONG) 'SSPT'
42 static char **
43 SplitString(char *String, char Split, int MaxParts, int *Count)
44 {
45 char **RetVal;
46 char *first;
47 char *last;
49 //KdPrint((__DRIVER_NAME " a\n"));
51 *Count = 0;
53 RetVal = ExAllocatePoolWithTag(NonPagedPool, (MaxParts + 1) * sizeof(char *), SPLITSTRING_POOL_TAG);
54 last = String;
55 do
56 {
57 if (*Count == MaxParts)
58 break;
59 //KdPrint((__DRIVER_NAME " b - count = %d\n", *Count));
60 first = last;
61 for (last = first; *last != '\0' && *last != Split; last++);
62 RetVal[*Count] = ExAllocatePoolWithTag(NonPagedPool, last - first + 1, SPLITSTRING_POOL_TAG);
63 //KdPrint((__DRIVER_NAME " c - count = %d\n", *Count));
64 strncpy(RetVal[*Count], first, last - first);
65 RetVal[*Count][last - first] = 0;
66 //KdPrint((__DRIVER_NAME " d - count = %d\n", *Count));
67 (*Count)++;
68 //KdPrint((__DRIVER_NAME " e - count = %d\n", *Count));
69 if (*last == Split)
70 last++;
71 } while (*last != 0);
72 //KdPrint((__DRIVER_NAME " f - count = %d\n", *Count));
73 RetVal[*Count] = NULL;
74 return RetVal;
75 }
77 static VOID
78 FreeSplitString(char **Bits, int Count)
79 {
80 int i;
82 for (i = 0; i < Count; i++)
83 ExFreePoolWithTag(Bits[i], SPLITSTRING_POOL_TAG);
84 ExFreePoolWithTag(Bits, SPLITSTRING_POOL_TAG);
85 }
87 #endif