Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
7.5 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. data.c
  5. Abstract:
  6. This file contains all of the data required by the unassembler
  7. Author:
  8. Based on code by Mike Tsang (MikeTs)
  9. Stephane Plante (Splante)
  10. Environment:
  11. User mode only
  12. Revision History:
  13. --*/
  14. #ifndef _DATA_H
  15. #define _DATA_H
  16. //
  17. // Constants
  18. //
  19. // String constants
  20. #define STR_PROGDESC "ACPI Source Language Assembler"
  21. #define STR_COPYRIGHT "Copyright (c) 1996,1997 Microsoft Corporation"
  22. #define STR_MS "MSFT"
  23. // Misc. constants
  24. #define NAMESEG_BLANK 0x5f5f5f5f // "____"
  25. #define NAMESEG_ROOT 0x5f5f5f5c // "\___"
  26. #define NAMESEG ULONG
  27. #define SUPERNAME NAMESEG
  28. #define NSF_LOCAL_SCOPE 0x00000001
  29. // Implementation constants
  30. #define MAX_STRING_LEN 199
  31. #define MAX_NAMECODE_LEN 1300 //approx. 255*4 + 2 + 255
  32. #define MAX_MSG_LEN 127
  33. #define MAX_ARGS 7
  34. #define MAX_PACKAGE_LEN 0x0fffffff
  35. // Term classes
  36. #define UTC_PNP_MACRO 0x00100000
  37. #define UTC_REF_OBJECT 0x00200000
  38. #define UTC_FIELD_MACRO 0x00400000
  39. #define UTC_DATA_OBJECT 0x00800000
  40. #define UTC_NAMED_OBJECT 0x01000000
  41. #define UTC_NAMESPACE_MODIFIER 0x02000000
  42. #define UTC_OPCODE_TYPE1 0x04000000
  43. #define UTC_OPCODE_TYPE2 0x08000000
  44. #define UTC_CONST_NAME 0x10000000
  45. #define UTC_SHORT_NAME 0x20000000
  46. #define UTC_COMPILER_DIRECTIVE 0x40000000
  47. #define UTC_KEYWORD 0x80000000
  48. #define UTC_OPCODE (UTC_OPCODE_TYPE1 | UTC_OPCODE_TYPE2 | \
  49. UTC_SHORT_NAME | UTC_CONST_NAME | \
  50. UTC_DATA_OBJECT)
  51. #define UTC_OPCODE_TERM (UTC_CONST_NAME | UTC_SHORT_NAME | \
  52. UTC_DATA_OBJECT | UTC_NAMED_OBJECT | \
  53. UTC_OPCODE_TYPE1 | UTC_OPCODE_TYPE2 | \
  54. UTC_NAMESPACE_MODIFIER)
  55. // Term flags
  56. #define TF_ACTION_FLIST 0x00000001
  57. #define TF_ACTION_VLIST 0x00000002
  58. #define TF_PACKAGE_LEN 0x00000004
  59. #define TF_CHANGE_CHILDSCOPE 0x00000008
  60. #define TF_DELAY_UNASM 0x00000010
  61. #define TF_FIELD_MACRO UTC_FIELD_MACRO
  62. #define TF_DATA_OBJECT UTC_DATA_OBJECT
  63. #define TF_NAMED_OBJECT UTC_NAMED_OBJECT
  64. #define TF_NAMESPACE_MODIFIER UTC_NAMESPACE_MODIFIER
  65. #define TF_OPCODE_TYPE1 UTC_OPCODE_TYPE1
  66. #define TF_OPCODE_TYPE2 UTC_OPCODE_TYPE2
  67. #define TF_CONST_NAME UTC_CONST_NAME
  68. #define TF_SHORT_NAME UTC_SHORT_NAME
  69. #define TF_COMPILER_DIRECTIVE UTC_COMPILER_DIRECTIVE
  70. #define TF_KEYWORD UTC_KEYWORD
  71. #define TF_PNP_MACRO UTC_PNP_MACRO
  72. #define TF_OBJECT_LIST (UTC_NAMED_OBJECT | UTC_NAMESPACE_MODIFIER)
  73. #define TF_CODE_LIST (UTC_OPCODE_TYPE1 | UTC_OPCODE_TYPE2)
  74. #define TF_DATA_LIST 0x00010000
  75. #define TF_FIELD_LIST 0x00020000
  76. #define TF_BYTE_LIST 0x00040000
  77. #define TF_DWORD_LIST 0x00080000
  78. #define TF_PACKAGE_LIST (UTC_DATA_OBJECT | UTC_SHORT_NAME | \
  79. UTC_CONST_NAME)
  80. #define TF_ALL_LISTS (TF_DATA_OBJECT | TF_NAMED_OBJECT | \
  81. TF_NAMESPACE_MODIFIER | TF_OPCODE_TYPE1 | \
  82. TF_OPCODE_TYPE2 | TF_SHORT_NAME | \
  83. TF_CONST_NAME | TF_COMPILER_DIRECTIVE | \
  84. TF_DATA_LIST | TF_PACKAGE_LIST | \
  85. TF_FIELD_LIST | TF_PNP_MACRO | TF_BYTE_LIST |\
  86. TF_DWORD_LIST)
  87. // Code flags
  88. #define CF_MISSING_ARG 0x00000001
  89. #define CF_PARSING_FIXEDLIST 0x00000002
  90. #define CF_PARSING_VARLIST 0x00000004
  91. // NS flags
  92. #define NSF_EXIST_OK 0x00010000
  93. #define NSF_EXIST_ERR 0x00020000
  94. // Data types
  95. #define CODETYPE_UNKNOWN 0
  96. #define CODETYPE_ASLTERM 1
  97. #define CODETYPE_NAME 2
  98. #define CODETYPE_DATAOBJ 3
  99. #define CODETYPE_FIELDOBJ 4
  100. #define CODETYPE_INTEGER 5
  101. #define CODETYPE_STRING 6
  102. #define CODETYPE_KEYWORD 7
  103. #define CODETYPE_USERTERM 8
  104. #define CODETYPE_QWORD 9
  105. // NameSpace object types
  106. #define NSTYPE_UNKNOWN 'U'
  107. #define NSTYPE_SCOPE 'S'
  108. #define NSTYPE_FIELDUNIT 'F'
  109. #define NSTYPE_DEVICE 'D'
  110. #define NSTYPE_EVENT 'E'
  111. #define NSTYPE_METHOD 'M'
  112. #define NSTYPE_MUTEX 'X'
  113. #define NSTYPE_OPREGION 'O'
  114. #define NSTYPE_POWERRES 'P'
  115. #define NSTYPE_PROCESSOR 'C'
  116. #define NSTYPE_THERMALZONE 'T'
  117. #define NSTYPE_OBJALIAS 'A'
  118. #define NSTYPE_BUFFFIELD 'B'
  119. #define OBJTYPE_PRIVATE 0xf0
  120. #define OBJTYPE_PNP_RES (OBJTYPE_PRIVATE + 0x00)
  121. #define OBJTYPE_RES_FIELD (OBJTYPE_PRIVATE + 0x01)
  122. // Opcode classes
  123. #define OPCLASS_INVALID 0
  124. #define OPCLASS_DATA_OBJ 1
  125. #define OPCLASS_NAME_OBJ 2
  126. #define OPCLASS_CONST_OBJ 3
  127. #define OPCLASS_CODE_OBJ 4
  128. #define OPCLASS_ARG_OBJ 5
  129. #define OPCLASS_LOCAL_OBJ 6
  130. //dwfData flags
  131. #define DATAF_BUFF_ALIAS 0x00000001
  132. #define DATAF_GLOBAL_LOCK 0x00000002
  133. //dwDataType values
  134. #define OBJTYPE_UNKNOWN 0x00
  135. #define OBJTYPE_INTDATA 0x01
  136. #define OBJTYPE_STRDATA 0x02
  137. #define OBJTYPE_BUFFDATA 0x03
  138. #define OBJTYPE_PKGDATA 0x04
  139. #define OBJTYPE_FIELDUNIT 0x05
  140. #define OBJTYPE_DEVICE 0x06
  141. #define OBJTYPE_EVENT 0x07
  142. #define OBJTYPE_METHOD 0x08
  143. #define OBJTYPE_MUTEX 0x09
  144. #define OBJTYPE_OPREGION 0x0a
  145. #define OBJTYPE_POWERRES 0x0b
  146. #define OBJTYPE_PROCESSOR 0x0c
  147. #define OBJTYPE_THERMALZONE 0x0d
  148. #define OBJTYPE_BUFFFIELD 0x0e
  149. #define OBJTYPE_DDBHANDLE 0x0f
  150. //These are internal object types (not to be exported to the ASL code)
  151. #define OBJTYPE_INTERNAL 0x80
  152. //Predefined data values (dwDataValue)
  153. #define DATAVALUE_ZERO 0
  154. #define DATAVALUE_ONE 1
  155. #define DATAVALUE_ONES 0xffffffff
  156. //
  157. // Macros
  158. //
  159. #define MEMALLOC(n) malloc(n)
  160. #define MEMFREE(p) free(p)
  161. //
  162. // Type definitions
  163. //
  164. typedef int (LOCAL *PFNTERM)(PUCHAR, BOOL);
  165. typedef struct _aslterm
  166. {
  167. PUCHAR ID;
  168. ULONG TermClass;
  169. ULONG TermData;
  170. ULONG OpCode;
  171. PUCHAR UnAsmArgTypes;
  172. PUCHAR ArgActions;
  173. ULONG Flags;
  174. } ASLTERM, *PASLTERM;
  175. typedef struct _opmap
  176. {
  177. UCHAR ExtendedOpCode;
  178. UCHAR OpCodeClass;
  179. } OPMAP, *POPMAP;
  180. extern ASLTERM TermTable[];
  181. extern UCHAR OpClassTable[];
  182. extern OPMAP ExOpClassTable[];
  183. #endif //ifndef _DATA_H