Pyrogenesis  trunk
aken.h
Go to the documentation of this file.
1 /* Copyright (c) 2010 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /*
24  * Aken driver interface
25  */
26 
27 // Aken - custodian of the ferryboat to the underworld in Egyptian mythology,
28 // and a driver that shuttles between applications and kernel mode resources.
29 
30 #ifndef INCLUDED_AKEN
31 #define INCLUDED_AKEN
32 
33 #define AKEN_NAME L"Aken"
34 
35 // device type
36 #define FILE_DEVICE_AKEN 53498 // in the "User Defined" range."
37 
38 #define AKEN_IOCTL 0x800 // 0x800..0xFFF are for 'customer' use.
39 
40 #define IOCTL_AKEN_READ_PORT CTL_CODE(FILE_DEVICE_AKEN, AKEN_IOCTL+0, METHOD_BUFFERED, FILE_ANY_ACCESS)
41 #define IOCTL_AKEN_WRITE_PORT CTL_CODE(FILE_DEVICE_AKEN, AKEN_IOCTL+1, METHOD_BUFFERED, FILE_ANY_ACCESS)
42 #define IOCTL_AKEN_MAP CTL_CODE(FILE_DEVICE_AKEN, AKEN_IOCTL+2, METHOD_BUFFERED, FILE_ANY_ACCESS)
43 #define IOCTL_AKEN_UNMAP CTL_CODE(FILE_DEVICE_AKEN, AKEN_IOCTL+3, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 #define IOCTL_AKEN_READ_MSR CTL_CODE(FILE_DEVICE_AKEN, AKEN_IOCTL+4, METHOD_BUFFERED, FILE_ANY_ACCESS)
45 #define IOCTL_AKEN_WRITE_MSR CTL_CODE(FILE_DEVICE_AKEN, AKEN_IOCTL+5, METHOD_BUFFERED, FILE_ANY_ACCESS)
46 #define IOCTL_AKEN_READ_PMC CTL_CODE(FILE_DEVICE_AKEN, AKEN_IOCTL+6, METHOD_BUFFERED, FILE_ANY_ACCESS)
47 
48 
49 // input and output data structures for the IOCTLs
50 
51 #pragma pack(push, 1)
52 
53 typedef struct AkenReadPortIn_
54 {
56  UCHAR numBytes;
57 }
59 
60 typedef struct AkenReadPortOut_
61 {
62  DWORD32 value;
63 }
65 
66 typedef struct AkenWritePortIn_
67 {
68  DWORD32 value;
70  UCHAR numBytes;
71 }
73 
74 typedef struct AkenMapIn_
75 {
76  // note: fixed-width types allow the 32 or 64-bit Mahaf wrapper to
77  // interoperate with the 32 or 64-bit Aken driver.
78  DWORD64 physicalAddress;
79  DWORD64 numBytes;
80 }
81 AkenMapIn;
82 
83 typedef struct AkenMapOut_
84 {
85  DWORD64 virtualAddress;
86 }
88 
89 typedef struct AkenUnmapIn_
90 {
91  DWORD64 virtualAddress;
92 }
94 
95 typedef struct AkenReadRegisterIn_
96 {
97  DWORD64 reg;
98 }
100 
101 typedef struct AkenReadRegisterOut_
102 {
103  DWORD64 value;
104 }
106 
107 typedef struct AkenWriteRegisterIn_
108 {
109  DWORD64 reg;
110  DWORD64 value;
111 }
113 
114 #pragma pack(pop)
115 
116 #endif // #ifndef INCLUDED_AKEN
USHORT port
Definition: aken.h:69
Definition: aken.h:60
DWORD32 value
Definition: aken.h:62
DWORD64 reg
Definition: aken.h:97
DWORD64 reg
Definition: aken.h:109
unsigned short USHORT
Definition: wgl.h:52
struct AkenUnmapIn_ AkenUnmapIn
struct AkenReadRegisterIn_ AkenReadRegisterIn
UCHAR numBytes
Definition: aken.h:56
UCHAR numBytes
Definition: aken.h:70
DWORD64 virtualAddress
Definition: aken.h:85
DWORD64 physicalAddress
Definition: aken.h:78
DWORD32 value
Definition: aken.h:68
struct AkenReadRegisterOut_ AkenReadRegisterOut
Definition: aken.h:53
struct AkenWriteRegisterIn_ AkenWriteRegisterIn
USHORT port
Definition: aken.h:55
DWORD64 value
Definition: aken.h:103
DWORD64 numBytes
Definition: aken.h:79
Definition: aken.h:95
struct AkenReadPortIn_ AkenReadPortIn
Definition: aken.h:74
struct AkenMapOut_ AkenMapOut
DWORD64 virtualAddress
Definition: aken.h:91
struct AkenWritePortIn_ AkenWritePortIn
struct AkenMapIn_ AkenMapIn
Definition: aken.h:66
DWORD64 value
Definition: aken.h:110
struct AkenReadPortOut_ AkenReadPortOut
Definition: aken.h:101
Definition: aken.h:83
Definition: aken.h:107
Definition: aken.h:89