Advertisement
dominus

Untitled

Oct 3rd, 2020
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.72 KB | None | 0 0
  1. MMAPS: 0x11b57c000 0xffffffffffffffff
  2. createcacheblock1
  3. createcacheblock2
  4. createcacheblock3
  5. createcacheblock4
  6. createcacheblock4a
  7. createcacheblock4b
  8. createcacheblock6
  9. createcacheblock4
  10. createcacheblock4a
  11. createcacheblock4b
  12. createcacheblock6
  13. zsh: segmentation fault ./src/dosbox
  14.  
  15.  
  16. static CacheBlockDynRec * CreateCacheBlock(CodePageHandlerDynRec * codepage,PhysPt start,Bitu max_opcodes) {
  17. LOG_MSG("createcacheblock1");
  18. // initialize a load of variables
  19. decode.code_start=start;
  20. decode.code=start;
  21. decode.page.code=codepage;
  22. decode.page.index=start&4095;
  23. decode.page.wmap=codepage->write_map;
  24. decode.page.invmap=codepage->invalidation_map;
  25. decode.page.first=start >> 12;
  26. decode.active_block=decode.block=cache_openblock();
  27. decode.block->page.start=(Bit16u)decode.page.index;
  28. codepage->AddCacheBlock(decode.block);
  29. LOG_MSG("createcacheblock2");
  30. InitFlagsOptimization();
  31.  
  32. // every codeblock that is run sets cache.block.running to itself
  33. // so the block linking knows the last executed block
  34. gen_mov_direct_ptr(&cache.block.running,(DRC_PTR_SIZE_IM)decode.block);
  35.  
  36. // start with the cycles check
  37. gen_mov_word_to_reg(FC_RETOP,&CPU_Cycles,true);
  38. save_info_dynrec[used_save_info_dynrec].branch_pos=gen_create_branch_long_leqzero(FC_RETOP);
  39. save_info_dynrec[used_save_info_dynrec].type=cycle_check;
  40. used_save_info_dynrec++;
  41. LOG_MSG("createcacheblock3");
  42. decode.cycles=0;
  43. while (max_opcodes--) {
  44. // Init prefixes
  45. decode.big_addr=cpu.code.big;
  46. decode.big_op=cpu.code.big;
  47. decode.seg_prefix=0;
  48. decode.seg_prefix_used=false;
  49. decode.rep=REP_NONE;
  50. decode.cycles++;
  51. decode.op_start=decode.code;
  52. restart_prefix:
  53. Bitu opcode;
  54. LOG_MSG("createcacheblock4");
  55. if (!decode.page.invmap){
  56. LOG_MSG("createcacheblock4a");
  57. opcode=decode_fetchb();
  58. LOG_MSG("createcacheblock4b");}
  59. else {
  60. // some entries in the invalidation map, see if the next
  61. // instruction is known to be modified a lot
  62. LOG_MSG("createcacheblock5");
  63. if (decode.page.index<4096) {
  64. if (GCC_UNLIKELY(decode.page.invmap[decode.page.index]>=4)) goto illegalopcode;
  65. opcode=decode_fetchb();
  66. } else {
  67. // switch to the next page
  68. opcode=decode_fetchb();
  69. if (GCC_UNLIKELY(decode.page.invmap &&
  70. (decode.page.invmap[decode.page.index-1]>=4))) goto illegalopcode;
  71. }
  72. }
  73. LOG_MSG("createcacheblock6");
  74. switch (opcode) {
  75. LOG_MSG("createcacheblock7");
  76. // instructions 'op reg8,reg8' and 'op [],reg8'
  77. case 0x00:dyn_dop_ebgb(DOP_ADD);break;
  78. case 0x08:dyn_dop_ebgb(DOP_OR);break;
  79. case 0x10:dyn_dop_ebgb(DOP_ADC);break;
  80. case 0x18:dyn_dop_ebgb(DOP_SBB);break;
  81. case 0x20:dyn_dop_ebgb(DOP_AND);break;
  82. case 0x28:dyn_dop_ebgb(DOP_SUB);break;
  83. case 0x30:dyn_dop_ebgb(DOP_XOR);break;
  84. case 0x38:dyn_dop_ebgb(DOP_CMP);break;
  85.  
  86. // instructions 'op reg8,reg8' and 'op reg8,[]'
  87. case 0x02:dyn_dop_gbeb(DOP_ADD);break;
  88. case 0x0a:dyn_dop_gbeb(DOP_OR);break;
  89. case 0x12:dyn_dop_gbeb(DOP_ADC);break;
  90. case 0x1a:dyn_dop_gbeb(DOP_SBB);break;
  91. case 0x22:dyn_dop_gbeb(DOP_AND);break;
  92. case 0x2a:dyn_dop_gbeb(DOP_SUB);break;
  93. case 0x32:dyn_dop_gbeb(DOP_XOR);break;
  94. case 0x3a:dyn_dop_gbeb(DOP_CMP);break;
  95.  
  96. // instructions 'op reg16/32,reg16/32' and 'op [],reg16/32'
  97. case 0x01:dyn_dop_evgv(DOP_ADD);break;
  98. case 0x09:dyn_dop_evgv(DOP_OR);break;
  99. case 0x11:dyn_dop_evgv(DOP_ADC);break;
  100. case 0x19:dyn_dop_evgv(DOP_SBB);break;
  101. case 0x21:dyn_dop_evgv(DOP_AND);break;
  102. case 0x29:dyn_dop_evgv(DOP_SUB);break;
  103. case 0x31:dyn_dop_evgv(DOP_XOR);break;
  104. case 0x39:dyn_dop_evgv(DOP_CMP);break;
  105.  
  106. // instructions 'op reg16/32,reg16/32' and 'op reg16/32,[]'
  107. case 0x03:dyn_dop_gvev(DOP_ADD);break;
  108. case 0x0b:dyn_dop_gvev(DOP_OR);break;
  109. case 0x13:dyn_dop_gvev(DOP_ADC);break;
  110. case 0x1b:dyn_dop_gvev(DOP_SBB);break;
  111. case 0x23:dyn_dop_gvev(DOP_AND);break;
  112. case 0x2b:dyn_dop_gvev(DOP_SUB);break;
  113. case 0x33:dyn_dop_gvev(DOP_XOR);break;
  114. case 0x3b:dyn_dop_gvev(DOP_CMP);break;
  115.  
  116. // instructions 'op reg8,imm8'
  117. case 0x04:dyn_dop_byte_imm(DOP_ADD,DRC_REG_EAX,0);break;
  118. case 0x0c:dyn_dop_byte_imm(DOP_OR,DRC_REG_EAX,0);break;
  119. case 0x14:dyn_dop_byte_imm(DOP_ADC,DRC_REG_EAX,0);break;
  120. case 0x1c:dyn_dop_byte_imm(DOP_SBB,DRC_REG_EAX,0);break;
  121. case 0x24:dyn_dop_byte_imm(DOP_AND,DRC_REG_EAX,0);break;
  122. case 0x2c:dyn_dop_byte_imm(DOP_SUB,DRC_REG_EAX,0);break;
  123. case 0x34:dyn_dop_byte_imm(DOP_XOR,DRC_REG_EAX,0);break;
  124. case 0x3c:dyn_dop_byte_imm(DOP_CMP,DRC_REG_EAX,0);break;
  125.  
  126. // instructions 'op reg16/32,imm16/32'
  127. case 0x05:dyn_dop_word_imm(DOP_ADD,DRC_REG_EAX);break;
  128. case 0x0d:dyn_dop_word_imm_old(DOP_OR,DRC_REG_EAX,decode.big_op ? decode_fetchd() : decode_fetchw());break;
  129. case 0x15:dyn_dop_word_imm_old(DOP_ADC,DRC_REG_EAX,decode.big_op ? decode_fetchd() : decode_fetchw());break;
  130. case 0x1d:dyn_dop_word_imm_old(DOP_SBB,DRC_REG_EAX,decode.big_op ? decode_fetchd() : decode_fetchw());break;
  131. case 0x25:dyn_dop_word_imm(DOP_AND,DRC_REG_EAX);break;
  132. case 0x2d:dyn_dop_word_imm_old(DOP_SUB,DRC_REG_EAX,decode.big_op ? decode_fetchd() : decode_fetchw());break;
  133. case 0x35:dyn_dop_word_imm_old(DOP_XOR,DRC_REG_EAX,decode.big_op ? decode_fetchd() : decode_fetchw());break;
  134. case 0x3d:dyn_dop_word_imm_old(DOP_CMP,DRC_REG_EAX,decode.big_op ? decode_fetchd() : decode_fetchw());break;
  135.  
  136. // push segment register onto stack
  137. case 0x06:dyn_push_seg(DRC_SEG_ES);break;
  138. case 0x0e:dyn_push_seg(DRC_SEG_CS);break;
  139. case 0x16:dyn_push_seg(DRC_SEG_SS);break;
  140. case 0x1e:dyn_push_seg(DRC_SEG_DS);break;
  141.  
  142. // pop segment register from stack
  143. case 0x07:dyn_pop_seg(DRC_SEG_ES);break;
  144. case 0x17:dyn_pop_seg(DRC_SEG_SS);break;
  145. case 0x1f:dyn_pop_seg(DRC_SEG_DS);break;
  146.  
  147. // segment prefixes
  148. case 0x26:dyn_segprefix(DRC_SEG_ES);goto restart_prefix;
  149. case 0x2e:dyn_segprefix(DRC_SEG_CS);goto restart_prefix;
  150. case 0x36:dyn_segprefix(DRC_SEG_SS);goto restart_prefix;
  151. case 0x3e:dyn_segprefix(DRC_SEG_DS);goto restart_prefix;
  152. case 0x64:dyn_segprefix(DRC_SEG_FS);goto restart_prefix;
  153. case 0x65:dyn_segprefix(DRC_SEG_GS);goto restart_prefix;
  154.  
  155. // case 0x27: DAA missing
  156. // case 0x2f: DAS missing
  157. // case 0x37: AAA missing
  158. // case 0x3f: AAS missing
  159.  
  160. // dual opcodes
  161. case 0x0f:
  162. {
  163. LOG_MSG("createcacheblock8");
  164. Bitu dual_code=decode_fetchb();
  165. switch (dual_code) {
  166. case 0x00:
  167. if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode;
  168. dyn_grp6();
  169. break;
  170. case 0x01:
  171. if (dyn_grp7()) goto finish_block;
  172. break;
  173. /* case 0x02:
  174. if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode;
  175. dyn_larlsl(true);
  176. break;
  177. case 0x03:
  178. if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode;
  179. dyn_larlsl(false);
  180. break; */
  181.  
  182. case 0x20:dyn_mov_from_crx();break;
  183. case 0x22:dyn_mov_to_crx();goto finish_block;
  184.  
  185. // short conditional jumps
  186. case 0x80:case 0x81:case 0x82:case 0x83:case 0x84:case 0x85:case 0x86:case 0x87:
  187. case 0x88:case 0x89:case 0x8a:case 0x8b:case 0x8c:case 0x8d:case 0x8e:case 0x8f:
  188. dyn_branched_exit((BranchTypes)(dual_code&0xf),
  189. decode.big_op ? (Bit32s)decode_fetchd() : (Bit16s)decode_fetchw());
  190. goto finish_block;
  191.  
  192. // conditional byte set instructions
  193. /* case 0x90:case 0x91:case 0x92:case 0x93:case 0x94:case 0x95:case 0x96:case 0x97:
  194. case 0x98:case 0x99:case 0x9a:case 0x9b:case 0x9c:case 0x9d:case 0x9e:case 0x9f:
  195. dyn_set_byte_on_condition((BranchTypes)(dual_code&0xf));
  196. AcquireFlags(FMASK_TEST);
  197. break; */
  198.  
  199. // push/pop segment registers
  200. case 0xa0:dyn_push_seg(DRC_SEG_FS);break;
  201. case 0xa1:dyn_pop_seg(DRC_SEG_FS);break;
  202. case 0xa8:dyn_push_seg(DRC_SEG_GS);break;
  203. case 0xa9:dyn_pop_seg(DRC_SEG_GS);break;
  204.  
  205. // double shift instructions
  206. case 0xa4:dyn_dshift_ev_gv(true,true);break;
  207. case 0xa5:dyn_dshift_ev_gv(true,false);break;
  208. case 0xac:dyn_dshift_ev_gv(false,true);break;
  209. case 0xad:dyn_dshift_ev_gv(false,false);break;
  210.  
  211. case 0xaf:dyn_imul_gvev(0);break;
  212.  
  213. // lfs
  214. case 0xb4:
  215. dyn_get_modrm();
  216. if (GCC_UNLIKELY(decode.modrm.mod==3)) goto illegalopcode;
  217. dyn_load_seg_off_ea(DRC_SEG_FS);
  218. break;
  219. // lgs
  220. case 0xb5:
  221. dyn_get_modrm();
  222. if (GCC_UNLIKELY(decode.modrm.mod==3)) goto illegalopcode;
  223. dyn_load_seg_off_ea(DRC_SEG_GS);
  224. break;
  225.  
  226. // zero-extending moves
  227. case 0xb6:dyn_movx_ev_gb(false);break;
  228. case 0xb7:dyn_movx_ev_gw(false);break;
  229.  
  230. // sign-extending moves
  231. case 0xbe:dyn_movx_ev_gb(true);break;
  232. case 0xbf:dyn_movx_ev_gw(true);break;
  233.  
  234. default:
  235. #if DYN_LOG
  236. // LOG_MSG("Unhandled dual opcode 0F%02X",dual_code);
  237. #endif
  238. goto illegalopcode;
  239. }
  240. break;
  241. }
  242.  
  243. // 'inc/dec reg16/32'
  244. case 0x40:case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46:case 0x47:
  245. dyn_sop_word(SOP_INC,opcode&7);
  246. break;
  247. case 0x48:case 0x49:case 0x4a:case 0x4b:case 0x4c:case 0x4d:case 0x4e:case 0x4f:
  248. dyn_sop_word(SOP_DEC,opcode&7);
  249. break;
  250.  
  251. // 'push/pop reg16/32'
  252. case 0x50:case 0x51:case 0x52:case 0x53:case 0x54:case 0x55:case 0x56:case 0x57:
  253. dyn_push_reg(opcode&7);
  254. break;
  255. case 0x58:case 0x59:case 0x5a:case 0x5b:case 0x5c:case 0x5d:case 0x5e:case 0x5f:
  256. dyn_pop_reg(opcode&7);
  257. break;
  258.  
  259. case 0x60:
  260. if (decode.big_op) gen_call_function_raw((void *)&dynrec_pusha_dword);
  261. else gen_call_function_raw((void *)&dynrec_pusha_word);
  262. break;
  263. case 0x61:
  264. if (decode.big_op) gen_call_function_raw((void *)&dynrec_popa_dword);
  265. else gen_call_function_raw((void *)&dynrec_popa_word);
  266. break;
  267.  
  268. // case 0x62: BOUND missing
  269. // case 0x61: ARPL missing
  270.  
  271. case 0x66:decode.big_op=!cpu.code.big;goto restart_prefix;
  272. case 0x67:decode.big_addr=!cpu.code.big;goto restart_prefix;
  273.  
  274. // 'push imm8/16/32'
  275. case 0x68:
  276. dyn_push_word_imm(decode.big_op ? decode_fetchd() : decode_fetchw());
  277. break;
  278. case 0x6a:
  279. dyn_push_byte_imm((Bit8s)decode_fetchb());
  280. break;
  281.  
  282. // signed multiplication
  283. case 0x69:dyn_imul_gvev(decode.big_op ? 4 : 2);break;
  284. case 0x6b:dyn_imul_gvev(1);break;
  285.  
  286. // case 0x6c to 0x6f missing (ins/outs)
  287.  
  288. // short conditional jumps
  289. case 0x70:case 0x71:case 0x72:case 0x73:case 0x74:case 0x75:case 0x76:case 0x77:
  290. case 0x78:case 0x79:case 0x7a:case 0x7b:case 0x7c:case 0x7d:case 0x7e:case 0x7f:
  291. dyn_branched_exit((BranchTypes)(opcode&0xf),(Bit8s)decode_fetchb());
  292. goto finish_block;
  293.  
  294. // 'op []/reg8,imm8'
  295. case 0x80:
  296. case 0x82:dyn_grp1_eb_ib();break;
  297.  
  298. // 'op []/reg16/32,imm16/32'
  299. case 0x81:dyn_grp1_ev_iv(false);break;
  300. case 0x83:dyn_grp1_ev_iv(true);break;
  301.  
  302. // 'test []/reg8/16/32,reg8/16/32'
  303. case 0x84:dyn_dop_gbeb(DOP_TEST);break;
  304. case 0x85:dyn_dop_gvev(DOP_TEST);break;
  305.  
  306. // 'xchg reg8/16/32,[]/reg8/16/32'
  307. case 0x86:dyn_dop_ebgb_xchg();break;
  308. case 0x87:dyn_dop_evgv_xchg();break;
  309.  
  310. // 'mov []/reg8/16/32,reg8/16/32'
  311. case 0x88:dyn_dop_ebgb_mov();break;
  312. case 0x89:dyn_dop_evgv_mov();break;
  313. // 'mov reg8/16/32,[]/reg8/16/32'
  314. case 0x8a:dyn_dop_gbeb_mov();break;
  315. case 0x8b:dyn_dop_gvev_mov();break;
  316.  
  317. // move segment register into memory or a 16bit register
  318. case 0x8c:dyn_mov_ev_seg();break;
  319.  
  320. // load effective address
  321. case 0x8d:dyn_lea();break;
  322.  
  323. // move a value from memory or a 16bit register into a segment register
  324. case 0x8e:dyn_mov_seg_ev();break;
  325.  
  326. // 'pop []'
  327. case 0x8f:dyn_pop_ev();break;
  328.  
  329. case 0x90: // nop
  330. case 0x9b: // wait
  331. case 0xf0: // lock
  332. break;
  333.  
  334. case 0x91:case 0x92:case 0x93:case 0x94:case 0x95:case 0x96:case 0x97:
  335. dyn_xchg_ax(opcode&7);
  336. break;
  337.  
  338. // sign-extend al into ax/sign-extend ax into eax
  339. case 0x98:dyn_cbw();break;
  340. // sign-extend ax into dx:ax/sign-extend eax into edx:eax
  341. case 0x99:dyn_cwd();break;
  342.  
  343. case 0x9a:dyn_call_far_imm();goto finish_block;
  344.  
  345. case 0x9c: // pushf
  346. AcquireFlags(FMASK_TEST);
  347. gen_call_function_I((void *)&CPU_PUSHF,decode.big_op);
  348. dyn_check_exception(FC_RETOP);
  349. break;
  350. case 0x9d: // popf
  351. gen_call_function_I((void *)&CPU_POPF,decode.big_op);
  352. dyn_check_exception(FC_RETOP);
  353. InvalidateFlags();
  354. break;
  355.  
  356. case 0x9e:dyn_sahf();break;
  357. // case 0x9f: LAHF missing
  358.  
  359. // 'mov al/ax,[]'
  360. case 0xa0:
  361. dyn_mov_byte_al_direct(decode.big_addr ? decode_fetchd() : decode_fetchw());
  362. break;
  363. case 0xa1:
  364. dyn_mov_byte_ax_direct(decode.big_addr ? decode_fetchd() : decode_fetchw());
  365. break;
  366. // 'mov [],al/ax'
  367. case 0xa2:
  368. dyn_mov_byte_direct_al();
  369. break;
  370. case 0xa3:
  371. dyn_mov_byte_direct_ax(decode.big_addr ? decode_fetchd() : decode_fetchw());
  372. break;
  373.  
  374.  
  375. // case 0xa6 to 0xaf string operations, some missing
  376.  
  377. // movsb/w/d
  378. case 0xa4:dyn_string(STR_MOVSB);break;
  379. case 0xa5:dyn_string(decode.big_op ? STR_MOVSD : STR_MOVSW);break;
  380.  
  381. // stosb/w/d
  382. case 0xaa:dyn_string(STR_STOSB);break;
  383. case 0xab:dyn_string(decode.big_op ? STR_STOSD : STR_STOSW);break;
  384.  
  385. // lodsb/w/d
  386. case 0xac:dyn_string(STR_LODSB);break;
  387. case 0xad:dyn_string(decode.big_op ? STR_LODSD : STR_LODSW);break;
  388.  
  389.  
  390. // 'test reg8/16/32,imm8/16/32'
  391. case 0xa8:dyn_dop_byte_imm(DOP_TEST,DRC_REG_EAX,0);break;
  392. case 0xa9:dyn_dop_word_imm_old(DOP_TEST,DRC_REG_EAX,decode.big_op ? decode_fetchd() : decode_fetchw());break;
  393.  
  394. // 'mov reg8/16/32,imm8/16/32'
  395. case 0xb0:case 0xb1:case 0xb2:case 0xb3:case 0xb4:case 0xb5:case 0xb6:case 0xb7:
  396. dyn_mov_byte_imm(opcode&3,(opcode>>2)&1,decode_fetchb());
  397. break;
  398. case 0xb8:case 0xb9:case 0xba:case 0xbb:case 0xbc:case 0xbd:case 0xbe:case 0xbf:
  399. dyn_mov_word_imm(opcode&7);break;
  400. break;
  401.  
  402. // 'shiftop []/reg8,imm8/1/cl'
  403. case 0xc0:dyn_grp2_eb(grp2_imm);break;
  404. case 0xd0:dyn_grp2_eb(grp2_1);break;
  405. case 0xd2:dyn_grp2_eb(grp2_cl);break;
  406.  
  407. // 'shiftop []/reg16/32,imm8/1/cl'
  408. case 0xc1:dyn_grp2_ev(grp2_imm);break;
  409. case 0xd1:dyn_grp2_ev(grp2_1);break;
  410. case 0xd3:dyn_grp2_ev(grp2_cl);break;
  411.  
  412. // retn [param]
  413. case 0xc2:dyn_ret_near(decode_fetchw());goto finish_block;
  414. case 0xc3:dyn_ret_near(0);goto finish_block;
  415.  
  416. // les
  417. case 0xc4:
  418. dyn_get_modrm();
  419. if (GCC_UNLIKELY(decode.modrm.mod==3)) goto illegalopcode;
  420. dyn_load_seg_off_ea(DRC_SEG_ES);
  421. break;
  422. // lds
  423. case 0xc5:
  424. dyn_get_modrm();
  425. if (GCC_UNLIKELY(decode.modrm.mod==3)) goto illegalopcode;
  426. dyn_load_seg_off_ea(DRC_SEG_DS);break;
  427.  
  428. // 'mov []/reg8/16/32,imm8/16/32'
  429. case 0xc6:dyn_dop_ebib_mov();break;
  430. case 0xc7:dyn_dop_eviv_mov();break;
  431.  
  432. case 0xc8:dyn_enter();break;
  433. case 0xc9:dyn_leave();break;
  434.  
  435. // retf [param]
  436. case 0xca:dyn_ret_far(decode_fetchw());goto finish_block;
  437. case 0xcb:dyn_ret_far(0);goto finish_block;
  438.  
  439. // int/iret
  440. #if !(C_DEBUG)
  441. case 0xcd:dyn_interrupt(decode_fetchb());goto finish_block;
  442. #endif
  443. case 0xcf:dyn_iret();goto finish_block;
  444.  
  445. // case 0xd4: AAM missing
  446. // case 0xd5: AAD missing
  447.  
  448. // case 0xd6: SALC missing
  449. // case 0xd7: XLAT missing
  450.  
  451.  
  452. #ifdef CPU_FPU
  453. // floating point instructions
  454. case 0xd8:
  455. dyn_fpu_esc0();
  456. break;
  457. case 0xd9:
  458. dyn_fpu_esc1();
  459. break;
  460. case 0xda:
  461. dyn_fpu_esc2();
  462. break;
  463. case 0xdb:
  464. dyn_fpu_esc3();
  465. break;
  466. case 0xdc:
  467. dyn_fpu_esc4();
  468. break;
  469. case 0xdd:
  470. dyn_fpu_esc5();
  471. break;
  472. case 0xde:
  473. dyn_fpu_esc6();
  474. break;
  475. case 0xdf:
  476. dyn_fpu_esc7();
  477. break;
  478. #endif
  479.  
  480.  
  481. // loop instructions
  482. case 0xe0:dyn_loop(LOOP_NE);goto finish_block;
  483. case 0xe1:dyn_loop(LOOP_E);goto finish_block;
  484. case 0xe2:dyn_loop(LOOP_NONE);goto finish_block;
  485. case 0xe3:dyn_loop(LOOP_JCXZ);goto finish_block;
  486.  
  487.  
  488. // 'in al/ax/eax,port_imm'
  489. case 0xe4:dyn_read_port_byte_direct(decode_fetchb());break;
  490. case 0xe5:dyn_read_port_word_direct(decode_fetchb());break;
  491. // 'out port_imm,al/ax/eax'
  492. case 0xe6:dyn_write_port_byte_direct(decode_fetchb());break;
  493. case 0xe7:dyn_write_port_word_direct(decode_fetchb());break;
  494.  
  495. // 'in al/ax/eax,port_dx'
  496. case 0xec:dyn_read_port_byte();break;
  497. case 0xed:dyn_read_port_word();break;
  498. // 'out port_dx,al/ax/eax'
  499. case 0xee:dyn_write_port_byte();break;
  500. case 0xef:dyn_write_port_word();break;
  501.  
  502.  
  503. // 'call near imm16/32'
  504. case 0xe8:
  505. dyn_call_near_imm();
  506. goto finish_block;
  507. // 'jmp near imm16/32'
  508. case 0xe9:
  509. dyn_exit_link(decode.big_op ? (Bit32s)decode_fetchd() : (Bit16s)decode_fetchw());
  510. goto finish_block;
  511. // 'jmp far'
  512. case 0xea:
  513. dyn_jmp_far_imm();
  514. goto finish_block;
  515. // 'jmp short imm8'
  516. case 0xeb:
  517. dyn_exit_link((Bit8s)decode_fetchb());
  518. goto finish_block;
  519.  
  520.  
  521. // repeat prefixes
  522. case 0xf2:
  523. decode.rep=REP_NZ;
  524. goto restart_prefix;
  525. case 0xf3:
  526. decode.rep=REP_Z;
  527. goto restart_prefix;
  528.  
  529. case 0xf5: //CMC
  530. gen_call_function_raw((void*)dynrec_cmc);
  531. break;
  532. case 0xf8: //CLC
  533. gen_call_function_raw((void*)dynrec_clc);
  534. break;
  535. case 0xf9: //STC
  536. gen_call_function_raw((void*)dynrec_stc);
  537. break;
  538.  
  539. case 0xf6:dyn_grp3_eb();break;
  540. case 0xf7:dyn_grp3_ev();break;
  541.  
  542. case 0xfa: //CLI
  543. gen_call_function_raw((void *)&CPU_CLI);
  544. dyn_check_exception(FC_RETOP);
  545. break;
  546. case 0xfb: //STI
  547. gen_call_function_raw((void *)&CPU_STI);
  548. dyn_check_exception(FC_RETOP);
  549. if (max_opcodes<=0) max_opcodes=1; //Allow 1 extra opcode
  550. break;
  551.  
  552. case 0xfc: //CLD
  553. gen_call_function_raw((void*)dynrec_cld);
  554. break;
  555. case 0xfd: //STD
  556. gen_call_function_raw((void*)dynrec_std);
  557. break;
  558.  
  559. case 0xfe:
  560. if (dyn_grp4_eb()) goto finish_block;
  561. break;
  562. case 0xff:
  563. switch (dyn_grp4_ev()) {
  564. case 0:
  565. break;
  566. case 1:
  567. goto core_close_block;
  568. case 2:
  569. goto illegalopcode;
  570. default:
  571. break;
  572. }
  573. break;
  574.  
  575. default:
  576. #if DYN_LOG
  577. // LOG_MSG("Dynrec unhandled opcode %X",opcode);
  578. #endif
  579. goto illegalopcode;
  580. }
  581. }
  582. LOG_MSG("createcacheblocklate");
  583. // link to next block because the maximum number of opcodes has been reached
  584.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement