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.

619 lines
8.7 KiB

  1. // Tables for DS: 32-bit instructions
  2. // (ie. no FS:, but DATA: specified)
  3. /*++
  4. Copyright (c) 1995 Microsoft Corporation
  5. Module Name:
  6. ds16tbl.c
  7. Abstract:
  8. Dispatch tables for instructions with DATA: override. It is used for
  9. both DS: and FS: overrides.
  10. Author:
  11. 29-Jun-1995 BarryBo
  12. Revision History:
  13. --*/
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #include <windows.h>
  18. #include <stdio.h>
  19. #include "threadst.h"
  20. #include "instr.h"
  21. #include "decoderp.h"
  22. #include "bytefns.h"
  23. #include "wordfns.h"
  24. #include "miscfns.h"
  25. #include "floatfns.h"
  26. pfnDispatchInstruction Dispatch16[256] = {
  27. // 0
  28. add_m_r8,
  29. add_m_r16,
  30. add_r_m8,
  31. add_r_m16,
  32. add_a_i8,
  33. add_a_i16,
  34. push_es,
  35. pop_es,
  36. // 8
  37. or_m_r8,
  38. or_m_r16,
  39. or_r_m8,
  40. or_r_m16,
  41. or_a_i8,
  42. or_a_i16,
  43. push_cs,
  44. dispatch216,
  45. // 10
  46. adc_m_r8,
  47. adc_m_r16,
  48. adc_r_m8,
  49. adc_r_m16,
  50. adc_a_i8,
  51. adc_a_i16,
  52. push_ss,
  53. pop_ss,
  54. // 18
  55. sbb_m_r8,
  56. sbb_m_r16,
  57. sbb_r_m8,
  58. sbb_r_m16,
  59. sbb_a_i8,
  60. sbb_a_i16,
  61. push_ds,
  62. pop_ds,
  63. // 20
  64. and_m_r8,
  65. and_m_r16,
  66. and_r_m8,
  67. and_r_m16,
  68. and_a_i8,
  69. and_a_i16,
  70. ProcessPrefixes, // es:
  71. daa,
  72. // 28
  73. sub_m_r8,
  74. sub_m_r16,
  75. sub_r_m8,
  76. sub_r_m16,
  77. sub_a_i8,
  78. sub_a_i16,
  79. ProcessPrefixes, // cs:
  80. das,
  81. // 30
  82. xor_m_r8,
  83. xor_m_r16,
  84. xor_r_m8,
  85. xor_r_m16,
  86. xor_a_i8,
  87. xor_a_i16,
  88. ProcessPrefixes, // ss:
  89. aaa,
  90. // 38
  91. cmp_m_r8,
  92. cmp_m_r16,
  93. cmp_r_m8,
  94. cmp_r_m16,
  95. cmp_a_i8,
  96. cmp_a_i16,
  97. ProcessPrefixes, // ds:
  98. aas,
  99. // 40
  100. inc_ax16,
  101. inc_cx16,
  102. inc_dx16,
  103. inc_bx16,
  104. inc_sp16,
  105. inc_bp16,
  106. inc_si16,
  107. inc_di16,
  108. // 48
  109. dec_ax16,
  110. dec_cx16,
  111. dec_dx16,
  112. dec_bx16,
  113. dec_sp16,
  114. dec_bp16,
  115. dec_si16,
  116. dec_di16,
  117. // 50
  118. push_ax16,
  119. push_cx16,
  120. push_dx16,
  121. push_bx16,
  122. push_sp16,
  123. push_bp16,
  124. push_si16,
  125. push_di16,
  126. // 58
  127. pop_ax16,
  128. pop_cx16,
  129. pop_dx16,
  130. pop_bx16,
  131. pop_sp16,
  132. pop_bp16,
  133. pop_si16,
  134. pop_di16,
  135. // 60
  136. pusha16,
  137. popa16,
  138. bound16,
  139. privileged, // arpl
  140. ProcessPrefixes, // fs:
  141. ProcessPrefixes, // gs:
  142. ProcessPrefixes, // data: prefix
  143. ProcessPrefixes, // adr: prefix
  144. // 68
  145. push_iw16,
  146. imul_rw_m_iw16,
  147. push_ibs16,
  148. imul_rw_m_ib16,
  149. privileged, // in_ib_dx
  150. privileged, // in_iw_dx
  151. privileged, // out_ib_dx
  152. privileged, // out_iw_dx
  153. // 70
  154. jo8,
  155. jno8,
  156. jb8,
  157. jae8,
  158. je8,
  159. jne8,
  160. jbe8,
  161. ja8,
  162. // 78
  163. js8,
  164. jns8,
  165. jp8,
  166. jnp8,
  167. jl8,
  168. jnl8,
  169. jle8,
  170. jg8,
  171. // 80
  172. GROUP_18,
  173. GROUP_116,
  174. bad,
  175. GROUP_1WS16,
  176. test_r_m8,
  177. test_r_m16,
  178. xchg_r_m8,
  179. xchg_r_m16,
  180. // 88
  181. mov_m_r8,
  182. mov_m_r16,
  183. mov_r_m8,
  184. mov_r_m16,
  185. mov_mw_seg,
  186. lea_rw_mw16,
  187. mov_seg_mw,
  188. pop_mw16,
  189. // 90
  190. nop,
  191. xchg_ax_cx16,
  192. xchg_ax_dx16,
  193. xchg_ax_bx16,
  194. xchg_ax_sp16,
  195. xchg_ax_bp16,
  196. xchg_ax_si16,
  197. xchg_ax_di16,
  198. // 98
  199. cbw16,
  200. cwd16,
  201. call_md,
  202. wait,
  203. pushf16,
  204. popf16,
  205. sahf,
  206. lahf,
  207. // a0
  208. mov_a_m8,
  209. mov_a_m16,
  210. mov_m_a8,
  211. mov_m_a16,
  212. movs8,
  213. movs16,
  214. cmps8,
  215. cmps16,
  216. // a8
  217. test_a_i8,
  218. test_a_i16,
  219. stos8,
  220. stos16,
  221. lods8,
  222. lods16,
  223. scas8,
  224. scas16,
  225. // b0
  226. mov_a_i8,
  227. mov_c_i8,
  228. mov_d_i8,
  229. mov_b_i8,
  230. mov_ah_ib,
  231. mov_ch_ib,
  232. mov_dh_ib,
  233. mov_bh_ib,
  234. // b8
  235. mov_a_i16,
  236. mov_c_i16,
  237. mov_d_i16,
  238. mov_b_i16,
  239. mov_sp_iw16,
  240. mov_bp_iw16,
  241. mov_si_iw16,
  242. mov_di_iw16,
  243. // c0
  244. GROUP_28,
  245. GROUP_216,
  246. retn_i16,
  247. retn16,
  248. les_rw_mw16,
  249. lds_rw_mw16,
  250. mov_m_i8,
  251. mov_m_i16,
  252. // c8
  253. enter16,
  254. leave16,
  255. retf_i16,
  256. retf16,
  257. int3,
  258. int_ib,
  259. into,
  260. iret,
  261. // d0
  262. GROUP_2_18,
  263. GROUP_2_116,
  264. GROUP_2_CL8,
  265. GROUP_2_CL16,
  266. aam_ib,
  267. aad_ib,
  268. bad,
  269. xlat,
  270. // d8
  271. FLOAT_GP0,
  272. FLOAT_GP1,
  273. FLOAT_GP2,
  274. FLOAT_GP3,
  275. FLOAT_GP4,
  276. FLOAT_GP5,
  277. FLOAT_GP6,
  278. FLOAT_GP7,
  279. // e0
  280. loopne_b16,
  281. loope_b16,
  282. loop_b16,
  283. jcxz_b16,
  284. privileged, // in_al_memb
  285. privileged, // in_ax_memb
  286. privileged, // out_memb_al
  287. privileged, // out_memb_ax
  288. // e8
  289. call_rel16,
  290. jmp_rel16,
  291. jmpf_md,
  292. jmp_jb,
  293. privileged, // in_al_dx
  294. privileged, // in_ax_dx
  295. privileged, // out_dx_al
  296. privileged, // out_dx_ax
  297. // f0
  298. ProcessPrefixes, // lock: prefix
  299. bad,
  300. ProcessPrefixes, // repnz prefix
  301. ProcessPrefixes, // repz prefix
  302. privileged, // halt
  303. cmc,
  304. GROUP_38,
  305. GROUP_316,
  306. // f8
  307. clc,
  308. stc,
  309. privileged, // cli
  310. privileged, // sti
  311. cld,
  312. std,
  313. GROUP_4,
  314. GROUP_516
  315. };
  316. pfnDispatchInstruction Dispatch216[256] = {
  317. // 0
  318. GROUP_6,
  319. GROUP_7,
  320. lar16,
  321. lsl16,
  322. bad,
  323. bad,
  324. privileged, // clts
  325. bad,
  326. // 8
  327. bad,
  328. bad,
  329. bad,
  330. bad,
  331. bad,
  332. bad,
  333. bad,
  334. bad,
  335. // 10
  336. bad,
  337. bad,
  338. bad,
  339. bad,
  340. bad,
  341. bad,
  342. bad,
  343. bad,
  344. // 18
  345. bad,
  346. bad,
  347. bad,
  348. bad,
  349. bad,
  350. bad,
  351. bad,
  352. bad,
  353. // 20
  354. privileged, // mov reg2W, eeeControl
  355. privileged, // mov reg2W, eeeDebug
  356. privileged, // mov eeeControl, reg2W
  357. privileged, // mov eeeDebug, reg2W
  358. privileged, // mov reg2W, eeeTest
  359. bad,
  360. privileged, // mov eeeTest, reg2W
  361. bad,
  362. // 28
  363. bad,
  364. bad,
  365. bad,
  366. bad,
  367. bad,
  368. bad,
  369. bad,
  370. bad,
  371. // 30
  372. bad,
  373. rdtsc,
  374. bad,
  375. bad,
  376. bad,
  377. bad,
  378. bad,
  379. bad,
  380. // 38
  381. bad,
  382. bad,
  383. bad,
  384. bad,
  385. bad,
  386. bad,
  387. bad,
  388. bad,
  389. // 40
  390. bad,
  391. bad,
  392. bad,
  393. bad,
  394. bad,
  395. bad,
  396. bad,
  397. bad,
  398. // 48
  399. bad,
  400. bad,
  401. bad,
  402. bad,
  403. bad,
  404. bad,
  405. bad,
  406. bad,
  407. // 50
  408. bad,
  409. bad,
  410. bad,
  411. bad,
  412. bad,
  413. bad,
  414. bad,
  415. bad,
  416. // 58
  417. bad,
  418. bad,
  419. bad,
  420. bad,
  421. bad,
  422. bad,
  423. bad,
  424. bad,
  425. // 60
  426. bad,
  427. bad,
  428. bad,
  429. bad,
  430. bad,
  431. bad,
  432. bad,
  433. bad,
  434. // 68
  435. bad,
  436. bad,
  437. bad,
  438. bad,
  439. bad,
  440. bad,
  441. bad,
  442. bad,
  443. // 70
  444. bad,
  445. bad,
  446. bad,
  447. bad,
  448. bad,
  449. bad,
  450. bad,
  451. bad,
  452. // 78
  453. bad,
  454. bad,
  455. bad,
  456. bad,
  457. bad,
  458. bad,
  459. bad,
  460. bad,
  461. // 80
  462. jo16,
  463. jno16,
  464. jb16,
  465. jae16,
  466. je16,
  467. jne16,
  468. jbe16,
  469. ja16,
  470. // 88
  471. js16,
  472. jns16,
  473. jp16,
  474. jnp16,
  475. jl16,
  476. jnl16,
  477. jle16,
  478. jg16,
  479. // 90
  480. seto_modrmb,
  481. setno_modrmb,
  482. setb_modrmb,
  483. setae_modrmb,
  484. sete_modrmb,
  485. setne_modrmb,
  486. setbe_modrmb,
  487. seta_modrmb,
  488. // 98
  489. sets_modrmb,
  490. setns_modrmb,
  491. setp_modrmb,
  492. setnp_modrmb,
  493. setl_modrmb,
  494. setge_modrmb,
  495. setle_modrmb,
  496. setg_modrmb,
  497. // a0
  498. push_fs,
  499. pop_fs,
  500. bad,
  501. bt_m_r16,
  502. shld_regw_modrmw_immb16,
  503. shld_regw_modrmw_cl16,
  504. bad,
  505. bad,
  506. // a8
  507. push_gs,
  508. pop_gs,
  509. bad,
  510. bts_m_r16,
  511. shrd_regw_modrmw_immb16,
  512. shrd_regw_modrmw_cl16,
  513. bad,
  514. imul_regw_modrmw16,
  515. // b0
  516. cmpxchg_m_r8,
  517. cmpxchg_m_r16,
  518. lss_rw_mw16,
  519. btr_m_r16,
  520. lfs_rw_mw16,
  521. lgs_rw_mw16,
  522. movzx_regw_modrmb16,
  523. movzx_regw_modrmw,
  524. // b8
  525. bad,
  526. bad,
  527. GROUP_816,
  528. btc_m_r16,
  529. bsf_modrmw_regw16,
  530. bsr_modrmw_regw16,
  531. movsx_regw_modrmb16,
  532. movsx_regw_modrmw,
  533. // c0
  534. xadd_m_r8,
  535. xadd_m_r16,
  536. bad,
  537. bad,
  538. bad,
  539. bad,
  540. bad,
  541. bad,
  542. // c8
  543. bswap_eax,
  544. bswap_ecx,
  545. bswap_edx,
  546. bswap_ebx,
  547. bswap_esp,
  548. bswap_ebp,
  549. bswap_esi,
  550. bswap_edi,
  551. // d0
  552. bad,
  553. bad,
  554. bad,
  555. bad,
  556. bad,
  557. bad,
  558. bad,
  559. bad,
  560. // d8
  561. bad,
  562. bad,
  563. bad,
  564. bad,
  565. bad,
  566. bad,
  567. bad,
  568. bad,
  569. // e0
  570. bad,
  571. bad,
  572. bad,
  573. bad,
  574. bad,
  575. bad,
  576. bad,
  577. bad,
  578. // e8
  579. bad,
  580. bad,
  581. bad,
  582. bad,
  583. bad,
  584. bad,
  585. bad,
  586. bad,
  587. // f0
  588. bad,
  589. bad,
  590. bad,
  591. bad,
  592. bad,
  593. bad,
  594. bad,
  595. bad,
  596. // f8
  597. bad,
  598. bad,
  599. bad,
  600. bad,
  601. bad,
  602. bad,
  603. bad,
  604. bad
  605. };