Subversion Repositories Kolibri OS

Rev

Rev 4039 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4039 Rev 6467
Line 1... Line 1...
1
; flat assembler core
1
; flat assembler core
2
; Copyright (c) 1999-2013, Tomasz Grysztar.
2
; Copyright (c) 1999-2016, Tomasz Grysztar.
3
; All rights reserved.
3
; All rights reserved.
Line 4... Line 4...
4
 
4
 
5
simple_instruction_except64:
5
simple_instruction_except64:
6
	cmp	[code_type],64
6
	cmp	[code_type],64
Line 54... Line 54...
54
	stos	word [edi]
54
	stos	word [edi]
55
	jmp	instruction_assembled
55
	jmp	instruction_assembled
56
prefix_instruction:
56
prefix_instruction:
57
	stos	byte [edi]
57
	stos	byte [edi]
58
	or	[prefixed_instruction],-1
58
	or	[prefix_flags],1
59
	jmp	continue_line
59
	jmp	continue_line
60
segment_prefix:
60
segment_prefix:
61
	mov	ah,al
61
	mov	ah,al
62
	shr	ah,4
62
	shr	ah,4
63
	cmp	ah,6
63
	cmp	ah,3
64
	jne	illegal_instruction
64
	jne	illegal_instruction
65
	and	al,1111b
65
	and	al,1111b
66
	mov	[segment_register],al
66
	mov	[segment_register],al
67
	call	store_segment_prefix
67
	call	store_segment_prefix
68
	or	[prefixed_instruction],-1
68
	or	[prefix_flags],1
-
 
69
	jmp	continue_line
-
 
70
bnd_prefix_instruction:
69
	jmp	continue_line
71
	stos	byte [edi]
-
 
72
	or	[prefix_flags],1 + 10h
-
 
73
	jmp	continue_line
70
int_instruction:
74
int_instruction:
71
	lods	byte [esi]
75
	lods	byte [esi]
72
	call	get_size_operator
76
	call	get_size_operator
73
	cmp	ah,1
77
	cmp	ah,1
74
	ja	invalid_operand_size
78
	ja	invalid_operand_size
Line 334... Line 338...
334
	stos	byte [edi]
338
	stos	byte [edi]
335
	jmp	instruction_assembled
339
	jmp	instruction_assembled
336
      basic_ax_imm:
340
      basic_ax_imm:
337
	add	[base_code],5
341
	add	[base_code],5
338
	call	store_instruction_code
342
	call	store_classic_instruction_code
339
	jmp	basic_store_imm_16bit
343
	jmp	basic_store_imm_16bit
340
      basic_reg_imm_32bit:
344
      basic_reg_imm_32bit:
341
	call	operand_32bit
345
	call	operand_32bit
342
	call	get_dword_value
346
	call	get_dword_value
343
      basic_reg_imm_32bit_ok:
347
      basic_reg_imm_32bit_ok:
344
	mov	edx,eax
348
	mov	edx,eax
Line 364... Line 368...
364
	stos	dword [edi]
368
	stos	dword [edi]
365
	jmp	instruction_assembled
369
	jmp	instruction_assembled
366
      basic_eax_imm:
370
      basic_eax_imm:
367
	add	[base_code],5
371
	add	[base_code],5
368
	call	store_instruction_code
372
	call	store_classic_instruction_code
369
	jmp	basic_store_imm_32bit
373
	jmp	basic_store_imm_32bit
370
      recoverable_unknown_size:
374
      recoverable_unknown_size:
371
	cmp	[error_line],0
375
	cmp	[error_line],0
372
	jne	ignore_unknown_size
376
	jne	ignore_unknown_size
373
	push	[current_line]
377
	push	[current_line]
374
	pop	[error_line]
378
	pop	[error_line]
Line 413... Line 417...
413
	lods	byte [esi]
417
	lods	byte [esi]
414
	call	get_size_operator
418
	call	get_size_operator
415
	cmp	al,10h
419
	cmp	al,10h
416
	je	mov_reg
420
	je	mov_reg
417
	cmp	al,'['
421
	cmp	al,14h
-
 
422
	je	mov_creg
-
 
423
	cmp	al,'['
418
	jne	invalid_operand
424
	jne	invalid_operand
419
      mov_mem:
425
      mov_mem:
420
	call	get_address
426
	call	get_address
421
	push	edx ebx ecx
427
	push	edx ebx ecx
422
	lods	byte [esi]
428
	lods	byte [esi]
Line 429... Line 435...
429
	cmp	al,10h
435
	cmp	al,10h
430
	jne	invalid_operand
436
	jne	invalid_operand
431
      mov_mem_reg:
437
      mov_mem_reg:
432
	lods	byte [esi]
438
	lods	byte [esi]
433
	cmp	al,60h
439
	cmp	al,30h
434
	jb	mov_mem_general_reg
440
	jb	mov_mem_general_reg
435
	cmp	al,70h
441
	cmp	al,40h
436
	jb	mov_mem_sreg
442
	jb	mov_mem_sreg
437
      mov_mem_general_reg:
443
      mov_mem_general_reg:
438
	call	convert_register
444
	call	convert_register
439
	mov	[postbyte_register],al
445
	mov	[postbyte_register],al
440
	pop	ecx ebx edx
446
	pop	ecx ebx edx
441
	cmp	ah,1
447
	cmp	ah,1
Line 471... Line 477...
471
	call	store_segment_prefix_if_necessary
477
	call	store_segment_prefix_if_necessary
472
	call	address_32bit_prefix
478
	call	address_32bit_prefix
473
	mov	[base_code],0A2h
479
	mov	[base_code],0A2h
474
      store_mov_address32:
480
      store_mov_address32:
475
	call	store_instruction_code
481
	call	store_classic_instruction_code
476
	call	store_address_32bit_value
482
	call	store_address_32bit_value
477
	jmp	instruction_assembled
483
	jmp	instruction_assembled
478
      mov_mem_address16_al:
484
      mov_mem_address16_al:
479
	call	store_segment_prefix_if_necessary
485
	call	store_segment_prefix_if_necessary
480
	call	address_16bit_prefix
486
	call	address_16bit_prefix
481
	mov	[base_code],0A2h
487
	mov	[base_code],0A2h
482
      store_mov_address16:
488
      store_mov_address16:
483
	cmp	[code_type],64
489
	cmp	[code_type],64
484
	je	invalid_address
490
	je	invalid_address
485
	call	store_instruction_code
491
	call	store_classic_instruction_code
486
	mov	eax,edx
492
	mov	eax,edx
487
	stos	word [edi]
493
	stos	word [edi]
488
	cmp	edx,10000h
494
	cmp	edx,10000h
489
	jge	value_out_of_range
495
	jge	value_out_of_range
490
	jmp	instruction_assembled
496
	jmp	instruction_assembled
491
      mov_mem_address64_al:
497
      mov_mem_address64_al:
492
	call	store_segment_prefix_if_necessary
498
	call	store_segment_prefix_if_necessary
493
	mov	[base_code],0A2h
499
	mov	[base_code],0A2h
494
      store_mov_address64:
500
      store_mov_address64:
495
	call	store_instruction_code
501
	call	store_classic_instruction_code
496
	call	store_address_64bit_value
502
	call	store_address_64bit_value
497
	jmp	instruction_assembled
503
	jmp	instruction_assembled
498
      mov_mem_ax:
504
      mov_mem_ax:
499
	test	ch,22h
505
	test	ch,22h
500
	jnz	mov_mem_address16_ax
506
	jnz	mov_mem_address16_ax
501
	test	ch,44h
507
	test	ch,44h
Line 524... Line 530...
524
	call	store_segment_prefix_if_necessary
530
	call	store_segment_prefix_if_necessary
525
	mov	[base_code],0A3h
531
	mov	[base_code],0A3h
526
	jmp	store_mov_address64
532
	jmp	store_mov_address64
527
      mov_mem_sreg:
533
      mov_mem_sreg:
528
	sub	al,61h
534
	sub	al,31h
529
	mov	[postbyte_register],al
535
	mov	[postbyte_register],al
530
	pop	ecx ebx edx
536
	pop	ecx ebx edx
531
	mov	ah,[operand_size]
537
	mov	ah,[operand_size]
532
	or	ah,ah
538
	or	ah,ah
533
	jz	mov_mem_sreg_store
539
	jz	mov_mem_sreg_store
534
	cmp	ah,2
540
	cmp	ah,2
Line 554... Line 560...
554
	call	get_simm32
560
	call	get_simm32
555
	cmp	[value_type],4
561
	cmp	[value_type],4
556
	jae	long_immediate_not_encodable
562
	jae	long_immediate_not_encodable
557
	jmp	mov_mem_imm_32bit_store
563
	jmp	mov_mem_imm_32bit_store
558
      mov_mem_imm_8bit:
564
      mov_mem_imm_nosize:
-
 
565
	call	recoverable_unknown_size
-
 
566
      mov_mem_imm_8bit:
559
	call	get_byte_value
567
	call	get_byte_value
560
	mov	byte [value],al
568
	mov	byte [value],al
561
	mov	[postbyte_register],0
569
	mov	[postbyte_register],0
562
	mov	[base_code],0C6h
570
	mov	[base_code],0C6h
563
	pop	ecx ebx edx
571
	pop	ecx ebx edx
Line 571... Line 579...
571
	mov	[base_code],0C7h
579
	mov	[base_code],0C7h
572
	pop	ecx ebx edx
580
	pop	ecx ebx edx
573
	call	store_instruction_with_imm16
581
	call	store_instruction_with_imm16
574
	jmp	instruction_assembled
582
	jmp	instruction_assembled
575
      mov_mem_imm_nosize:
583
      mov_mem_imm_32bit:
576
	call	recoverable_unknown_size
-
 
577
      mov_mem_imm_32bit:
-
 
578
	call	operand_32bit
584
	call	operand_32bit
579
	call	get_dword_value
585
	call	get_dword_value
580
      mov_mem_imm_32bit_store:
586
      mov_mem_imm_32bit_store:
581
	mov	dword [value],eax
587
	mov	dword [value],eax
582
	mov	[postbyte_register],0
588
	mov	[postbyte_register],0
Line 601... Line 607...
601
	cmp	al,'['
607
	cmp	al,'['
602
	je	mov_reg_mem
608
	je	mov_reg_mem
603
	cmp	al,'('
609
	cmp	al,'('
604
	je	mov_reg_imm
610
	je	mov_reg_imm
605
	cmp	al,10h
611
	cmp	al,14h
-
 
612
	je	mov_reg_creg
-
 
613
	cmp	al,10h
606
	jne	invalid_operand
614
	jne	invalid_operand
607
      mov_reg_reg:
615
      mov_reg_reg:
608
	lods	byte [esi]
616
	lods	byte [esi]
609
	mov	ah,al
617
	mov	ah,al
610
	sub	ah,10h
618
	sub	ah,10h
Line 626... Line 634...
626
	mov	ah,al
634
	mov	ah,al
627
	and	al,1111b
635
	and	al,1111b
628
	mov	[postbyte_register],al
636
	mov	[postbyte_register],al
629
	shr	ah,4
637
	shr	ah,4
630
	cmp	ah,5
638
	cmp	ah,3
631
	je	mov_reg_creg
639
	jne	invalid_operand
632
	cmp	ah,7
-
 
633
	je	mov_reg_dreg
-
 
634
	ja	mov_reg_treg
640
	dec	[postbyte_register]
635
	dec	[postbyte_register]
-
 
636
	cmp	[operand_size],8
641
	cmp	[operand_size],8
637
	je	mov_reg_sreg64
642
	je	mov_reg_sreg64
638
	cmp	[operand_size],4
643
	cmp	[operand_size],4
639
	je	mov_reg_sreg32
644
	je	mov_reg_sreg32
640
	cmp	[operand_size],2
645
	cmp	[operand_size],2
Line 648... Line 653...
648
	call	operand_32bit
653
	call	operand_32bit
649
      mov_reg_sreg_store:
654
      mov_reg_sreg_store:
650
	mov	[base_code],8Ch
655
	mov	[base_code],8Ch
651
	jmp	nomem_instruction_ready
656
	jmp	nomem_instruction_ready
652
      mov_reg_treg:
657
      mov_reg_creg:
653
	cmp	ah,9
-
 
654
	jne	invalid_operand
-
 
655
	mov	[extended_code],24h
-
 
656
	jmp	mov_reg_xrx
-
 
657
      mov_reg_dreg:
-
 
658
	mov	[extended_code],21h
-
 
659
	jmp	mov_reg_xrx
-
 
660
      mov_reg_creg:
-
 
661
	mov	[extended_code],20h
658
	lods	byte [esi]
-
 
659
	mov	bl,al
-
 
660
	shr	al,4
-
 
661
	cmp	al,4
-
 
662
	ja	invalid_operand
-
 
663
	add	al,20h
-
 
664
	mov	[extended_code],al
662
      mov_reg_xrx:
665
	and	bl,1111b
-
 
666
	xchg	bl,[postbyte_register]
663
	mov	[base_code],0Fh
667
	mov	[base_code],0Fh
664
	cmp	[code_type],64
668
	cmp	[code_type],64
665
	je	mov_reg_xrx_64bit
669
	je	mov_reg_creg_64bit
666
	cmp	[operand_size],4
670
	cmp	[operand_size],4
667
	jne	invalid_operand_size
671
	jne	invalid_operand_size
668
	cmp	[postbyte_register],8
672
	cmp	[postbyte_register],8
669
	jne	mov_reg_xrx_store
673
	jb	mov_reg_creg_store
670
	cmp	[extended_code],20h
674
	cmp	[extended_code],20h
671
	jne	mov_reg_xrx_store
675
	jne	mov_reg_creg_store
672
	mov	al,0F0h
676
	mov	al,0F0h
673
	stos	byte [edi]
677
	stos	byte [edi]
674
	mov	[postbyte_register],0
678
	mov	[postbyte_register],0
675
      mov_reg_xrx_store:
679
      mov_reg_creg_store:
676
	jmp	nomem_instruction_ready
680
	jmp	nomem_instruction_ready
677
      mov_reg_xrx_64bit:
681
      mov_reg_creg_64bit:
678
	cmp	[operand_size],8
682
	cmp	[operand_size],8
679
	jne	invalid_operand_size
683
	jne	invalid_operand_size
680
	jmp	nomem_instruction_ready
684
	jmp	nomem_instruction_ready
681
      mov_reg_mem:
685
      mov_reg_mem:
682
	call	get_address
686
	call	get_address
683
	mov	al,[operand_size]
687
	mov	al,[operand_size]
Line 823... Line 827...
823
      mov_reg_imm_prefix_ok:
827
      mov_reg_imm_prefix_ok:
824
	and	ah,111b
828
	and	ah,111b
825
	add	al,ah
829
	add	al,ah
826
	mov	[base_code],al
830
	mov	[base_code],al
827
	call	store_instruction_code
831
	call	store_classic_instruction_code
828
	ret
832
	ret
829
      mov_reg_64bit_imm_32bit:
833
      mov_reg_64bit_imm_32bit:
830
	mov	edx,eax
834
	mov	edx,eax
831
	mov	bl,[postbyte_register]
835
	mov	bl,[postbyte_register]
832
	mov	[postbyte_register],0
836
	mov	[postbyte_register],0
833
	mov	[base_code],0C7h
837
	mov	[base_code],0C7h
Line 837... Line 841...
837
	mov	ah,al
841
	mov	ah,al
838
	and	al,1111b
842
	and	al,1111b
839
	mov	[postbyte_register],al
843
	mov	[postbyte_register],al
840
	shr	ah,4
844
	shr	ah,4
841
	cmp	ah,5
845
	cmp	ah,3
842
	je	mov_creg
846
	jne	invalid_operand
843
	cmp	ah,7
-
 
844
	je	mov_dreg
-
 
845
	ja	mov_treg
847
	cmp	al,2
846
	cmp	al,2
-
 
847
	je	illegal_instruction
848
	je	illegal_instruction
848
	dec	[postbyte_register]
849
	dec	[postbyte_register]
849
	lods	byte [esi]
850
	lods	byte [esi]
850
	cmp	al,','
851
	cmp	al,','
851
	jne	invalid_operand
852
	jne	invalid_operand
Line 875... Line 876...
875
	jne	invalid_operand_size
876
	jne	invalid_operand_size
876
      mov_sreg_mem_size_ok:
877
      mov_sreg_mem_size_ok:
877
	mov	[base_code],8Eh
878
	mov	[base_code],8Eh
878
	jmp	instruction_ready
879
	jmp	instruction_ready
879
      mov_treg:
880
      mov_creg:
880
	cmp	ah,9
-
 
881
	jne	invalid_operand
-
 
882
	mov	[extended_code],26h
-
 
883
	jmp	mov_xrx
-
 
884
      mov_dreg:
-
 
885
	mov	[extended_code],23h
-
 
886
	jmp	mov_xrx
-
 
887
      mov_creg:
-
 
888
	mov	[extended_code],22h
881
	lods	byte [esi]
-
 
882
	mov	ah,al
-
 
883
	shr	ah,4
-
 
884
	cmp	ah,4
-
 
885
	ja	invalid_operand
-
 
886
	add	ah,22h
-
 
887
	mov	[extended_code],ah
889
      mov_xrx:
888
	and	al,1111b
890
	mov	[base_code],0Fh
889
	mov	[postbyte_register],al
-
 
890
	mov	[base_code],0Fh
891
	lods	byte [esi]
891
	lods	byte [esi]
892
	cmp	al,','
892
	cmp	al,','
893
	jne	invalid_operand
893
	jne	invalid_operand
894
	lods	byte [esi]
894
	call	take_register
895
	cmp	al,10h
-
 
896
	jne	invalid_operand
-
 
897
	lods	byte [esi]
-
 
898
	call	convert_register
-
 
899
	mov	bl,al
895
	mov	bl,al
900
	cmp	[code_type],64
896
	cmp	[code_type],64
901
	je	mov_xrx_64bit
897
	je	mov_creg_64bit
902
	cmp	ah,4
898
	cmp	ah,4
903
	jne	invalid_operand_size
899
	jne	invalid_operand_size
904
	cmp	[postbyte_register],8
900
	cmp	[postbyte_register],8
905
	jne	mov_xrx_store
901
	jb	mov_creg_store
906
	cmp	[extended_code],22h
902
	cmp	[extended_code],22h
907
	jne	mov_xrx_store
903
	jne	mov_creg_store
908
	mov	al,0F0h
904
	mov	al,0F0h
909
	stos	byte [edi]
905
	stos	byte [edi]
910
	mov	[postbyte_register],0
906
	mov	[postbyte_register],0
911
      mov_xrx_store:
907
      mov_creg_store:
912
	jmp	nomem_instruction_ready
908
	jmp	nomem_instruction_ready
913
      mov_xrx_64bit:
909
      mov_creg_64bit:
914
	cmp	ah,8
910
	cmp	ah,8
915
	je	mov_xrx_store
911
	je	mov_creg_store
916
	jmp	invalid_operand_size
912
	jmp	invalid_operand_size
917
test_instruction:
913
test_instruction:
918
	mov	[base_code],84h
914
	mov	[base_code],84h
919
	lods	byte [esi]
915
	lods	byte [esi]
920
	call	get_size_operator
916
	call	get_size_operator
921
	cmp	al,10h
917
	cmp	al,10h
Line 964... Line 960...
964
	call	get_simm32
960
	call	get_simm32
965
	cmp	[value_type],4
961
	cmp	[value_type],4
966
	jae	long_immediate_not_encodable
962
	jae	long_immediate_not_encodable
967
	jmp	test_mem_imm_32bit_store
963
	jmp	test_mem_imm_32bit_store
968
      test_mem_imm_8bit:
964
      test_mem_imm_nosize:
-
 
965
	call	recoverable_unknown_size
-
 
966
      test_mem_imm_8bit:
969
	call	get_byte_value
967
	call	get_byte_value
970
	mov	byte [value],al
968
	mov	byte [value],al
971
	mov	[postbyte_register],0
969
	mov	[postbyte_register],0
972
	mov	[base_code],0F6h
970
	mov	[base_code],0F6h
973
	pop	ecx ebx edx
971
	pop	ecx ebx edx
Line 981... Line 979...
981
	mov	[base_code],0F7h
979
	mov	[base_code],0F7h
982
	pop	ecx ebx edx
980
	pop	ecx ebx edx
983
	call	store_instruction_with_imm16
981
	call	store_instruction_with_imm16
984
	jmp	instruction_assembled
982
	jmp	instruction_assembled
985
      test_mem_imm_nosize:
983
      test_mem_imm_32bit:
986
	call	recoverable_unknown_size
-
 
987
      test_mem_imm_32bit:
-
 
988
	call	operand_32bit
984
	call	operand_32bit
989
	call	get_dword_value
985
	call	get_dword_value
990
      test_mem_imm_32bit_store:
986
      test_mem_imm_32bit_store:
991
	mov	dword [value],eax
987
	mov	dword [value],eax
992
	mov	[postbyte_register],0
988
	mov	[postbyte_register],0
Line 1052... Line 1048...
1052
	stos	byte [edi]
1048
	stos	byte [edi]
1053
	jmp	instruction_assembled
1049
	jmp	instruction_assembled
1054
      test_al_imm:
1050
      test_al_imm:
1055
	mov	[base_code],0A8h
1051
	mov	[base_code],0A8h
1056
	call	store_instruction_code
1052
	call	store_classic_instruction_code
1057
	mov	al,dl
1053
	mov	al,dl
1058
	stos	byte [edi]
1054
	stos	byte [edi]
1059
	jmp	instruction_assembled
1055
	jmp	instruction_assembled
1060
      test_reg_imm_16bit:
1056
      test_reg_imm_16bit:
1061
	call	operand_16bit
1057
	call	operand_16bit
1062
	call	get_word_value
1058
	call	get_word_value
Line 1072... Line 1068...
1072
	stos	word [edi]
1068
	stos	word [edi]
1073
	jmp	instruction_assembled
1069
	jmp	instruction_assembled
1074
      test_ax_imm:
1070
      test_ax_imm:
1075
	mov	[base_code],0A9h
1071
	mov	[base_code],0A9h
1076
	call	store_instruction_code
1072
	call	store_classic_instruction_code
1077
	mov	ax,dx
1073
	mov	ax,dx
1078
	stos	word [edi]
1074
	stos	word [edi]
1079
	jmp	instruction_assembled
1075
	jmp	instruction_assembled
1080
      test_reg_imm_32bit:
1076
      test_reg_imm_32bit:
1081
	call	operand_32bit
1077
	call	operand_32bit
1082
	call	get_dword_value
1078
	call	get_dword_value
Line 1093... Line 1089...
1093
	stos	dword [edi]
1089
	stos	dword [edi]
1094
	jmp	instruction_assembled
1090
	jmp	instruction_assembled
1095
      test_eax_imm:
1091
      test_eax_imm:
1096
	mov	[base_code],0A9h
1092
	mov	[base_code],0A9h
1097
	call	store_instruction_code
1093
	call	store_classic_instruction_code
1098
	mov	eax,edx
1094
	mov	eax,edx
1099
	stos	dword [edi]
1095
	stos	dword [edi]
1100
	jmp	instruction_assembled
1096
	jmp	instruction_assembled
1101
      test_reg_mem:
1097
      test_reg_mem:
1102
	call	get_address
1098
	call	get_address
1103
	mov	al,[operand_size]
1099
	mov	al,[operand_size]
Line 1166... Line 1162...
1166
	and	bl,111b
1162
	and	bl,111b
1167
      xchg_ax_reg_store:
1163
      xchg_ax_reg_store:
1168
	add	bl,90h
1164
	add	bl,90h
1169
	mov	[base_code],bl
1165
	mov	[base_code],bl
1170
	call	store_instruction_code
1166
	call	store_classic_instruction_code
1171
	jmp	instruction_assembled
1167
	jmp	instruction_assembled
1172
      xchg_reg_reg_store:
1168
      xchg_reg_reg_store:
1173
	inc	[base_code]
1169
	inc	[base_code]
1174
      xchg_reg_reg_8bit:
1170
      xchg_reg_reg_8bit:
1175
	jmp	nomem_instruction_ready
1171
	jmp	nomem_instruction_ready
1176
push_instruction:
1172
push_instruction:
Line 1266... Line 1262...
1266
	test	ah,not 2
1262
	test	ah,not 2
1267
	jnz	invalid_operand_size
1263
	jnz	invalid_operand_size
1268
	call	operand_16bit
1264
	call	operand_16bit
1269
      push_reg_store:
1265
      push_reg_store:
1270
	call	store_instruction_code
1266
	call	store_classic_instruction_code
1271
	jmp	push_done
1267
	jmp	push_done
1272
      push_sreg:
1268
      push_sreg:
1273
	mov	bl,al
1269
	mov	bl,al
1274
	mov	dl,[operand_size]
1270
	mov	dl,[operand_size]
1275
	mov	dh,[push_size]
1271
	mov	dh,[push_size]
1276
	cmp	dl,2
1272
	cmp	dl,2
Line 1306... Line 1302...
1306
	cmp	[code_type],64
1302
	cmp	[code_type],64
1307
	jne	illegal_instruction
1303
	jne	illegal_instruction
1308
      push_sreg_store:
1304
      push_sreg_store:
1309
	mov	al,bl
1305
	mov	al,bl
1310
	cmp	al,70h
1306
	cmp	al,40h
1311
	jae	invalid_operand
1307
	jae	invalid_operand
1312
	sub	al,61h
1308
	sub	al,31h
1313
	jc	invalid_operand
1309
	jc	invalid_operand
1314
	cmp	al,4
1310
	cmp	al,4
1315
	jae	push_sreg_386
1311
	jae	push_sreg_386
1316
	shl	al,3
1312
	shl	al,3
1317
	add	al,6
1313
	add	al,6
1318
	mov	[base_code],al
1314
	mov	[base_code],al
Line 1391... Line 1387...
1391
	jge	push_imm_16bit_store
1387
	jge	push_imm_16bit_store
1392
      push_imm_8bit:
1388
      push_imm_8bit:
1393
	mov	ah,al
1389
	mov	ah,al
1394
	mov	[base_code],6Ah
1390
	mov	[base_code],6Ah
1395
	call	store_instruction_code
1391
	call	store_classic_instruction_code
1396
	mov	al,ah
1392
	mov	al,ah
1397
	stos	byte [edi]
1393
	stos	byte [edi]
1398
	jmp	push_done
1394
	jmp	push_done
1399
      push_imm_16bit:
1395
      push_imm_16bit:
1400
	call	get_word_value
1396
	call	get_word_value
1401
	mov	dx,ax
1397
	mov	dx,ax
1402
	call	operand_16bit
1398
	call	operand_16bit
1403
      push_imm_16bit_store:
1399
      push_imm_16bit_store:
1404
	mov	[base_code],68h
1400
	mov	[base_code],68h
1405
	call	store_instruction_code
1401
	call	store_classic_instruction_code
1406
	mov	ax,dx
1402
	mov	ax,dx
1407
	call	mark_relocation
1403
	call	mark_relocation
1408
	stos	word [edi]
1404
	stos	word [edi]
1409
	jmp	push_done
1405
	jmp	push_done
1410
      push_imm_64bit:
1406
      push_imm_64bit:
1411
	cmp	[code_type],64
1407
	cmp	[code_type],64
Line 1420... Line 1416...
1420
	mov	edx,eax
1416
	mov	edx,eax
1421
	call	operand_32bit
1417
	call	operand_32bit
1422
      push_imm_32bit_store:
1418
      push_imm_32bit_store:
1423
	mov	[base_code],68h
1419
	mov	[base_code],68h
1424
	call	store_instruction_code
1420
	call	store_classic_instruction_code
1425
	mov	eax,edx
1421
	mov	eax,edx
1426
	call	mark_relocation
1422
	call	mark_relocation
1427
	stos	dword [edi]
1423
	stos	dword [edi]
1428
      push_done:
1424
      push_done:
1429
	lods	byte [esi]
1425
	lods	byte [esi]
1430
	dec	esi
1426
	dec	esi
1431
	cmp	al,0Fh
1427
	cmp	al,0Fh
1432
	je	instruction_assembled
1428
	je	instruction_assembled
1433
	or	al,al
1429
	or	al,al
1434
	jz	instruction_assembled
1430
	jz	instruction_assembled
1435
	mov	[operand_size],0
1431
;	 mov	 [operand_size],0
1436
	mov	[size_override],0
1432
;	 mov	 [operand_flags],0
1437
	mov	[operand_prefix],0
1433
;	 mov	 [operand_prefix],0
1438
	mov	[rex_prefix],0
1434
;	 mov	 [rex_prefix],0
1439
	jmp	push_next
1435
	and	dword [operand_size],0
-
 
1436
	jmp	push_next
1440
pop_instruction:
1437
pop_instruction:
1441
	mov	[push_size],al
1438
	mov	[push_size],al
1442
      pop_next:
1439
      pop_next:
1443
	lods	byte [esi]
1440
	lods	byte [esi]
1444
	call	get_size_operator
1441
	call	get_size_operator
Line 1529... Line 1526...
1529
	test	ah,not 2
1526
	test	ah,not 2
1530
	jnz	invalid_operand_size
1527
	jnz	invalid_operand_size
1531
	call	operand_16bit
1528
	call	operand_16bit
1532
      pop_reg_store:
1529
      pop_reg_store:
1533
	call	store_instruction_code
1530
	call	store_classic_instruction_code
1534
      pop_done:
1531
      pop_done:
1535
	lods	byte [esi]
1532
	lods	byte [esi]
1536
	dec	esi
1533
	dec	esi
1537
	cmp	al,0Fh
1534
	cmp	al,0Fh
1538
	je	instruction_assembled
1535
	je	instruction_assembled
1539
	or	al,al
1536
	or	al,al
1540
	jz	instruction_assembled
1537
	jz	instruction_assembled
1541
	mov	[operand_size],0
1538
;	 mov	 [operand_size],0
1542
	mov	[size_override],0
1539
;	 mov	 [operand_flags],0
1543
	mov	[operand_prefix],0
1540
;	 mov	 [operand_prefix],0
1544
	mov	[rex_prefix],0
1541
;	 mov	 [rex_prefix],0
1545
	jmp	pop_next
1542
	and	dword [operand_size],0
-
 
1543
	jmp	pop_next
1546
      pop_sreg:
1544
      pop_sreg:
1547
	mov	dl,[operand_size]
1545
	mov	dl,[operand_size]
1548
	mov	dh,[push_size]
1546
	mov	dh,[push_size]
1549
	cmp	al,62h
1547
	cmp	al,32h
1550
	je	pop_cs
1548
	je	pop_cs
1551
	mov	bl,al
1549
	mov	bl,al
1552
	cmp	dl,2
1550
	cmp	dl,2
1553
	je	pop_sreg16
1551
	je	pop_sreg16
1554
	cmp	dl,4
1552
	cmp	dl,4
1555
	je	pop_sreg32
1553
	je	pop_sreg32
Line 1582... Line 1580...
1582
	cmp	[code_type],64
1580
	cmp	[code_type],64
1583
	jne	illegal_instruction
1581
	jne	illegal_instruction
1584
      pop_sreg_store:
1582
      pop_sreg_store:
1585
	mov	al,bl
1583
	mov	al,bl
1586
	cmp	al,70h
1584
	cmp	al,40h
1587
	jae	invalid_operand
1585
	jae	invalid_operand
1588
	sub	al,61h
1586
	sub	al,31h
1589
	jc	invalid_operand
1587
	jc	invalid_operand
1590
	cmp	al,4
1588
	cmp	al,4
1591
	jae	pop_sreg_386
1589
	jae	pop_sreg_386
1592
	shl	al,3
1590
	shl	al,3
1593
	add	al,7
1591
	add	al,7
1594
	mov	[base_code],al
1592
	mov	[base_code],al
Line 1663... Line 1661...
1663
	shl	al,3
1661
	shl	al,3
1664
	add	al,bl
1662
	add	al,bl
1665
	add	al,40h
1663
	add	al,40h
1666
	mov	[base_code],al
1664
	mov	[base_code],al
1667
	call	store_instruction_code
1665
	call	store_classic_instruction_code
1668
	jmp	instruction_assembled
1666
	jmp	instruction_assembled
1669
      inc_reg_long_form:
1667
      inc_reg_long_form:
1670
	inc	[base_code]
1668
	inc	[base_code]
1671
      inc_reg_8bit:
1669
      inc_reg_8bit:
1672
	jmp	nomem_instruction_ready
1670
	jmp	nomem_instruction_ready
1673
set_instruction:
1671
set_instruction:
Line 1706... Line 1704...
1706
	call	get_address
1704
	call	get_address
1707
	lods	byte [esi]
1705
	lods	byte [esi]
1708
	cmp	al,','
1706
	cmp	al,','
1709
	jne	invalid_operand
1707
	jne	invalid_operand
1710
	lods	byte [esi]
1708
	call	take_register
1711
	cmp	al,10h
-
 
1712
	jne	invalid_operand
-
 
1713
	lods	byte [esi]
-
 
1714
	call	convert_register
-
 
1715
	mov	[postbyte_register],al
1709
	mov	[postbyte_register],al
1716
	cmp	ah,2
1710
	cmp	ah,2
1717
	jne	invalid_operand_size
1711
	jne	invalid_operand_size
1718
	jmp	instruction_ready
1712
	jmp	instruction_ready
1719
      arpl_reg:
1713
      arpl_reg:
1720
	lods	byte [esi]
1714
	lods	byte [esi]
Line 1724... Line 1718...
1724
	mov	bl,al
1718
	mov	bl,al
1725
	lods	byte [esi]
1719
	lods	byte [esi]
1726
	cmp	al,','
1720
	cmp	al,','
1727
	jne	invalid_operand
1721
	jne	invalid_operand
1728
	lods	byte [esi]
1722
	call	take_register
1729
	cmp	al,10h
-
 
1730
	jne	invalid_operand
-
 
1731
	lods	byte [esi]
-
 
1732
	call	convert_register
-
 
1733
	mov	[postbyte_register],al
1723
	mov	[postbyte_register],al
1734
	jmp	nomem_instruction_ready
1724
	jmp	nomem_instruction_ready
1735
bound_instruction:
1725
bound_instruction:
1736
	cmp	[code_type],64
1726
	cmp	[code_type],64
1737
	je	illegal_instruction
1727
	je	illegal_instruction
1738
	lods	byte [esi]
1728
	call	take_register
1739
	call	get_size_operator
-
 
1740
	cmp	al,10h
-
 
1741
	jne	invalid_operand
-
 
1742
	lods	byte [esi]
-
 
1743
	call	convert_register
-
 
1744
	mov	[postbyte_register],al
1729
	mov	[postbyte_register],al
1745
	lods	byte [esi]
1730
	lods	byte [esi]
1746
	cmp	al,','
1731
	cmp	al,','
1747
	jne	invalid_operand
1732
	jne	invalid_operand
1748
	lods	byte [esi]
1733
	lods	byte [esi]
1749
	call	get_size_operator
1734
	call	get_size_operator
Line 1818... Line 1803...
1818
	jmp	ret_instruction
1803
	jmp	ret_instruction
1819
ret_instruction_16bit:
1804
ret_instruction_16bit:
1820
	call	operand_16bit
1805
	call	operand_16bit
1821
	jmp	ret_instruction
1806
	jmp	ret_instruction
1822
retf_instruction:
1807
ret_instruction_64bit:
1823
	cmp	[code_type],64
-
 
1824
	jne	ret_instruction
-
 
1825
ret_instruction_64bit:
-
 
1826
	call	operand_64bit
1808
	call	operand_64bit
1827
ret_instruction:
1809
ret_instruction:
1828
	mov	[base_code],al
1810
	and	[prefix_flags],not 10h
-
 
1811
      ret_common:
-
 
1812
	mov	[base_code],al
1829
	lods	byte [esi]
1813
	lods	byte [esi]
1830
	dec	esi
1814
	dec	esi
1831
	or	al,al
1815
	or	al,al
1832
	jz	simple_ret
1816
	jz	simple_ret
1833
	cmp	al,0Fh
1817
	cmp	al,0Fh
Line 1855... Line 1839...
1855
	or	ax,ax
1839
	or	ax,ax
1856
	jz	simple_ret
1840
	jz	simple_ret
1857
      ret_imm_store:
1841
      ret_imm_store:
1858
	mov	dx,ax
1842
	mov	dx,ax
1859
	call	store_instruction_code
1843
	call	store_classic_instruction_code
1860
	mov	ax,dx
1844
	mov	ax,dx
1861
	stos	word [edi]
1845
	stos	word [edi]
1862
	jmp	instruction_assembled
1846
	jmp	instruction_assembled
1863
      simple_ret:
1847
      simple_ret:
1864
	inc	[base_code]
1848
	inc	[base_code]
1865
	call	store_instruction_code
1849
	call	store_classic_instruction_code
1866
	jmp	instruction_assembled
1850
	jmp	instruction_assembled
1867
lea_instruction:
1851
retf_instruction:
-
 
1852
	cmp	[code_type],64
-
 
1853
	jne	ret_common
-
 
1854
retf_instruction_64bit:
-
 
1855
	call	operand_64bit
-
 
1856
	jmp	ret_common
-
 
1857
retf_instruction_32bit:
-
 
1858
	call	operand_32bit
-
 
1859
	jmp	ret_common
-
 
1860
retf_instruction_16bit:
-
 
1861
	call	operand_16bit
-
 
1862
	jmp	ret_common
-
 
1863
lea_instruction:
1868
	mov	[base_code],8Dh
1864
	mov	[base_code],8Dh
1869
	lods	byte [esi]
1865
	call	take_register
1870
	call	get_size_operator
-
 
1871
	cmp	al,10h
-
 
1872
	jne	invalid_operand
-
 
1873
	lods	byte [esi]
-
 
1874
	call	convert_register
-
 
1875
	mov	[postbyte_register],al
1866
	mov	[postbyte_register],al
1876
	lods	byte [esi]
1867
	lods	byte [esi]
1877
	cmp	al,','
1868
	cmp	al,','
1878
	jne	invalid_operand
1869
	jne	invalid_operand
1879
	xor	al,al
1870
	xor	al,al
1880
	xchg	al,[operand_size]
1871
	xchg	al,[operand_size]
Line 1882... Line 1873...
1882
	lods	byte [esi]
1873
	lods	byte [esi]
1883
	call	get_size_operator
1874
	call	get_size_operator
1884
	cmp	al,'['
1875
	cmp	al,'['
1885
	jne	invalid_operand
1876
	jne	invalid_operand
1886
	mov	[size_override],-1
1877
	or	[operand_flags],1
1887
	call	get_address
1878
	call	get_address
1888
	pop	eax
1879
	pop	eax
1889
	mov	[operand_size],al
1880
	mov	[operand_size],al
1890
	call	operand_autodetect
1881
	call	operand_autodetect
1891
	jmp	instruction_ready
1882
	jmp	instruction_ready
1892
ls_instruction:
1883
ls_instruction:
Line 1906... Line 1897...
1906
      ls_short_code:
1897
      ls_short_code:
1907
	cmp	[code_type],64
1898
	cmp	[code_type],64
1908
	je	illegal_instruction
1899
	je	illegal_instruction
1909
      ls_code_ok:
1900
      ls_code_ok:
1910
	lods	byte [esi]
1901
	call	take_register
1911
	call	get_size_operator
-
 
1912
	cmp	al,10h
-
 
1913
	jne	invalid_operand
-
 
1914
	lods	byte [esi]
-
 
1915
	call	convert_register
-
 
1916
	mov	[postbyte_register],al
1902
	mov	[postbyte_register],al
1917
	lods	byte [esi]
1903
	lods	byte [esi]
1918
	cmp	al,','
1904
	cmp	al,','
1919
	jne	invalid_operand
1905
	jne	invalid_operand
1920
	add	[operand_size],2
1906
	add	[operand_size],2
1921
	lods	byte [esi]
1907
	lods	byte [esi]
Line 2089... Line 2075...
2089
	push	edx ebx ecx
2075
	push	edx ebx ecx
2090
	lods	byte [esi]
2076
	lods	byte [esi]
2091
	cmp	al,','
2077
	cmp	al,','
2092
	jne	invalid_operand
2078
	jne	invalid_operand
2093
	lods	byte [esi]
2079
	call	take_register
2094
	call	get_size_operator
-
 
2095
	cmp	al,10h
-
 
2096
	jne	invalid_operand
-
 
2097
	lods	byte [esi]
-
 
2098
	call	convert_register
-
 
2099
	mov	[postbyte_register],al
2080
	mov	[postbyte_register],al
2100
	lods	byte [esi]
2081
	lods	byte [esi]
2101
	cmp	al,','
2082
	cmp	al,','
2102
	jne	invalid_operand
2083
	jne	invalid_operand
2103
	mov	al,ah
2084
	mov	al,ah
2104
	mov	[operand_size],0
2085
	mov	[operand_size],0
Line 2135... Line 2116...
2135
	mov	[postbyte_register],al
2116
	mov	[postbyte_register],al
2136
	lods	byte [esi]
2117
	lods	byte [esi]
2137
	cmp	al,','
2118
	cmp	al,','
2138
	jne	invalid_operand
2119
	jne	invalid_operand
2139
	lods	byte [esi]
2120
	call	take_register
2140
	call	get_size_operator
-
 
2141
	cmp	al,10h
-
 
2142
	jne	invalid_operand
-
 
2143
	lods	byte [esi]
-
 
2144
	call	convert_register
-
 
2145
	mov	bl,[postbyte_register]
2121
	mov	bl,[postbyte_register]
2146
	mov	[postbyte_register],al
2122
	mov	[postbyte_register],al
2147
	mov	al,ah
2123
	mov	al,ah
2148
	push	eax ebx
2124
	push	eax ebx
2149
	lods	byte [esi]
2125
	lods	byte [esi]
2150
	cmp	al,','
2126
	cmp	al,','
Line 2180... Line 2156...
2180
	jmp	instruction_assembled
2156
	jmp	instruction_assembled
2181
movx_instruction:
2157
movx_instruction:
2182
	mov	[base_code],0Fh
2158
	mov	[base_code],0Fh
2183
	mov	[extended_code],al
2159
	mov	[extended_code],al
2184
	lods	byte [esi]
2160
	call	take_register
2185
	call	get_size_operator
-
 
2186
	cmp	al,10h
-
 
2187
	jne	invalid_operand
-
 
2188
	lods	byte [esi]
-
 
2189
	call	convert_register
-
 
2190
	mov	[postbyte_register],al
2161
	mov	[postbyte_register],al
2191
	mov	al,ah
2162
	mov	al,ah
2192
	push	eax
2163
	push	eax
2193
	lods	byte [esi]
2164
	lods	byte [esi]
2194
	cmp	al,','
2165
	cmp	al,','
2195
	jne	invalid_operand
2166
	jne	invalid_operand
Line 2238... Line 2209...
2238
	inc	[extended_code]
2209
	inc	[extended_code]
2239
	jmp	nomem_instruction_ready
2210
	jmp	nomem_instruction_ready
2240
movsxd_instruction:
2211
movsxd_instruction:
2241
	mov	[base_code],al
2212
	mov	[base_code],al
2242
	lods	byte [esi]
2213
	call	take_register
2243
	call	get_size_operator
-
 
2244
	cmp	al,10h
-
 
2245
	jne	invalid_operand
-
 
2246
	lods	byte [esi]
-
 
2247
	call	convert_register
-
 
2248
	mov	[postbyte_register],al
2214
	mov	[postbyte_register],al
2249
	cmp	ah,8
2215
	cmp	ah,8
2250
	jne	invalid_operand_size
2216
	jne	invalid_operand_size
2251
	lods	byte [esi]
2217
	lods	byte [esi]
2252
	cmp	al,','
2218
	cmp	al,','
2253
	jne	invalid_operand
2219
	jne	invalid_operand
Line 2297... Line 2263...
2297
	jne	bt_mem_reg
2263
	jne	bt_mem_reg
2298
	cmp	byte [esi+2],'('
2264
	cmp	byte [esi+2],'('
2299
	je	bt_mem_imm
2265
	je	bt_mem_imm
2300
      bt_mem_reg:
2266
      bt_mem_reg:
2301
	lods	byte [esi]
2267
	call	take_register
2302
	call	get_size_operator
-
 
2303
	cmp	al,10h
-
 
2304
	jne	invalid_operand
-
 
2305
	lods	byte [esi]
-
 
2306
	call	convert_register
-
 
2307
	mov	[postbyte_register],al
2268
	mov	[postbyte_register],al
2308
	pop	ecx ebx edx
2269
	pop	ecx ebx edx
2309
	mov	al,ah
2270
	mov	al,ah
2310
	call	operand_autodetect
2271
	call	operand_autodetect
2311
	jmp	instruction_ready
2272
	jmp	instruction_ready
2312
      bt_mem_imm:
2273
      bt_mem_imm:
Line 2350... Line 2311...
2350
	jne	bt_reg_reg
2311
	jne	bt_reg_reg
2351
	cmp	byte [esi+2],'('
2312
	cmp	byte [esi+2],'('
2352
	je	bt_reg_imm
2313
	je	bt_reg_imm
2353
      bt_reg_reg:
2314
      bt_reg_reg:
2354
	lods	byte [esi]
2315
	call	take_register
2355
	call	get_size_operator
-
 
2356
	cmp	al,10h
-
 
2357
	jne	invalid_operand
-
 
2358
	lods	byte [esi]
-
 
2359
	call	convert_register
-
 
2360
	mov	[postbyte_register],al
2316
	mov	[postbyte_register],al
2361
	mov	al,ah
2317
	mov	al,ah
2362
	call	operand_autodetect
2318
	call	operand_autodetect
2363
	jmp	nomem_instruction_ready
2319
	jmp	nomem_instruction_ready
2364
      bt_reg_imm:
2320
      bt_reg_imm:
2365
	xor	al,al
2321
	xor	al,al
Line 2397... Line 2353...
2397
	mov	al,ah
2353
	mov	al,ah
2398
	call	operand_autodetect
2354
	call	operand_autodetect
2399
	jmp	nomem_instruction_ready
2355
	jmp	nomem_instruction_ready
2400
      get_reg_mem:
2356
      get_reg_mem:
2401
	lods	byte [esi]
2357
	call	take_register
2402
	call	get_size_operator
-
 
2403
	cmp	al,10h
-
 
2404
	jne	invalid_operand
-
 
2405
	lods	byte [esi]
-
 
2406
	call	convert_register
-
 
2407
	mov	[postbyte_register],al
2358
	mov	[postbyte_register],al
2408
	lods	byte [esi]
2359
	lods	byte [esi]
2409
	cmp	al,','
2360
	cmp	al,','
2410
	jne	invalid_operand
2361
	jne	invalid_operand
2411
	lods	byte [esi]
2362
	lods	byte [esi]
2412
	call	get_size_operator
2363
	call	get_size_operator
Line 2633... Line 2584...
2633
	mov	al,dl
2584
	mov	al,dl
2634
	stos	byte [edi]
2585
	stos	byte [edi]
2635
	jmp	instruction_assembled
2586
	jmp	instruction_assembled
2636
in_instruction:
2587
in_instruction:
2637
	lods	byte [esi]
2588
	call	take_register
2638
	call	get_size_operator
-
 
2639
	cmp	al,10h
-
 
2640
	jne	invalid_operand
-
 
2641
	lods	byte [esi]
-
 
2642
	call	convert_register
-
 
2643
	or	al,al
2589
	or	al,al
2644
	jnz	invalid_operand
2590
	jnz	invalid_operand
2645
	lods	byte [esi]
2591
	lods	byte [esi]
2646
	cmp	al,','
2592
	cmp	al,','
2647
	jne	invalid_operand
2593
	jne	invalid_operand
2648
	mov	al,ah
2594
	mov	al,ah
Line 2668... Line 2614...
2668
	jne	invalid_operand_size
2614
	jne	invalid_operand_size
2669
      in_ax_dx:
2615
      in_ax_dx:
2670
	call	operand_autodetect
2616
	call	operand_autodetect
2671
	mov	[base_code],0EDh
2617
	mov	[base_code],0EDh
2672
	call	store_instruction_code
2618
	call	store_classic_instruction_code
2673
	jmp	instruction_assembled
2619
	jmp	instruction_assembled
2674
      in_al_dx:
2620
      in_al_dx:
2675
	mov	al,0ECh
2621
	mov	al,0ECh
2676
	stos	byte [edi]
2622
	stos	byte [edi]
2677
	jmp	instruction_assembled
2623
	jmp	instruction_assembled
2678
      in_imm:
2624
      in_imm:
Line 2693... Line 2639...
2693
	jne	invalid_operand_size
2639
	jne	invalid_operand_size
2694
      in_ax_imm:
2640
      in_ax_imm:
2695
	call	operand_autodetect
2641
	call	operand_autodetect
2696
	mov	[base_code],0E5h
2642
	mov	[base_code],0E5h
2697
	call	store_instruction_code
2643
	call	store_classic_instruction_code
2698
	mov	al,dl
2644
	mov	al,dl
2699
	stos	byte [edi]
2645
	stos	byte [edi]
2700
	jmp	instruction_assembled
2646
	jmp	instruction_assembled
2701
      in_al_imm:
2647
      in_al_imm:
2702
	mov	al,0E4h
2648
	mov	al,0E4h
2703
	stos	byte [edi]
2649
	stos	byte [edi]
Line 2717... Line 2663...
2717
	lods	byte [esi]
2663
	lods	byte [esi]
2718
	cmp	al,','
2664
	cmp	al,','
2719
	jne	invalid_operand
2665
	jne	invalid_operand
2720
	mov	[operand_size],0
2666
	mov	[operand_size],0
2721
	lods	byte [esi]
2667
	call	take_register
2722
	call	get_size_operator
-
 
2723
	cmp	al,10h
-
 
2724
	jne	invalid_operand
-
 
2725
	lods	byte [esi]
-
 
2726
	call	convert_register
-
 
2727
	or	al,al
2668
	or	al,al
2728
	jnz	invalid_operand
2669
	jnz	invalid_operand
2729
	mov	al,ah
2670
	mov	al,ah
2730
	cmp	al,1
2671
	cmp	al,1
2731
	je	out_dx_al
2672
	je	out_dx_al
2732
	cmp	al,2
2673
	cmp	al,2
Line 2735... Line 2676...
2735
	jne	invalid_operand_size
2676
	jne	invalid_operand_size
2736
      out_dx_ax:
2677
      out_dx_ax:
2737
	call	operand_autodetect
2678
	call	operand_autodetect
2738
	mov	[base_code],0EFh
2679
	mov	[base_code],0EFh
2739
	call	store_instruction_code
2680
	call	store_classic_instruction_code
2740
	jmp	instruction_assembled
2681
	jmp	instruction_assembled
2741
      out_dx_al:
2682
      out_dx_al:
2742
	mov	al,0EEh
2683
	mov	al,0EEh
2743
	stos	byte [edi]
2684
	stos	byte [edi]
2744
	jmp	instruction_assembled
2685
	jmp	instruction_assembled
2745
      out_imm:
2686
      out_imm:
Line 2754... Line 2695...
2754
	lods	byte [esi]
2695
	lods	byte [esi]
2755
	cmp	al,','
2696
	cmp	al,','
2756
	jne	invalid_operand
2697
	jne	invalid_operand
2757
	mov	[operand_size],0
2698
	mov	[operand_size],0
2758
	lods	byte [esi]
2699
	call	take_register
2759
	call	get_size_operator
-
 
2760
	cmp	al,10h
-
 
2761
	jne	invalid_operand
-
 
2762
	lods	byte [esi]
-
 
2763
	call	convert_register
-
 
2764
	or	al,al
2700
	or	al,al
2765
	jnz	invalid_operand
2701
	jnz	invalid_operand
2766
	mov	al,ah
2702
	mov	al,ah
2767
	cmp	al,1
2703
	cmp	al,1
2768
	je	out_imm_al
2704
	je	out_imm_al
2769
	cmp	al,2
2705
	cmp	al,2
Line 2772... Line 2708...
2772
	jne	invalid_operand_size
2708
	jne	invalid_operand_size
2773
      out_imm_ax:
2709
      out_imm_ax:
2774
	call	operand_autodetect
2710
	call	operand_autodetect
2775
	mov	[base_code],0E7h
2711
	mov	[base_code],0E7h
2776
	call	store_instruction_code
2712
	call	store_classic_instruction_code
2777
	mov	al,dl
2713
	mov	al,dl
2778
	stos	byte [edi]
2714
	stos	byte [edi]
2779
	jmp	instruction_assembled
2715
	jmp	instruction_assembled
2780
      out_imm_al:
2716
      out_imm_al:
2781
	mov	al,0E6h
2717
	mov	al,0E6h
2782
	stos	byte [edi]
2718
	stos	byte [edi]
Line 2795... Line 2731...
2795
	mov	[extended_code],0EAh
2731
	mov	[extended_code],0EAh
2796
      process_jmp:
2732
      process_jmp:
2797
	lods	byte [esi]
2733
	lods	byte [esi]
2798
	call	get_jump_operator
2734
	call	get_jump_operator
2799
	call	get_size_operator
2735
	test	[prefix_flags],10h
-
 
2736
	jz	jmp_type_ok
-
 
2737
	test	[jump_type],not 2
-
 
2738
	jnz	illegal_instruction
-
 
2739
	mov	[jump_type],2
-
 
2740
	and	[prefix_flags],not 10h
-
 
2741
      jmp_type_ok:
-
 
2742
	call	get_size_operator
2800
	cmp	al,'('
2743
	cmp	al,'('
2801
	je	jmp_imm
2744
	je	jmp_imm
2802
	mov	[base_code],0FFh
2745
	mov	[base_code],0FFh
2803
	cmp	al,10h
2746
	cmp	al,10h
2804
	je	jmp_reg
2747
	je	jmp_reg
Line 2940... Line 2883...
2940
	mov	edx,eax
2883
	mov	edx,eax
2941
	sub	edx,3
2884
	sub	edx,3
2942
	jno	jmp_imm_32bit_ok
2885
	jno	jmp_imm_32bit_ok
2943
	cmp	[code_type],64
2886
	cmp	[code_type],64
2944
	je	relative_jump_out_of_range
2887
	je	jump_out_of_range
2945
      jmp_imm_32bit_ok:
2888
      jmp_imm_32bit_ok:
2946
	mov	al,[base_code]
2889
	mov	al,[base_code]
2947
	stos	byte [edi]
2890
	stos	byte [edi]
2948
	mov	eax,edx
2891
	mov	eax,edx
2949
	call	mark_relocation
2892
	call	mark_relocation
2950
	stos	dword [edi]
2893
	stos	dword [edi]
Line 2956... Line 2899...
2956
	call	calculate_jump_offset
2899
	call	calculate_jump_offset
2957
	mov	ecx,edx
2900
	mov	ecx,edx
2958
	cdq
2901
	cdq
2959
	cmp	edx,ecx
2902
	cmp	edx,ecx
2960
	jne	relative_jump_out_of_range
2903
	jne	jump_out_of_range
2961
	call	check_for_short_jump
2904
	call	check_for_short_jump
2962
	jnc	jmp_imm_32bit_store
2905
	jnc	jmp_imm_32bit_store
2963
      jmp_short:
2906
      jmp_short:
2964
	mov	ah,al
2907
	mov	ah,al
2965
	mov	al,0EBh
2908
	mov	al,0EBh
2966
	stos	word [edi]
2909
	stos	word [edi]
Line 3058... Line 3001...
3058
      jmp_far_16bit:
3001
      jmp_far_16bit:
3059
	call	get_word_value
3002
	call	get_word_value
3060
	mov	ebx,eax
3003
	mov	ebx,eax
3061
	call	operand_16bit
3004
	call	operand_16bit
3062
	call	store_instruction_code
3005
	call	store_classic_instruction_code
3063
	mov	ax,bx
3006
	mov	ax,bx
3064
	call	mark_relocation
3007
	call	mark_relocation
3065
	stos	word [edi]
3008
	stos	word [edi]
3066
      jmp_far_segment:
3009
      jmp_far_segment:
3067
	pop	[symbol_identifier] eax
3010
	pop	[symbol_identifier] eax
3068
	mov	[value_type],al
3011
	mov	[value_type],al
Line 3073... Line 3016...
3073
      jmp_far_32bit:
3016
      jmp_far_32bit:
3074
	call	get_dword_value
3017
	call	get_dword_value
3075
	mov	ebx,eax
3018
	mov	ebx,eax
3076
	call	operand_32bit
3019
	call	operand_32bit
3077
	call	store_instruction_code
3020
	call	store_classic_instruction_code
3078
	mov	eax,ebx
3021
	mov	eax,ebx
3079
	call	mark_relocation
3022
	call	mark_relocation
3080
	stos	dword [edi]
3023
	stos	dword [edi]
3081
	jmp	jmp_far_segment
3024
	jmp	jmp_far_segment
3082
conditional_jump:
3025
conditional_jump:
3083
	mov	[base_code],al
3026
	mov	[base_code],al
3084
	lods	byte [esi]
3027
	and	[prefix_flags],not 10h
-
 
3028
	lods	byte [esi]
3085
	call	get_jump_operator
3029
	call	get_jump_operator
3086
	cmp	[jump_type],3
3030
	cmp	[jump_type],3
3087
	je	invalid_operand
3031
	je	invalid_operand
3088
	call	get_size_operator
3032
	call	get_size_operator
3089
	cmp	al,'('
3033
	cmp	al,'('
Line 3120... Line 3064...
3120
	mov	edx,eax
3064
	mov	edx,eax
3121
	sub	edx,4
3065
	sub	edx,4
3122
	jno	conditional_jump_32bit_range_ok
3066
	jno	conditional_jump_32bit_range_ok
3123
	cmp	[code_type],64
3067
	cmp	[code_type],64
3124
	je	relative_jump_out_of_range
3068
	je	jump_out_of_range
3125
      conditional_jump_32bit_range_ok:
3069
      conditional_jump_32bit_range_ok:
3126
	mov	ah,[base_code]
3070
	mov	ah,[base_code]
3127
	add	ah,10h
3071
	add	ah,10h
3128
	mov	al,0Fh
3072
	mov	al,0Fh
3129
	stos	word [edi]
3073
	stos	word [edi]
3130
	mov	eax,edx
3074
	mov	eax,edx
Line 3138... Line 3082...
3138
	call	calculate_jump_offset
3082
	call	calculate_jump_offset
3139
	mov	ecx,edx
3083
	mov	ecx,edx
3140
	cdq
3084
	cdq
3141
	cmp	edx,ecx
3085
	cmp	edx,ecx
3142
	jne	relative_jump_out_of_range
3086
	jne	jump_out_of_range
3143
	call	check_for_short_jump
3087
	call	check_for_short_jump
3144
	jnc	conditional_jump_32bit_store
3088
	jnc	conditional_jump_32bit_store
3145
      conditional_jump_short:
3089
      conditional_jump_short:
3146
	mov	ah,al
3090
	mov	ah,al
3147
	mov	al,[base_code]
3091
	mov	al,[base_code]
3148
	stos	word [edi]
3092
	stos	word [edi]
Line 3243... Line 3187...
3243
	call	calculate_jump_offset
3187
	call	calculate_jump_offset
3244
	mov	ecx,edx
3188
	mov	ecx,edx
3245
	cdq
3189
	cdq
3246
	cmp	edx,ecx
3190
	cmp	edx,ecx
3247
	jne	relative_jump_out_of_range
3191
	jne	jump_out_of_range
3248
	jmp	make_loop_jump
3192
	jmp	make_loop_jump
3249
      loop_jump_16bit:
3193
      loop_jump_16bit:
3250
	call	get_address_word_value
3194
	call	get_address_word_value
3251
	cmp	[code_type],16
3195
	cmp	[code_type],16
3252
	je	loop_jump_16bit_prefix_ok
3196
	je	loop_jump_16bit_prefix_ok
3253
	mov	byte [edi],66h
3197
	mov	byte [edi],66h
Line 3645... Line 3589...
3645
	jmp	instruction_ready
3589
	jmp	instruction_ready
3646
lar_instruction:
3590
lar_instruction:
3647
	mov	[extended_code],al
3591
	mov	[extended_code],al
3648
	mov	[base_code],0Fh
3592
	mov	[base_code],0Fh
3649
	lods	byte [esi]
3593
	call	take_register
3650
	call	get_size_operator
-
 
3651
	cmp	al,10h
-
 
3652
	jne	invalid_operand
-
 
3653
	lods	byte [esi]
-
 
3654
	call	convert_register
-
 
3655
	mov	[postbyte_register],al
3594
	mov	[postbyte_register],al
3656
	lods	byte [esi]
3595
	lods	byte [esi]
3657
	cmp	al,','
3596
	cmp	al,','
3658
	jne	invalid_operand
3597
	jne	invalid_operand
3659
	xor	al,al
3598
	xor	al,al
3660
	xchg	al,[operand_size]
3599
	xchg	al,[operand_size]
Line 3692... Line 3631...
3692
	jmp	instruction_ready
3631
	jmp	instruction_ready
3693
swapgs_instruction:
3632
swapgs_instruction:
3694
	cmp	[code_type],64
3633
	cmp	[code_type],64
3695
	jne	illegal_instruction
3634
	jne	illegal_instruction
3696
rdtscp_instruction:
3635
simple_instruction_0f_01:
3697
	mov	[base_code],0Fh
3636
	mov	ah,al
3698
	mov	[extended_code],1
3637
	mov	al,0Fh
3699
	mov	[postbyte_register],7
3638
	stos	byte [edi]
3700
	mov	bl,al
3639
	mov	al,1
3701
	jmp	nomem_instruction_ready
3640
	stos	word [edi]
-
 
3641
	jmp	instruction_assembled
3702
 
3642
 
Line 3703... Line 3643...
3703
basic_486_instruction:
3643
basic_486_instruction:
3704
	mov	[base_code],0Fh
3644
	mov	[base_code],0Fh
3705
	mov	[extended_code],al
3645
	mov	[extended_code],al
3706
	lods	byte [esi]
3646
	lods	byte [esi]
Line 3713... Line 3653...
3713
	push	edx ebx ecx
3653
	push	edx ebx ecx
3714
	lods	byte [esi]
3654
	lods	byte [esi]
3715
	cmp	al,','
3655
	cmp	al,','
3716
	jne	invalid_operand
3656
	jne	invalid_operand
3717
	lods	byte [esi]
3657
	call	take_register
3718
	call	get_size_operator
-
 
3719
	cmp	al,10h
-
 
3720
	jne	invalid_operand
-
 
3721
	lods	byte [esi]
-
 
3722
	call	convert_register
-
 
3723
	mov	[postbyte_register],al
3658
	mov	[postbyte_register],al
3724
	pop	ecx ebx edx
3659
	pop	ecx ebx edx
3725
	mov	al,ah
3660
	mov	al,ah
3726
	cmp	al,1
3661
	cmp	al,1
3727
	je	basic_486_mem_reg_8bit
3662
	je	basic_486_mem_reg_8bit
3728
	call	operand_autodetect
3663
	call	operand_autodetect
Line 3735... Line 3670...
3735
	mov	[postbyte_register],al
3670
	mov	[postbyte_register],al
3736
	lods	byte [esi]
3671
	lods	byte [esi]
3737
	cmp	al,','
3672
	cmp	al,','
3738
	jne	invalid_operand
3673
	jne	invalid_operand
3739
	lods	byte [esi]
3674
	call	take_register
3740
	call	get_size_operator
-
 
3741
	cmp	al,10h
-
 
3742
	jne	invalid_operand
-
 
3743
	lods	byte [esi]
-
 
3744
	call	convert_register
-
 
3745
	mov	bl,[postbyte_register]
3675
	mov	bl,[postbyte_register]
3746
	mov	[postbyte_register],al
3676
	mov	[postbyte_register],al
3747
	mov	al,ah
3677
	mov	al,ah
3748
	cmp	al,1
3678
	cmp	al,1
3749
	je	basic_486_reg_reg_8bit
3679
	je	basic_486_reg_reg_8bit
3750
	call	operand_autodetect
3680
	call	operand_autodetect
3751
	inc	[extended_code]
3681
	inc	[extended_code]
3752
      basic_486_reg_reg_8bit:
3682
      basic_486_reg_reg_8bit:
3753
	jmp	nomem_instruction_ready
3683
	jmp	nomem_instruction_ready
3754
bswap_instruction:
3684
bswap_instruction:
3755
	lods	byte [esi]
3685
	call	take_register
3756
	call	get_size_operator
-
 
3757
	cmp	al,10h
-
 
3758
	jne	invalid_operand
-
 
3759
	lods	byte [esi]
-
 
3760
	call	convert_register
-
 
3761
	test	al,1000b
3686
	test	al,1000b
3762
	jz	bswap_reg_code_ok
3687
	jz	bswap_reg_code_ok
3763
	or	[rex_prefix],41h
3688
	or	[rex_prefix],41h
3764
	and	al,111b
3689
	and	al,111b
3765
      bswap_reg_code_ok:
3690
      bswap_reg_code_ok:
3766
	add	al,0C8h
3691
	add	al,0C8h
Line 3770... Line 3695...
3770
	je	bswap_reg64
3695
	je	bswap_reg64
3771
	cmp	ah,4
3696
	cmp	ah,4
3772
	jne	invalid_operand_size
3697
	jne	invalid_operand_size
3773
	call	operand_32bit
3698
	call	operand_32bit
3774
	call	store_instruction_code
3699
	call	store_classic_instruction_code
3775
	jmp	instruction_assembled
3700
	jmp	instruction_assembled
3776
      bswap_reg64:
3701
      bswap_reg64:
3777
	call	operand_64bit
3702
	call	operand_64bit
3778
	call	store_instruction_code
3703
	call	store_classic_instruction_code
3779
	jmp	instruction_assembled
3704
	jmp	instruction_assembled
3780
cmpxchgx_instruction:
3705
cmpxchgx_instruction:
3781
	mov	[base_code],0Fh
3706
	mov	[base_code],0Fh
3782
	mov	[extended_code],0C7h
3707
	mov	[extended_code],0C7h
3783
	mov	[postbyte_register],al
3708
	mov	[postbyte_register],al
3784
	lods	byte [esi]
3709
	lods	byte [esi]
Line 4319... Line 4244...
4319
	jmp	instruction_assembled
4244
	jmp	instruction_assembled
4320
pmovmskb_instruction:
4245
pmovmskb_instruction:
4321
	mov	[base_code],0Fh
4246
	mov	[base_code],0Fh
4322
	mov	[extended_code],al
4247
	mov	[extended_code],al
4323
	lods	byte [esi]
4248
	call	take_register
4324
	call	get_size_operator
-
 
4325
	cmp	al,10h
-
 
4326
	jne	invalid_operand
-
 
4327
	lods	byte [esi]
-
 
4328
	call	convert_register
-
 
4329
	cmp	ah,4
4249
	cmp	ah,4
4330
	je	pmovmskb_reg_size_ok
4250
	je	pmovmskb_reg_size_ok
4331
	cmp	[code_type],64
4251
	cmp	[code_type],64
4332
	jne	invalid_operand_size
4252
	jne	invalid_operand_size
4333
	cmp	ah,8
4253
	cmp	ah,8
4334
	jnz	invalid_operand_size
4254
	jnz	invalid_operand_size
Line 4466... Line 4386...
4466
	jne	invalid_operand
4386
	jne	invalid_operand
4467
	call	get_address
4387
	call	get_address
4468
	test	[operand_size],not 4
4388
	test	[operand_size],not 4
4469
	jnz	invalid_operand_size
4389
	jnz	invalid_operand_size
4470
	mov	[operand_size],0
4390
	call	get_mmx_source_register
4471
	lods	byte [esi]
-
 
4472
	cmp	al,','
-
 
4473
	jne	invalid_operand
-
 
4474
	lods	byte [esi]
-
 
4475
	call	get_size_operator
-
 
4476
	cmp	al,10h
-
 
4477
	jne	invalid_operand
-
 
4478
	lods	byte [esi]
-
 
4479
	call	convert_mmx_register
-
 
4480
	call	make_mmx_prefix
4391
	jmp	instruction_ready
4481
	mov	[postbyte_register],al
-
 
4482
	jmp	instruction_ready
-
 
4483
      movd_reg:
4392
      movd_reg:
4484
	lods	byte [esi]
4393
	lods	byte [esi]
4485
	cmp	al,0B0h
4394
	cmp	al,0B0h
4486
	jae	movd_mmreg
4395
	jae	movd_mmreg
4487
	call	convert_register
4396
	call	convert_register
4488
	cmp	ah,4
4397
	cmp	ah,4
4489
	jne	invalid_operand_size
4398
	jne	invalid_operand_size
4490
	mov	[operand_size],0
4399
	mov	bl,al
4491
	mov	bl,al
-
 
4492
	lods	byte [esi]
4400
	call	get_mmx_source_register
4493
	cmp	al,','
-
 
4494
	jne	invalid_operand
-
 
4495
	lods	byte [esi]
-
 
4496
	call	get_size_operator
-
 
4497
	cmp	al,10h
-
 
4498
	jne	invalid_operand
-
 
4499
	lods	byte [esi]
-
 
4500
	call	convert_mmx_register
-
 
4501
	mov	[postbyte_register],al
4401
	jmp	nomem_instruction_ready
4502
	call	make_mmx_prefix
-
 
4503
	jmp	nomem_instruction_ready
-
 
4504
      movd_mmreg:
4402
      movd_mmreg:
4505
	mov	[extended_code],6Eh
4403
	mov	[extended_code],6Eh
4506
	call	convert_mmx_register
4404
	call	convert_mmx_register
4507
	call	make_mmx_prefix
4405
	mov	[postbyte_register],al
4508
	mov	[postbyte_register],al
-
 
4509
	mov	[operand_size],0
4406
	call	make_mmx_prefix
-
 
4407
	mov	[operand_size],0
4510
	lods	byte [esi]
4408
	lods	byte [esi]
4511
	cmp	al,','
4409
	cmp	al,','
4512
	jne	invalid_operand
4410
	jne	invalid_operand
4513
	lods	byte [esi]
4411
	lods	byte [esi]
4514
	call	get_size_operator
4412
	call	get_size_operator
Line 4526... Line 4424...
4526
	cmp	ah,4
4424
	cmp	ah,4
4527
	jne	invalid_operand_size
4425
	jne	invalid_operand_size
4528
	mov	bl,al
4426
	mov	bl,al
4529
	jmp	nomem_instruction_ready
4427
	jmp	nomem_instruction_ready
4530
      make_mmx_prefix:
4428
      get_mmx_source_register:
-
 
4429
	mov	[operand_size],0
-
 
4430
	lods	byte [esi]
-
 
4431
	cmp	al,','
-
 
4432
	jne	invalid_operand
-
 
4433
	lods	byte [esi]
-
 
4434
	call	get_size_operator
-
 
4435
	cmp	al,10h
-
 
4436
	jne	invalid_operand
-
 
4437
	lods	byte [esi]
-
 
4438
	call	convert_mmx_register
-
 
4439
	mov	[postbyte_register],al
-
 
4440
      make_mmx_prefix:
4531
	cmp	[vex_required],0
4441
	cmp	[operand_size],16
4532
	jne	mmx_prefix_for_vex
-
 
4533
	cmp	[operand_size],16
-
 
4534
	jne	no_mmx_prefix
4442
	jne	no_mmx_prefix
4535
	mov	[operand_prefix],66h
4443
	mov	[operand_prefix],66h
4536
      no_mmx_prefix:
4444
      no_mmx_prefix:
4537
	ret
4445
	ret
4538
      mmx_prefix_for_vex:
4446
movq_instruction:
4539
	cmp	[operand_size],16
-
 
4540
	jne	invalid_operand
-
 
4541
	mov	[opcode_prefix],66h
-
 
4542
	ret
-
 
4543
movq_instruction:
-
 
4544
	mov	[base_code],0Fh
4447
	mov	[base_code],0Fh
4545
	lods	byte [esi]
4448
	lods	byte [esi]
4546
	call	get_size_operator
4449
	call	get_size_operator
4547
	cmp	al,10h
4450
	cmp	al,10h
4548
	je	movq_reg
4451
	je	movq_reg
Line 4550... Line 4453...
4550
	jne	invalid_operand
4453
	jne	invalid_operand
4551
	call	get_address
4454
	call	get_address
4552
	test	[operand_size],not 8
4455
	test	[operand_size],not 8
4553
	jnz	invalid_operand_size
4456
	jnz	invalid_operand_size
4554
	mov	[operand_size],0
4457
	call	get_mmx_source_register
4555
	lods	byte [esi]
-
 
4556
	cmp	al,','
-
 
4557
	jne	invalid_operand
-
 
4558
	lods	byte [esi]
4458
	mov	al,7Fh
4559
	cmp	al,10h
-
 
4560
	jne	invalid_operand
4459
	cmp	ah,8
4561
	lods	byte [esi]
-
 
4562
	call	convert_mmx_register
-
 
4563
	mov	[postbyte_register],al
-
 
4564
	cmp	ah,16
-
 
4565
	je	movq_mem_xmmreg
4460
	je	movq_mem_ready
4566
	mov	[extended_code],7Fh
4461
	mov	al,0D6h
4567
	jmp	instruction_ready
4462
     movq_mem_ready:
4568
     movq_mem_xmmreg:
-
 
4569
	mov	[extended_code],0D6h
4463
	mov	[extended_code],al
4570
	mov	[opcode_prefix],66h
4464
	jmp	instruction_ready
4571
	jmp	instruction_ready
-
 
4572
     movq_reg:
4465
     movq_reg:
4573
	lods	byte [esi]
4466
	lods	byte [esi]
4574
	cmp	al,0B0h
4467
	cmp	al,0B0h
4575
	jae	movq_mmreg
4468
	jae	movq_mmreg
4576
	call	convert_register
4469
	call	convert_register
4577
	cmp	ah,8
4470
	cmp	ah,8
4578
	jne	invalid_operand_size
4471
	jne	invalid_operand_size
4579
	mov	bl,al
4472
	mov	bl,al
4580
	lods	byte [esi]
4473
	mov	[extended_code],7Eh
4581
	cmp	al,','
-
 
4582
	jne	invalid_operand
-
 
4583
	lods	byte [esi]
-
 
4584
	call	get_size_operator
-
 
4585
	cmp	al,10h
-
 
4586
	jne	invalid_operand
-
 
4587
	mov	[operand_size],0
-
 
4588
	lods	byte [esi]
-
 
4589
	call	convert_mmx_register
-
 
4590
	mov	[postbyte_register],al
-
 
4591
	call	make_mmx_prefix
-
 
4592
	mov	[extended_code],7Eh
-
 
4593
	call	operand_64bit
4474
	call	operand_64bit
4594
	jmp	nomem_instruction_ready
4475
	call	get_mmx_source_register
-
 
4476
	jmp	nomem_instruction_ready
4595
     movq_mmreg:
4477
     movq_mmreg:
4596
	call	convert_mmx_register
4478
	call	convert_mmx_register
4597
	mov	[postbyte_register],al
4479
	mov	[postbyte_register],al
4598
	mov	[extended_code],6Fh
4480
	mov	[extended_code],6Fh
4599
	mov	[mmx_size],ah
4481
	mov	[mmx_size],ah
Line 4609... Line 4491...
4609
	lods	byte [esi]
4491
	lods	byte [esi]
4610
	call	get_size_operator
4492
	call	get_size_operator
4611
	cmp	al,10h
4493
	cmp	al,10h
4612
	je	movq_mmreg_reg
4494
	je	movq_mmreg_reg
4613
	call	get_address
4495
	cmp	al,'['
-
 
4496
	jne	invalid_operand
-
 
4497
	call	get_address
4614
	test	[operand_size],not 8
4498
	test	[operand_size],not 8
4615
	jnz	invalid_operand_size
4499
	jnz	invalid_operand_size
4616
	jmp	instruction_ready
4500
	jmp	instruction_ready
4617
      movq_mmreg_reg:
4501
      movq_mmreg_reg:
4618
	lods	byte [esi]
4502
	lods	byte [esi]
Line 5034... Line 4918...
5034
	mov	[opcode_prefix],66h
4918
	mov	[opcode_prefix],66h
5035
movmskps_instruction:
4919
movmskps_instruction:
5036
	mov	[base_code],0Fh
4920
	mov	[base_code],0Fh
5037
	mov	[extended_code],50h
4921
	mov	[extended_code],50h
5038
	lods	byte [esi]
4922
	call	take_register
5039
	call	get_size_operator
-
 
5040
	cmp	al,10h
-
 
5041
	jne	invalid_operand
-
 
5042
	lods	byte [esi]
-
 
5043
	call	convert_register
-
 
5044
	mov	[postbyte_register],al
4923
	mov	[postbyte_register],al
5045
	cmp	ah,4
4924
	cmp	ah,4
5046
	je	movmskps_reg_ok
4925
	je	movmskps_reg_ok
5047
	cmp	ah,8
4926
	cmp	ah,8
5048
	jne	invalid_operand_size
4927
	jne	invalid_operand_size
5049
	cmp	[code_type],64
4928
	cmp	[code_type],64
Line 5170... Line 5049...
5170
	mov	[mmx_size],8
5049
	mov	[mmx_size],8
5171
      cvt2si_instruction:
5050
      cvt2si_instruction:
5172
	mov	[extended_code],al
5051
	mov	[extended_code],al
5173
	mov	[base_code],0Fh
5052
	mov	[base_code],0Fh
5174
	lods	byte [esi]
5053
	call	take_register
5175
	call	get_size_operator
-
 
5176
	cmp	al,10h
-
 
5177
	jne	invalid_operand
-
 
5178
	lods	byte [esi]
-
 
5179
	call	convert_register
-
 
5180
	mov	[operand_size],0
5054
	mov	[operand_size],0
5181
	cmp	ah,4
5055
	cmp	ah,4
5182
	je	sse_reg
5056
	je	sse_reg
5183
	cmp	ah,8
5057
	cmp	ah,8
5184
	jne	invalid_operand_size
5058
	jne	invalid_operand_size
5185
	call	operand_64bit
5059
	call	operand_64bit
Line 5255... Line 5129...
5255
	jmp	instruction_assembled
5129
	jmp	instruction_assembled
5256
 
5130
 
Line 5257... Line 5131...
5257
sse4_instruction_38_xmm0:
5131
sse4_instruction_38_xmm0:
5258
	mov	[immediate_size],-1
5132
	mov	[immediate_size],-1
-
 
5133
	jmp	sse4_instruction_38
-
 
5134
sse4_instruction_66_38_xmm0:
-
 
5135
	mov	[immediate_size],-1
-
 
5136
sse4_instruction_66_38:
-
 
5137
	mov	[opcode_prefix],66h
5259
sse4_instruction_38:
5138
sse4_instruction_38:
5260
	mov	[mmx_size],16
5139
	mov	[mmx_size],16
5261
	mov	[opcode_prefix],66h
-
 
5262
	mov	[supplemental_code],al
5140
	mov	[supplemental_code],al
5263
	mov	al,38h
5141
	mov	al,38h
5264
	jmp	sse_instruction
5142
	jmp	sse_instruction
5265
sse4_ss_instruction_3a_imm8:
5143
sse4_ss_instruction_66_3a_imm8:
5266
	mov	[immediate_size],1
5144
	mov	[immediate_size],1
5267
	mov	[mmx_size],4
5145
	mov	cl,4
5268
	jmp	sse4_instruction_3a_setup
5146
	jmp	sse4_instruction_66_3a_setup
5269
sse4_sd_instruction_3a_imm8:
5147
sse4_sd_instruction_66_3a_imm8:
5270
	mov	[immediate_size],1
5148
	mov	[immediate_size],1
5271
	mov	[mmx_size],8
5149
	mov	cl,8
5272
	jmp	sse4_instruction_3a_setup
5150
	jmp	sse4_instruction_66_3a_setup
5273
sse4_instruction_3a_imm8:
5151
sse4_instruction_66_3a_imm8:
5274
	mov	[immediate_size],1
5152
	mov	[immediate_size],1
5275
	mov	[mmx_size],16
5153
	mov	cl,16
5276
      sse4_instruction_3a_setup:
5154
      sse4_instruction_66_3a_setup:
5277
	mov	[opcode_prefix],66h
5155
	mov	[opcode_prefix],66h
-
 
5156
      sse4_instruction_3a_setup:
5278
	mov	[supplemental_code],al
5157
	mov	[supplemental_code],al
5279
	mov	al,3Ah
5158
	mov	al,3Ah
-
 
5159
	mov	[mmx_size],cl
5280
	jmp	sse_instruction
5160
	jmp	sse_instruction
-
 
5161
sse4_instruction_3a_imm8:
-
 
5162
	mov	[immediate_size],1
-
 
5163
	mov	cl,16
-
 
5164
	jmp	sse4_instruction_3a_setup
5281
pclmulqdq_instruction:
5165
pclmulqdq_instruction:
5282
	mov	byte [value],al
5166
	mov	byte [value],al
5283
	mov	[mmx_size],16
-
 
5284
	mov	al,44h
5167
	mov	al,44h
-
 
5168
	mov	cl,16
5285
	jmp	sse4_instruction_3a_setup
5169
	jmp	sse4_instruction_66_3a_setup
5286
extractps_instruction:
5170
extractps_instruction:
5287
	mov	[opcode_prefix],66h
-
 
5288
	mov	[base_code],0Fh
-
 
5289
	mov	[extended_code],3Ah
5171
	call	setup_66_0f_3a
5290
	mov	[supplemental_code],17h
-
 
5291
	lods	byte [esi]
5172
	lods	byte [esi]
5292
	call	get_size_operator
5173
	call	get_size_operator
5293
	cmp	al,10h
5174
	cmp	al,10h
5294
	je	extractps_reg
5175
	je	extractps_reg
5295
	cmp	al,'['
5176
	cmp	al,'['
Line 5334... Line 5215...
5334
	cmp	al,4
5215
	cmp	al,4
5335
	je	mmx_nomem_imm8
5216
	je	mmx_nomem_imm8
5336
	cmp	al,8
5217
	cmp	al,8
5337
	jne	invalid_operand_size
5218
	jne	invalid_operand_size
5338
	call	operand_64bit
5219
	cmp	[code_type],64
5339
	jmp	mmx_nomem_imm8
5220
	jne	illegal_instruction
-
 
5221
	jmp	mmx_nomem_imm8
5340
insertps_instruction:
5222
      setup_66_0f_3a:
-
 
5223
	mov	[extended_code],3Ah
-
 
5224
	mov	[supplemental_code],al
-
 
5225
	mov	[base_code],0Fh
-
 
5226
	mov	[opcode_prefix],66h
-
 
5227
	ret
-
 
5228
insertps_instruction:
5341
	lods	byte [esi]
5229
	call	setup_66_0f_3a
-
 
5230
	lods	byte [esi]
5342
	call	get_size_operator
5231
	call	get_size_operator
5343
	cmp	al,10h
5232
	cmp	al,10h
5344
	jne	invalid_operand
5233
	jne	invalid_operand
5345
	lods	byte [esi]
5234
	lods	byte [esi]
5346
	call	convert_xmm_register
5235
	call	convert_xmm_register
5347
	mov	[postbyte_register],al
5236
	mov	[postbyte_register],al
5348
      insertps_xmmreg:
5237
	mov	[operand_size],0
5349
	mov	[opcode_prefix],66h
-
 
5350
	mov	[base_code],0Fh
-
 
5351
	mov	[extended_code],3Ah
-
 
5352
	mov	[supplemental_code],21h
-
 
5353
	mov	[operand_size],0
-
 
5354
	lods	byte [esi]
5238
	lods	byte [esi]
5355
	cmp	al,','
5239
	cmp	al,','
5356
	jne	invalid_operand
5240
	jne	invalid_operand
5357
	lods	byte [esi]
5241
	lods	byte [esi]
5358
	call	get_size_operator
5242
	call	get_size_operator
Line 5383... Line 5267...
5383
	jmp	pextr_instruction
5267
	jmp	pextr_instruction
5384
pextrb_instruction:
5268
pextrb_instruction:
5385
	mov	[mmx_size],1
5269
	mov	[mmx_size],1
5386
      pextr_instruction:
5270
      pextr_instruction:
5387
	mov	[opcode_prefix],66h
5271
	call	setup_66_0f_3a
5388
	mov	[base_code],0Fh
-
 
5389
	mov	[extended_code],3Ah
-
 
5390
	mov	[supplemental_code],al
5272
	lods	byte [esi]
5391
	lods	byte [esi]
-
 
5392
	call	get_size_operator
5273
	call	get_size_operator
5393
	cmp	al,10h
5274
	cmp	al,10h
5394
	je	pextr_reg
5275
	je	pextr_reg
5395
	cmp	al,'['
5276
	cmp	al,'['
5396
	jne	invalid_operand
5277
	jne	invalid_operand
Line 5461... Line 5342...
5461
      pextr_reg_store:
5342
      pextr_reg_store:
5462
	cmp	bh,16
5343
	cmp	bh,16
5463
	jne	invalid_operand_size
5344
	jne	invalid_operand_size
5464
	xchg	bl,[postbyte_register]
5345
	xchg	bl,[postbyte_register]
5465
	call	operand_autodetect
5346
	jmp	mmx_nomem_imm8
5466
	jmp	mmx_nomem_imm8
-
 
5467
pinsrb_instruction:
5347
pinsrb_instruction:
5468
	mov	[mmx_size],1
5348
	mov	[mmx_size],1
5469
	jmp	pinsr_instruction
5349
	jmp	pinsr_instruction
5470
pinsrd_instruction:
5350
pinsrd_instruction:
5471
	mov	[mmx_size],4
5351
	mov	[mmx_size],4
Line 5473... Line 5353...
5473
pinsrq_instruction:
5353
pinsrq_instruction:
5474
	mov	[mmx_size],8
5354
	mov	[mmx_size],8
5475
	call	operand_64bit
5355
	call	operand_64bit
5476
      pinsr_instruction:
5356
      pinsr_instruction:
5477
	mov	[opcode_prefix],66h
5357
	call	setup_66_0f_3a
5478
	mov	[base_code],0Fh
-
 
5479
	mov	[extended_code],3Ah
-
 
5480
	mov	[supplemental_code],al
5358
	lods	byte [esi]
5481
	lods	byte [esi]
-
 
5482
	call	get_size_operator
5359
	call	get_size_operator
5483
	cmp	al,10h
5360
	cmp	al,10h
5484
	jne	invalid_operand
5361
	jne	invalid_operand
5485
	lods	byte [esi]
5362
	lods	byte [esi]
5486
	call	convert_xmm_register
5363
	call	convert_xmm_register
Line 5533... Line 5410...
5533
	jmp	pmovsx_instruction
5410
	jmp	pmovsx_instruction
5534
pmovsxdq_instruction:
5411
pmovsxdq_instruction:
5535
	mov	[mmx_size],8
5412
	mov	[mmx_size],8
5536
      pmovsx_instruction:
5413
      pmovsx_instruction:
5537
	mov	[opcode_prefix],66h
5414
	call	setup_66_0f_38
5538
	mov	[base_code],0Fh
-
 
5539
	mov	[extended_code],38h
-
 
5540
	mov	[supplemental_code],al
5415
	lods	byte [esi]
5541
	lods	byte [esi]
-
 
5542
	call	get_size_operator
5416
	call	get_size_operator
5543
	cmp	al,10h
5417
	cmp	al,10h
5544
	jne	invalid_operand
5418
	jne	invalid_operand
5545
	lods	byte [esi]
5419
	lods	byte [esi]
5546
	call	convert_xmm_register
5420
	call	convert_xmm_register
Line 5566... Line 5440...
5566
	lods	byte [esi]
5440
	lods	byte [esi]
5567
	call	convert_xmm_register
5441
	call	convert_xmm_register
5568
	mov	bl,al
5442
	mov	bl,al
5569
	jmp	nomem_instruction_ready
5443
	jmp	nomem_instruction_ready
5570
 
5444
      setup_66_0f_38:
-
 
5445
	mov	[extended_code],38h
-
 
5446
	mov	[supplemental_code],al
-
 
5447
	mov	[base_code],0Fh
-
 
5448
	mov	[opcode_prefix],66h
-
 
5449
	ret
-
 
5450
 
Line 5571... Line 5451...
5571
fxsave_instruction_64bit:
5451
fxsave_instruction_64bit:
5572
	call	operand_64bit
5452
	call	operand_64bit
5573
fxsave_instruction:
5453
fxsave_instruction:
5574
	mov	[extended_code],0AEh
5454
	mov	[extended_code],0AEh
Line 5615... Line 5495...
5615
	jmp	instruction_ready
5495
	jmp	instruction_ready
5616
amd_prefetch_instruction:
5496
amd_prefetch_instruction:
5617
	mov	[extended_code],0Dh
5497
	mov	[extended_code],0Dh
5618
	jmp	prefetch_mem_8bit
5498
	jmp	prefetch_mem_8bit
5619
fence_instruction:
5499
clflushopt_instruction:
-
 
5500
	mov	[extended_code],0AEh
-
 
5501
	mov	[opcode_prefix],66h
-
 
5502
	jmp	prefetch_mem_8bit
-
 
5503
pcommit_instruction:
-
 
5504
	mov	byte [edi],66h
-
 
5505
	inc	edi
-
 
5506
fence_instruction:
5620
	mov	bl,al
5507
	mov	bl,al
5621
	mov	ax,0AE0Fh
5508
	mov	ax,0AE0Fh
5622
	stos	word [edi]
5509
	stos	word [edi]
5623
	mov	al,bl
5510
	mov	al,bl
5624
	stos	byte [edi]
5511
	stos	byte [edi]
Line 5700... Line 5587...
5700
	call	get_address
5587
	call	get_address
5701
	lods	byte [esi]
5588
	lods	byte [esi]
5702
	cmp	al,','
5589
	cmp	al,','
5703
	jne	invalid_operand
5590
	jne	invalid_operand
5704
	lods	byte [esi]
5591
	call	take_register
5705
	call	get_size_operator
-
 
5706
	cmp	al,10h
-
 
5707
	jne	invalid_operand
-
 
5708
	lods	byte [esi]
-
 
5709
	call	convert_register
-
 
5710
	cmp	ah,4
5592
	cmp	ah,4
5711
	je	movnti_store
5593
	je	movnti_store
5712
	cmp	ah,8
5594
	cmp	ah,8
5713
	jne	invalid_operand_size
5595
	jne	invalid_operand_size
5714
	call	operand_64bit
5596
	call	operand_64bit
5715
      movnti_store:
5597
      movnti_store:
Line 5720... Line 5602...
5720
	cmp	byte [esi],0
5602
	cmp	byte [esi],0
5721
	je	monitor_instruction_store
5603
	je	monitor_instruction_store
5722
	cmp	byte [esi],0Fh
5604
	cmp	byte [esi],0Fh
5723
	je	monitor_instruction_store
5605
	je	monitor_instruction_store
5724
	lods	byte [esi]
5606
	call	take_register
5725
	call	get_size_operator
-
 
5726
	cmp	al,10h
-
 
5727
	jne	invalid_operand
-
 
5728
	lods	byte [esi]
-
 
5729
	call	convert_register
-
 
5730
	cmp	ax,0400h
5607
	cmp	ax,0400h
5731
	jne	invalid_operand
5608
	jne	invalid_operand
5732
	lods	byte [esi]
5609
	lods	byte [esi]
5733
	cmp	al,','
5610
	cmp	al,','
5734
	jne	invalid_operand
5611
	jne	invalid_operand
5735
	lods	byte [esi]
5612
	call	take_register
5736
	call	get_size_operator
-
 
5737
	cmp	al,10h
-
 
5738
	jne	invalid_operand
-
 
5739
	lods	byte [esi]
-
 
5740
	call	convert_register
-
 
5741
	cmp	ax,0401h
5613
	cmp	ax,0401h
5742
	jne	invalid_operand
5614
	jne	invalid_operand
5743
	cmp	[postbyte_register],0C8h
5615
	cmp	[postbyte_register],0C8h
5744
	jne	monitor_instruction_store
5616
	jne	monitor_instruction_store
5745
	lods	byte [esi]
5617
	lods	byte [esi]
5746
	cmp	al,','
5618
	cmp	al,','
5747
	jne	invalid_operand
5619
	jne	invalid_operand
5748
	lods	byte [esi]
5620
	call	take_register
5749
	call	get_size_operator
-
 
5750
	cmp	al,10h
-
 
5751
	jne	invalid_operand
-
 
5752
	lods	byte [esi]
-
 
5753
	call	convert_register
-
 
5754
	cmp	ax,0402h
5621
	cmp	ax,0402h
5755
	jne	invalid_operand
5622
	jne	invalid_operand
5756
      monitor_instruction_store:
5623
      monitor_instruction_store:
5757
	mov	ax,010Fh
5624
	mov	ax,010Fh
5758
	stos	word [edi]
5625
	stos	word [edi]
5759
	mov	al,[postbyte_register]
5626
	mov	al,[postbyte_register]
5760
	stos	byte [edi]
5627
	stos	byte [edi]
5761
	jmp	instruction_assembled
5628
	jmp	instruction_assembled
5762
movntdqa_instruction:
5629
movntdqa_instruction:
5763
	mov	[opcode_prefix],66h
5630
	call	setup_66_0f_38
5764
	mov	[base_code],0Fh
-
 
5765
	mov	[extended_code],38h
-
 
5766
	mov	[supplemental_code],al
5631
	lods	byte [esi]
5767
	lods	byte [esi]
-
 
5768
	call	get_size_operator
5632
	call	get_size_operator
5769
	cmp	al,10h
5633
	cmp	al,10h
5770
	jne	invalid_operand
5634
	jne	invalid_operand
5771
	lods	byte [esi]
5635
	lods	byte [esi]
5772
	call	convert_xmm_register
5636
	call	convert_xmm_register
Line 5853... Line 5717...
5853
	mov	[opcode_prefix],0F2h
5717
	mov	[opcode_prefix],0F2h
5854
	mov	[base_code],0Fh
5718
	mov	[base_code],0Fh
5855
	mov	[extended_code],38h
5719
	mov	[extended_code],38h
5856
	mov	[supplemental_code],0F0h
5720
	mov	[supplemental_code],0F0h
5857
	lods	byte [esi]
5721
	call	take_register
5858
	call	get_size_operator
-
 
5859
	cmp	al,10h
-
 
5860
	jne	invalid_operand
-
 
5861
	lods	byte [esi]
-
 
5862
	call	convert_register
-
 
5863
	mov	[postbyte_register],al
5722
	mov	[postbyte_register],al
5864
	cmp	ah,8
5723
	cmp	ah,4
5865
	je	crc32_reg64
-
 
5866
	cmp	ah,4
-
 
5867
	jne	invalid_operand
5724
	je	crc32_reg_size_ok
-
 
5725
	cmp	ah,8
-
 
5726
	jne	invalid_operand
5868
	lods	byte [esi]
5727
	cmp	[code_type],64
-
 
5728
	jne	illegal_instruction
-
 
5729
      crc32_reg_size_ok:
-
 
5730
	lods	byte [esi]
5869
	cmp	al,','
5731
	cmp	al,','
5870
	jne	invalid_operand
5732
	jne	invalid_operand
5871
	mov	[operand_size],0
5733
	mov	[operand_size],0
5872
	lods	byte [esi]
5734
	lods	byte [esi]
5873
	call	get_size_operator
5735
	call	get_size_operator
5874
	cmp	al,10h
5736
	cmp	al,10h
5875
	je	crc32_reg32_reg
5737
	je	crc32_reg_reg
5876
	cmp	al,'['
5738
	cmp	al,'['
5877
	jne	invalid_operand
5739
	jne	invalid_operand
5878
	call	get_address
5740
	call	get_address
5879
	mov	al,[operand_size]
5741
	mov	al,[operand_size]
5880
	test	al,al
5742
	test	al,al
5881
	jz	crc32_unknown_size
5743
	jz	crc32_unknown_size
5882
	cmp	al,1
5744
	cmp	al,1
5883
	je	crc32_reg32_mem_store
5745
	je	crc32_reg_mem_store
5884
	cmp	al,4
5746
	inc	[supplemental_code]
5885
	ja	invalid_operand_size
-
 
5886
	inc	[supplemental_code]
-
 
5887
	call	operand_autodetect
5747
	call	operand_autodetect
5888
      crc32_reg32_mem_store:
5748
      crc32_reg_mem_store:
5889
	jmp	instruction_ready
5749
	jmp	instruction_ready
5890
      crc32_unknown_size:
5750
      crc32_unknown_size:
5891
	call	recoverable_unknown_size
5751
	call	recoverable_unknown_size
5892
	jmp	crc32_reg32_mem_store
5752
	jmp	crc32_reg_mem_store
5893
      crc32_reg32_reg:
5753
      crc32_reg_reg:
5894
	lods	byte [esi]
5754
	lods	byte [esi]
5895
	call	convert_register
5755
	call	convert_register
5896
	mov	bl,al
5756
	mov	bl,al
5897
	mov	al,ah
5757
	mov	al,ah
5898
	cmp	al,1
5758
	cmp	al,1
5899
	je	crc32_reg32_reg_store
5759
	je	crc32_reg_reg_store
5900
	cmp	al,4
5760
	inc	[supplemental_code]
5901
	ja	invalid_operand_size
-
 
5902
	inc	[supplemental_code]
-
 
5903
	call	operand_autodetect
5761
	call	operand_autodetect
5904
      crc32_reg32_reg_store:
5762
      crc32_reg_reg_store:
5905
	jmp	nomem_instruction_ready
5763
	jmp	nomem_instruction_ready
5906
      crc32_reg64:
5764
popcnt_instruction:
5907
	lods	byte [esi]
-
 
5908
	cmp	al,','
-
 
5909
	jne	invalid_operand
-
 
5910
	mov	[operand_size],0
-
 
5911
	call	operand_64bit
-
 
5912
	lods	byte [esi]
-
 
5913
	call	get_size_operator
-
 
5914
	cmp	al,10h
-
 
5915
	je	crc32_reg64_reg
-
 
5916
	cmp	al,'['
-
 
5917
	jne	invalid_operand
-
 
5918
	call	get_address
-
 
5919
	mov	ah,[operand_size]
-
 
5920
	mov	al,8
-
 
5921
	test	ah,ah
-
 
5922
	jz	crc32_unknown_size
-
 
5923
	cmp	ah,1
-
 
5924
	je	crc32_reg32_mem_store
-
 
5925
	cmp	ah,al
-
 
5926
	jne	invalid_operand_size
-
 
5927
	inc	[supplemental_code]
-
 
5928
	jmp	crc32_reg32_mem_store
-
 
5929
      crc32_reg64_reg:
-
 
5930
	lods	byte [esi]
-
 
5931
	call	convert_register
-
 
5932
	mov	bl,al
-
 
5933
	mov	al,8
-
 
5934
	cmp	ah,1
-
 
5935
	je	crc32_reg32_reg_store
-
 
5936
	cmp	ah,al
-
 
5937
	jne	invalid_operand_size
-
 
5938
	inc	[supplemental_code]
-
 
5939
	jmp	crc32_reg32_reg_store
-
 
5940
popcnt_instruction:
-
 
5941
	mov	[opcode_prefix],0F3h
5765
	mov	[opcode_prefix],0F3h
5942
	jmp	bs_instruction
5766
	jmp	bs_instruction
5943
movbe_instruction:
5767
movbe_instruction:
5944
	mov	[supplemental_code],al
5768
	mov	[supplemental_code],al
5945
	mov	[extended_code],38h
5769
	mov	[extended_code],38h
Line 5970... Line 5794...
5970
	push	edx ebx ecx
5794
	push	edx ebx ecx
5971
	lods	byte [esi]
5795
	lods	byte [esi]
5972
	cmp	al,','
5796
	cmp	al,','
5973
	jne	invalid_operand
5797
	jne	invalid_operand
5974
	lods	byte [esi]
5798
	call	take_register
5975
	call	get_size_operator
-
 
5976
	cmp	al,10h
-
 
5977
	jne	invalid_operand
-
 
5978
	lods	byte [esi]
-
 
5979
	call	convert_register
-
 
5980
	mov	[postbyte_register],al
5799
	mov	[postbyte_register],al
5981
	pop	ecx ebx edx
5800
	pop	ecx ebx edx
5982
	mov	al,[operand_size]
5801
	mov	al,[operand_size]
5983
	call	operand_autodetect
5802
	call	operand_autodetect
5984
	jmp	instruction_ready
5803
	jmp	instruction_ready
5985
adx_instruction:
5804
adx_instruction:
Line 6003... Line 5822...
6003
	jne	invalid_operand_size
5822
	jne	invalid_operand_size
6004
	call	operand_64bit
5823
	call	operand_64bit
6005
	jmp	nomem_instruction_ready
5824
	jmp	nomem_instruction_ready
6006
 
5825
 
Line 6007... Line -...
6007
simple_vmx_instruction:
-
 
6008
	mov	ah,al
-
 
6009
	mov	al,0Fh
-
 
6010
	stos	byte [edi]
-
 
6011
	mov	al,1
-
 
6012
	stos	word [edi]
-
 
6013
	jmp	instruction_assembled
-
 
6014
vmclear_instruction:
5826
vmclear_instruction:
6015
	mov	[opcode_prefix],66h
5827
	mov	[opcode_prefix],66h
6016
	jmp	vmx_instruction
5828
	jmp	vmx_instruction
6017
vmxon_instruction:
5829
vmxon_instruction:
6018
	mov	[opcode_prefix],0F3h
5830
	mov	[opcode_prefix],0F3h
Line 6043... Line 5855...
6043
	call	get_address
5855
	call	get_address
6044
	lods	byte [esi]
5856
	lods	byte [esi]
6045
	cmp	al,','
5857
	cmp	al,','
6046
	jne	invalid_operand
5858
	jne	invalid_operand
6047
	lods	byte [esi]
5859
	call	take_register
6048
	call	get_size_operator
-
 
6049
	cmp	al,10h
-
 
6050
	jne	invalid_operand
-
 
6051
	lods	byte [esi]
-
 
6052
	call	convert_register
-
 
6053
	mov	[postbyte_register],al
5860
	mov	[postbyte_register],al
6054
	call	vmread_check_size
5861
	call	vmread_check_size
6055
	jmp	vmx_size_ok
5862
	jmp	vmx_size_ok
6056
      vmread_nomem:
5863
      vmread_nomem:
6057
	lods	byte [esi]
5864
	lods	byte [esi]
6058
	call	convert_register
5865
	call	convert_register
Line 6060... Line 5867...
6060
	call	vmread_check_size
5867
	call	vmread_check_size
6061
	lods	byte [esi]
5868
	lods	byte [esi]
6062
	cmp	al,','
5869
	cmp	al,','
6063
	jne	invalid_operand
5870
	jne	invalid_operand
6064
	lods	byte [esi]
5871
	call	take_register
6065
	call	get_size_operator
-
 
6066
	cmp	al,10h
-
 
6067
	jne	invalid_operand
-
 
6068
	lods	byte [esi]
-
 
6069
	call	convert_register
-
 
6070
	mov	[postbyte_register],al
5872
	mov	[postbyte_register],al
6071
	call	vmread_check_size
5873
	call	vmread_check_size
6072
	pop	ebx
5874
	pop	ebx
6073
	mov	[base_code],0Fh
5875
	mov	[base_code],0Fh
6074
	jmp	nomem_instruction_ready
5876
	jmp	nomem_instruction_ready
6075
      vmread_check_size:
5877
      vmread_check_size:
Line 6083... Line 5885...
6083
	jne	invalid_operand_size
5885
	jne	invalid_operand_size
6084
	ret
5886
	ret
6085
vmwrite_instruction:
5887
vmwrite_instruction:
6086
	mov	[extended_code],79h
5888
	mov	[extended_code],79h
6087
	lods	byte [esi]
5889
	call	take_register
6088
	call	get_size_operator
-
 
6089
	cmp	al,10h
-
 
6090
	jne	invalid_operand
-
 
6091
	lods	byte [esi]
-
 
6092
	call	convert_register
-
 
6093
	mov	[postbyte_register],al
5890
	mov	[postbyte_register],al
6094
	lods	byte [esi]
5891
	lods	byte [esi]
6095
	cmp	al,','
5892
	cmp	al,','
6096
	jne	invalid_operand
5893
	jne	invalid_operand
6097
	lods	byte [esi]
5894
	lods	byte [esi]
6098
	call	get_size_operator
5895
	call	get_size_operator
Line 6109... Line 5906...
6109
	mov	bl,al
5906
	mov	bl,al
6110
	mov	[base_code],0Fh
5907
	mov	[base_code],0Fh
6111
	jmp	nomem_instruction_ready
5908
	jmp	nomem_instruction_ready
6112
vmx_inv_instruction:
5909
vmx_inv_instruction:
6113
	mov	[opcode_prefix],66h
5910
	call	setup_66_0f_38
6114
	mov	[extended_code],38h
-
 
6115
	mov	[supplemental_code],al
-
 
6116
	lods	byte [esi]
-
 
6117
	call	get_size_operator
-
 
6118
	cmp	al,10h
5911
	call	take_register
6119
	jne	invalid_operand
-
 
6120
	lods	byte [esi]
-
 
6121
	call	convert_register
-
 
6122
	mov	[postbyte_register],al
5912
	mov	[postbyte_register],al
6123
	call	vmread_check_size
5913
	call	vmread_check_size
6124
	mov	[operand_size],0
5914
	mov	[operand_size],0
6125
	lods	byte [esi]
5915
	lods	byte [esi]
6126
	cmp	al,','
5916
	cmp	al,','
6127
	jne	invalid_operand
5917
	jne	invalid_operand
Line 6139... Line 5929...
6139
simple_svm_instruction:
5929
simple_svm_instruction:
6140
	push	eax
5930
	push	eax
6141
	mov	[base_code],0Fh
5931
	mov	[base_code],0Fh
6142
	mov	[extended_code],1
5932
	mov	[extended_code],1
6143
	lods	byte [esi]
5933
	call	take_register
6144
	call	get_size_operator
-
 
6145
	cmp	al,10h
-
 
6146
	jne	invalid_operand
-
 
6147
	lods	byte [esi]
-
 
6148
	call	convert_register
-
 
6149
	or	al,al
5934
	or	al,al
6150
	jnz	invalid_operand
5935
	jnz	invalid_operand
6151
      simple_svm_detect_size:
5936
      simple_svm_detect_size:
6152
	cmp	ah,2
5937
	cmp	ah,2
6153
	je	simple_svm_16bit
5938
	je	simple_svm_16bit
6154
	cmp	ah,4
5939
	cmp	ah,4
Line 6168... Line 5953...
6168
      prefixed_svm_store:
5953
      prefixed_svm_store:
6169
	mov	al,67h
5954
	mov	al,67h
6170
	stos	byte [edi]
5955
	stos	byte [edi]
6171
      simple_svm_store:
5956
      simple_svm_store:
6172
	call	store_instruction_code
5957
	call	store_classic_instruction_code
6173
	pop	eax
5958
	pop	eax
6174
	stos	byte [edi]
5959
	stos	byte [edi]
6175
	jmp	instruction_assembled
5960
	jmp	instruction_assembled
6176
skinit_instruction:
5961
skinit_instruction:
6177
	lods	byte [esi]
5962
	call	take_register
6178
	call	get_size_operator
-
 
6179
	cmp	al,10h
-
 
6180
	jne	invalid_operand
-
 
6181
	lods	byte [esi]
-
 
6182
	call	convert_register
-
 
6183
	cmp	ax,0400h
5963
	cmp	ax,0400h
6184
	jne	invalid_operand
5964
	jne	invalid_operand
6185
	mov	al,0DEh
5965
	mov	al,0DEh
6186
	jmp	simple_vmx_instruction
5966
	jmp	simple_instruction_0f_01
6187
invlpga_instruction:
5967
invlpga_instruction:
6188
	push	eax
5968
	push	eax
6189
	mov	[base_code],0Fh
5969
	mov	[base_code],0Fh
6190
	mov	[extended_code],1
5970
	mov	[extended_code],1
6191
	lods	byte [esi]
5971
	call	take_register
6192
	call	get_size_operator
-
 
6193
	cmp	al,10h
-
 
6194
	jne	invalid_operand
-
 
6195
	lods	byte [esi]
-
 
6196
	call	convert_register
-
 
6197
	or	al,al
5972
	or	al,al
6198
	jnz	invalid_operand
5973
	jnz	invalid_operand
6199
	mov	bl,ah
5974
	mov	bl,ah
6200
	mov	[operand_size],0
5975
	mov	[operand_size],0
6201
	lods	byte [esi]
5976
	lods	byte [esi]
6202
	cmp	al,','
5977
	cmp	al,','
6203
	jne	invalid_operand
5978
	jne	invalid_operand
6204
	lods	byte [esi]
5979
	call	take_register
6205
	call	get_size_operator
-
 
6206
	cmp	al,10h
-
 
6207
	jne	invalid_operand
-
 
6208
	lods	byte [esi]
-
 
6209
	call	convert_register
-
 
6210
	cmp	ax,0401h
5980
	cmp	ax,0401h
6211
	jne	invalid_operand
5981
	jne	invalid_operand
6212
	mov	ah,bl
5982
	mov	ah,bl
6213
	jmp	simple_svm_detect_size
5983
	jmp	simple_svm_detect_size
6214
 
5984
 
Line 6215... Line 5985...
6215
rdrand_instruction:
5985
rdrand_instruction:
6216
	mov	[base_code],0Fh
5986
	mov	[base_code],0Fh
6217
	mov	[extended_code],0C7h
5987
	mov	[extended_code],0C7h
6218
	mov	[postbyte_register],al
5988
	mov	[postbyte_register],al
6219
	lods	byte [esi]
-
 
6220
	call	get_size_operator
-
 
6221
	cmp	al,10h
-
 
6222
	jne	invalid_operand
-
 
6223
	lods	byte [esi]
-
 
6224
	call	convert_register
5989
	call	take_register
6225
	mov	bl,al
5990
	mov	bl,al
6226
	mov	al,ah
5991
	mov	al,ah
6227
	call	operand_autodetect
5992
	call	operand_autodetect
6228
	jmp	nomem_instruction_ready
5993
	jmp	nomem_instruction_ready
6229
rdfsbase_instruction:
5994
rdfsbase_instruction:
Line 6232... Line 5997...
6232
	mov	[opcode_prefix],0F3h
5997
	mov	[opcode_prefix],0F3h
6233
	mov	[base_code],0Fh
5998
	mov	[base_code],0Fh
6234
	mov	[extended_code],0AEh
5999
	mov	[extended_code],0AEh
6235
	mov	[postbyte_register],al
6000
	mov	[postbyte_register],al
6236
	lods	byte [esi]
6001
	call	take_register
6237
	call	get_size_operator
-
 
6238
	cmp	al,10h
-
 
6239
	jne	invalid_operand
-
 
6240
	lods	byte [esi]
-
 
6241
	call	convert_register
-
 
6242
	mov	bl,al
6002
	mov	bl,al
6243
	mov	al,ah
6003
	mov	al,ah
6244
	cmp	ah,2
6004
	cmp	ah,2
6245
	je	invalid_operand_size
6005
	je	invalid_operand_size
6246
	call	operand_autodetect
6006
	call	operand_autodetect
6247
	jmp	nomem_instruction_ready
6007
	jmp	nomem_instruction_ready
Line 6303... Line 6063...
6303
      xbegin_rel32:
6063
      xbegin_rel32:
6304
	sub	edx,1
6064
	sub	edx,1
6305
	jno	xbegin_rel32_ok
6065
	jno	xbegin_rel32_ok
6306
	cmp	[code_type],64
6066
	cmp	[code_type],64
6307
	je	relative_jump_out_of_range
6067
	je	jump_out_of_range
6308
      xbegin_rel32_ok:
6068
      xbegin_rel32_ok:
6309
	mov	ax,0F8C7h
6069
	mov	ax,0F8C7h
6310
	stos	word [edi]
6070
	stos	word [edi]
6311
	mov	eax,edx
6071
	mov	eax,edx
6312
	stos	dword [edi]
6072
	stos	dword [edi]
6313
	jmp	instruction_assembled
6073
	jmp	instruction_assembled
6314
 
6074
 
Line -... Line 6075...
-
 
6075
bndcl_instruction:
-
 
6076
	mov	ah,0F3h
-
 
6077
	jmp	bndc_instruction
-
 
6078
bndcu_instruction:
-
 
6079
	mov	ah,0F2h
-
 
6080
      bndc_instruction:
-
 
6081
	mov	[opcode_prefix],ah
-
 
6082
	mov	[base_code],0Fh
-
 
6083
	mov	[extended_code],al
-
 
6084
	call	take_bnd_register
-
 
6085
	mov	[postbyte_register],al
-
 
6086
	call	get_bnd_size
-
 
6087
	mov	[operand_size],al
-
 
6088
	lods	byte [esi]
-
 
6089
	cmp	al,','
-
 
6090
	jne	invalid_operand
-
 
6091
	lods	byte [esi]
-
 
6092
	call	get_size_operator
-
 
6093
	cmp	al,'['
-
 
6094
	je	bndc_mem
-
 
6095
	cmp	al,10h
-
 
6096
	jne	invalid_operand
-
 
6097
	lods	byte [esi]
-
 
6098
	call	convert_register
-
 
6099
	mov	bl,al
-
 
6100
	jmp	nomem_instruction_ready
-
 
6101
      bndc_mem:
-
 
6102
	call	get_address_of_required_size
-
 
6103
	jmp	instruction_ready
-
 
6104
bndmov_instruction:
-
 
6105
	mov	[opcode_prefix],66h
-
 
6106
	mov	[base_code],0Fh
-
 
6107
	mov	[extended_code],al
-
 
6108
	call	get_bnd_size
-
 
6109
	shl	al,1
-
 
6110
	mov	[operand_size],al
-
 
6111
	lods	byte [esi]
-
 
6112
	cmp	al,14h
-
 
6113
	je	bndmov_reg
-
 
6114
	call	get_size_operator
-
 
6115
	cmp	al,'['
-
 
6116
	jne	invalid_operand
-
 
6117
	inc	[extended_code]
-
 
6118
	call	get_address_of_required_size
-
 
6119
	lods	byte [esi]
-
 
6120
	cmp	al,','
-
 
6121
	jne	invalid_operand
-
 
6122
	call	take_bnd_register
-
 
6123
	mov	[postbyte_register],al
-
 
6124
	jmp	instruction_ready
-
 
6125
       bndmov_reg:
-
 
6126
	lods	byte [esi]
-
 
6127
	call	convert_bnd_register
-
 
6128
	mov	[postbyte_register],al
-
 
6129
	lods	byte [esi]
-
 
6130
	cmp	al,','
-
 
6131
	jne	invalid_operand
-
 
6132
	lods	byte [esi]
-
 
6133
	cmp	al,14h
-
 
6134
	je	bndmov_reg_reg
-
 
6135
	call	get_size_operator
-
 
6136
	cmp	al,'['
-
 
6137
	jne	invalid_operand
-
 
6138
	call	get_address_of_required_size
-
 
6139
	jmp	instruction_ready
-
 
6140
      bndmov_reg_reg:
-
 
6141
	lods	byte [esi]
-
 
6142
	call	convert_bnd_register
-
 
6143
	mov	bl,al
-
 
6144
	jmp	nomem_instruction_ready
-
 
6145
    take_bnd_register:
-
 
6146
	lods	byte [esi]
-
 
6147
	cmp	al,14h
-
 
6148
	jne	invalid_operand
-
 
6149
	lods	byte [esi]
-
 
6150
    convert_bnd_register:
-
 
6151
	mov	ah,al
-
 
6152
	shr	ah,4
-
 
6153
	cmp	ah,6
-
 
6154
	jne	invalid_operand
-
 
6155
	and	al,1111b
-
 
6156
	ret
-
 
6157
bndmk_instruction:
-
 
6158
	mov	[opcode_prefix],0F3h
-
 
6159
	mov	[base_code],0Fh
-
 
6160
	mov	[extended_code],al
-
 
6161
	call	take_bnd_register
-
 
6162
	mov	[postbyte_register],al
-
 
6163
	lods	byte [esi]
-
 
6164
	cmp	al,','
-
 
6165
	jne	invalid_operand
-
 
6166
	lods	byte [esi]
-
 
6167
	call	get_size_operator
-
 
6168
	cmp	al,'['
-
 
6169
	jne	invalid_operand
-
 
6170
	call	get_bnd_size
-
 
6171
	call	get_address_prefixes
-
 
6172
	call	get_address_component
-
 
6173
	cmp	byte [esi-1],']'
-
 
6174
	je	bndmk_ready
-
 
6175
	lods	byte [esi]
-
 
6176
	cmp	al,','
-
 
6177
	jne	invalid_operand
-
 
6178
	lods	byte [esi]
-
 
6179
	cmp	al,'('
-
 
6180
	jne	invalid_operand
-
 
6181
	or	dl,bl
-
 
6182
	or	dl,[address_sign]
-
 
6183
	or	edx,[address_high]
-
 
6184
	jnz	invalid_address
-
 
6185
	mov	[address_register],bh
-
 
6186
	call	get_address_component
-
 
6187
	lods	byte [esi]
-
 
6188
	cmp	al,']'
-
 
6189
	jne	invalid_operand
-
 
6190
	or	bh,bh
-
 
6191
	jz	bndmk_selected_base
-
 
6192
	cmp	bl,bh
-
 
6193
	je	bndmk_to_index
-
 
6194
	or	bl,bl
-
 
6195
	jnz	invalid_address
-
 
6196
	mov	bl,bh
-
 
6197
      bndmk_to_index:
-
 
6198
	inc	cl
-
 
6199
      bndmk_selected_base:
-
 
6200
	mov	bh,[address_register]
-
 
6201
      bndmk_ready:
-
 
6202
	or	bx,bx
-
 
6203
	jz	instruction_ready
-
 
6204
	cmp	[address_size_declared],0
-
 
6205
	jne	instruction_ready
-
 
6206
	and	ch,not 0Fh
-
 
6207
	jmp	instruction_ready
-
 
6208
    get_bnd_size:
-
 
6209
	mov	al,4
-
 
6210
	cmp	[code_type],64
-
 
6211
	jne	bnd_size_ok
-
 
6212
	add	al,4
-
 
6213
      bnd_size_ok:
-
 
6214
	mov	[address_size],al
-
 
6215
	ret
-
 
6216
    get_address_component:
-
 
6217
	mov	[free_address_range],0
-
 
6218
	call	calculate_address
-
 
6219
	mov	[address_high],edx
-
 
6220
	mov	edx,eax
-
 
6221
	or	bx,bx
-
 
6222
	jz	address_component_ok
-
 
6223
	mov	al,bl
-
 
6224
	or	al,bh
-
 
6225
	shr	al,4
-
 
6226
	cmp	al,[address_size]
-
 
6227
	jne	invalid_address
-
 
6228
      address_component_ok:
-
 
6229
	ret
-
 
6230
bndldx_instruction:
-
 
6231
	mov	[base_code],0Fh
-
 
6232
	mov	[extended_code],al
-
 
6233
	call	take_bnd_register
-
 
6234
	mov	[postbyte_register],al
-
 
6235
	lods	byte [esi]
-
 
6236
	cmp	al,','
-
 
6237
	jne	invalid_operand
-
 
6238
	call	take_bnd_mib
-
 
6239
	jmp	bndmk_ready
-
 
6240
bndstx_instruction:
-
 
6241
	mov	[base_code],0Fh
-
 
6242
	mov	[extended_code],al
-
 
6243
	call	take_bnd_mib
-
 
6244
	lods	byte [esi]
-
 
6245
	cmp	al,','
-
 
6246
	jne	invalid_operand
-
 
6247
	call	take_bnd_register
-
 
6248
	mov	[postbyte_register],al
-
 
6249
	jmp	bndmk_ready
-
 
6250
    take_bnd_mib:
-
 
6251
	lods	byte [esi]
-
 
6252
	cmp	al,'['
-
 
6253
	jne	invalid_operand
-
 
6254
	call	get_bnd_size
-
 
6255
	call	get_address_prefixes
-
 
6256
	call	get_address_component
-
 
6257
	cmp	byte [esi-1],']'
-
 
6258
	je	bnd_mib_ok
-
 
6259
	lods	byte [esi]
-
 
6260
	cmp	al,','
-
 
6261
	jne	invalid_operand
-
 
6262
	lods	byte [esi]
-
 
6263
	cmp	al,'('
-
 
6264
	jne	invalid_operand
-
 
6265
	mov	al,[address_sign]
-
 
6266
	push	eax ebx ecx edx [address_symbol]
-
 
6267
	call	get_address_component
-
 
6268
	lods	byte [esi]
-
 
6269
	cmp	al,']'
-
 
6270
	jne	invalid_operand
-
 
6271
	or	dl,bl
-
 
6272
	or	dl,[address_sign]
-
 
6273
	or	edx,[address_high]
-
 
6274
	jnz	invalid_address
-
 
6275
	mov	[address_register],bh
-
 
6276
	pop	[address_symbol] edx ecx ebx eax
-
 
6277
	mov	[address_sign],al
-
 
6278
	or	bl,bl
-
 
6279
	jz	mib_place_index
-
 
6280
	or	bh,bh
-
 
6281
	jnz	invalid_address
-
 
6282
	cmp	cl,1
-
 
6283
	jne	invalid_address
-
 
6284
	mov	bh,bl
-
 
6285
      mib_place_index:
-
 
6286
	mov	bl,[address_register]
-
 
6287
	xor	cl,cl
-
 
6288
	or	al,al
-
 
6289
	jz	bnd_mib_ok
-
 
6290
	inc	cl
-
 
6291
      bnd_mib_ok:
-
 
6292
	ret
-
 
6293
 
-
 
6294
take_register:
-
 
6295
	lods	byte [esi]
-
 
6296
	call	get_size_operator
-
 
6297
	cmp	al,10h
-
 
6298
	jne	invalid_operand
-
 
6299
	lods	byte [esi]
6315
convert_register:
6300
convert_register:
6316
	mov	ah,al
6301
	mov	ah,al
6317
	shr	ah,4
6302
	shr	ah,4
6318
	and	al,0Fh
6303
	and	al,0Fh
6319
	cmp	ah,8
6304
	cmp	ah,8
Line 6336... Line 6321...
6336
      register_size_ok:
6321
      register_size_ok:
6337
	ret
6322
	ret
6338
      high_byte_register:
6323
      high_byte_register:
6339
	mov	ah,1
6324
	mov	ah,1
6340
	or	[rex_prefix],80h
6325
	or	[rex_prefix],10h
6341
	jmp	match_register_size
6326
	jmp	match_register_size
6342
convert_fpu_register:
6327
convert_fpu_register:
6343
	mov	ah,al
6328
	mov	ah,al
6344
	shr	ah,4
6329
	shr	ah,4
6345
	and	al,111b
6330
	and	al,111b
6346
	cmp	ah,10
6331
	cmp	ah,10
Line 6355... Line 6340...
6355
	and	al,111b
6340
	and	al,111b
6356
	cmp	ah,0Bh
6341
	cmp	ah,0Bh
6357
	jne	invalid_operand
6342
	jne	invalid_operand
6358
	mov	ah,8
6343
	mov	ah,8
6359
	cmp	[vex_required],0
6344
	jmp	match_register_size
6360
	jne	invalid_operand
-
 
6361
	jmp	match_register_size
-
 
6362
      xmm_register:
6345
      xmm_register:
6363
	and	al,0Fh
6346
	and	al,0Fh
6364
	mov	ah,16
6347
	mov	ah,16
6365
	cmp	al,8
6348
	cmp	al,8
6366
	jb	match_register_size
6349
	jb	match_register_size
Line 6379... Line 6362...
6379
	jne	no_size_operator
6362
	jne	no_size_operator
6380
	mov	[size_declared],1
6363
	mov	[size_declared],1
6381
	lods	word [esi]
6364
	lods	word [esi]
6382
	xchg	al,ah
6365
	xchg	al,ah
6383
	mov	[size_override],1
6366
	or	[operand_flags],1
6384
	cmp	ah,[operand_size]
6367
	cmp	ah,[operand_size]
6385
	je	size_operator_ok
6368
	je	size_operator_ok
6386
	cmp	[operand_size],0
6369
	cmp	[operand_size],0
6387
	jne	operand_sizes_do_not_match
6370
	jne	operand_sizes_do_not_match
6388
	mov	[operand_size],ah
6371
	mov	[operand_size],ah
6389
      size_operator_ok:
6372
      size_operator_ok:
Line 6391... Line 6374...
6391
      no_size_operator:
6374
      no_size_operator:
6392
	mov	[size_declared],0
6375
	mov	[size_declared],0
6393
	cmp	al,'['
6376
	cmp	al,'['
6394
	jne	size_operator_ok
6377
	jne	size_operator_ok
6395
	mov	[size_override],0
6378
	and	[operand_flags],not 1
6396
	ret
6379
	ret
6397
get_jump_operator:
6380
get_jump_operator:
6398
	mov	[jump_type],0
6381
	mov	[jump_type],0
6399
	cmp	al,12h
6382
	cmp	al,12h
6400
	jne	jump_operator_ok
6383
	jne	jump_operator_ok
6401
	lods	word [esi]
6384
	lods	word [esi]
Line 6403... Line 6386...
6403
	mov	al,ah
6386
	mov	al,ah
6404
      jump_operator_ok:
6387
      jump_operator_ok:
6405
	ret
6388
	ret
6406
get_address:
6389
get_address:
6407
	mov	[segment_register],0
6390
	and	[address_size],0
6408
	mov	[address_size],0
-
 
6409
	mov	[free_address_range],0
6391
    get_address_of_required_size:
6410
	mov	al,[code_type]
-
 
6411
	shr	al,3
-
 
6412
	mov	[value_size],al
-
 
6413
	mov	al,[esi]
-
 
6414
	and	al,11110000b
-
 
6415
	cmp	al,60h
-
 
6416
	jne	get_size_prefix
-
 
6417
	lods	byte [esi]
-
 
6418
	sub	al,60h
-
 
6419
	mov	[segment_register],al
-
 
6420
	mov	al,[esi]
-
 
6421
	and	al,11110000b
-
 
6422
      get_size_prefix:
-
 
6423
	cmp	al,70h
-
 
6424
	jne	address_size_prefix_ok
-
 
6425
	lods	byte [esi]
6392
	call	get_address_prefixes
6426
	sub	al,70h
-
 
6427
	cmp	al,2
-
 
6428
	jb	invalid_address_size
-
 
6429
	cmp	al,8
-
 
6430
	ja	invalid_address_size
-
 
6431
	mov	[address_size],al
6393
	and	[free_address_range],0
6432
	mov	[value_size],al
6394
	call	calculate_address
6433
      address_size_prefix_ok:
-
 
6434
	call	calculate_address
-
 
6435
	cmp	byte [esi-1],']'
6395
	cmp	byte [esi-1],']'
6436
	jne	invalid_address
6396
	jne	invalid_address
6437
	mov	[address_high],edx
6397
	mov	[address_high],edx
6438
	mov	edx,eax
6398
	mov	edx,eax
6439
	cmp	[code_type],64
6399
	cmp	[address_size_declared],0
6440
	jne	address_ok
6400
	jne	address_ok
6441
	or	bx,bx
6401
	or	bx,bx
6442
	jnz	address_ok
6402
	jnz	clear_address_size
6443
	test	ch,0Fh
6403
	cmp	[code_type],64
6444
	jnz	address_ok
6404
	jne	address_ok
6445
      calculate_relative_address:
6405
      calculate_relative_address:
6446
	mov	edx,[address_symbol]
6406
	mov	edx,[address_symbol]
6447
	mov	[symbol_identifier],edx
6407
	mov	[symbol_identifier],edx
6448
	mov	edx,[address_high]
6408
	mov	edx,[address_high]
6449
	mov	ebp,[addressing_space]
6409
	mov	ebp,[addressing_space]
6450
	call	calculate_relative_offset
6410
	call	calculate_relative_offset
Line 6457... Line 6417...
6457
	mov	edx,eax
6417
	mov	edx,eax
6458
	ror	ecx,16
6418
	ror	ecx,16
6459
	mov	cl,[value_type]
6419
	mov	cl,[value_type]
6460
	rol	ecx,16
6420
	rol	ecx,16
6461
	mov	bx,0FF00h
6421
	mov	bx,9900h
6462
      address_ok:
6422
      clear_address_size:
-
 
6423
	and	ch,not 0Fh
-
 
6424
      address_ok:
6463
	ret
6425
	ret
6464
operand_16bit:
6426
get_address_prefixes:
-
 
6427
	and	[segment_register],0
-
 
6428
	and	[address_size_declared],0
-
 
6429
	mov	al,[code_type]
-
 
6430
	shr	al,3
-
 
6431
	mov	[value_size],al
-
 
6432
	mov	al,[esi]
-
 
6433
	and	al,11110000b
-
 
6434
	cmp	al,60h
-
 
6435
	jne	get_address_size_prefix
-
 
6436
	lods	byte [esi]
-
 
6437
	sub	al,60h
-
 
6438
	mov	[segment_register],al
-
 
6439
	mov	al,[esi]
-
 
6440
	and	al,11110000b
-
 
6441
      get_address_size_prefix:
-
 
6442
	cmp	al,70h
-
 
6443
	jne	address_size_prefix_ok
-
 
6444
	lods	byte [esi]
-
 
6445
	sub	al,70h
-
 
6446
	cmp	al,2
-
 
6447
	jb	invalid_address_size
-
 
6448
	cmp	al,8
-
 
6449
	ja	invalid_address_size
-
 
6450
	mov	[value_size],al
-
 
6451
	or	[address_size_declared],1
-
 
6452
	or	[address_size],al
-
 
6453
	cmp	al,[address_size]
-
 
6454
	jne	invalid_address_size
-
 
6455
      address_size_prefix_ok:
-
 
6456
	ret
-
 
6457
operand_16bit:
6465
	cmp	[code_type],16
6458
	cmp	[code_type],16
6466
	je	size_prefix_ok
6459
	je	size_prefix_ok
6467
	mov	[operand_prefix],66h
6460
	mov	[operand_prefix],66h
6468
	ret
6461
	ret
6469
operand_32bit:
6462
operand_32bit:
Line 6534... Line 6527...
6534
	ret
6527
	ret
6535
store_instruction_code:
6528
store_instruction_code:
6536
	cmp	[vex_required],0
6529
	cmp	[vex_required],0
6537
	jne	store_vex_instruction_code
6530
	jne	store_vex_instruction_code
6538
	mov	al,[operand_prefix]
6531
store_classic_instruction_code:
-
 
6532
	mov	al,[operand_prefix]
6539
	or	al,al
6533
	or	al,al
6540
	jz	operand_prefix_ok
6534
	jz	operand_prefix_ok
6541
	stos	byte [edi]
6535
	stos	byte [edi]
6542
      operand_prefix_ok:
6536
      operand_prefix_ok:
6543
	mov	al,[opcode_prefix]
6537
	mov	al,[opcode_prefix]
Line 6571... Line 6565...
6571
	mov	al,[supplemental_code]
6565
	mov	al,[supplemental_code]
6572
	stos	byte [edi]
6566
	stos	byte [edi]
6573
	ret
6567
	ret
6574
store_nomem_instruction:
6568
store_nomem_instruction:
6575
	test	[postbyte_register],1000b
6569
	test	[postbyte_register],10000b
-
 
6570
	jz	nomem_reg_high_code_ok
-
 
6571
	or	[vex_required],10h
-
 
6572
	and	[postbyte_register],1111b
-
 
6573
      nomem_reg_high_code_ok:
-
 
6574
	test	[postbyte_register],1000b
6576
	jz	nomem_reg_code_ok
6575
	jz	nomem_reg_code_ok
6577
	or	[rex_prefix],44h
6576
	or	[rex_prefix],44h
6578
	and	[postbyte_register],111b
6577
	and	[postbyte_register],111b
6579
      nomem_reg_code_ok:
6578
      nomem_reg_code_ok:
6580
	test	bl,1000b
6579
	test	bl,10000b
-
 
6580
	jz	nomem_rm_high_code_ok
-
 
6581
	or	[rex_prefix],42h
-
 
6582
	or	[vex_required],8
-
 
6583
	and	bl,1111b
-
 
6584
      nomem_rm_high_code_ok:
-
 
6585
	test	bl,1000b
6581
	jz	nomem_rm_code_ok
6586
	jz	nomem_rm_code_ok
6582
	or	[rex_prefix],41h
6587
	or	[rex_prefix],41h
6583
	and	bl,111b
6588
	and	bl,111b
6584
      nomem_rm_code_ok:
6589
      nomem_rm_code_ok:
6585
	call	store_instruction_code
6590
	and	[displacement_compression],0
-
 
6591
	call	store_instruction_code
6586
	mov	al,[postbyte_register]
6592
	mov	al,[postbyte_register]
6587
	shl	al,3
6593
	shl	al,3
6588
	or	al,bl
6594
	or	al,bl
6589
	or	al,11000000b
6595
	or	al,11000000b
6590
	stos	byte [edi]
6596
	stos	byte [edi]
6591
	ret
6597
	ret
6592
store_instruction:
6598
store_instruction:
6593
	mov	[current_offset],edi
6599
	mov	[current_offset],edi
6594
	test	[postbyte_register],1000b
6600
	and	[displacement_compression],0
-
 
6601
	test	[postbyte_register],10000b
-
 
6602
	jz	reg_high_code_ok
-
 
6603
	or	[vex_required],10h
-
 
6604
	and	[postbyte_register],1111b
-
 
6605
      reg_high_code_ok:
-
 
6606
	test	[postbyte_register],1000b
6595
	jz	reg_code_ok
6607
	jz	reg_code_ok
6596
	or	[rex_prefix],44h
6608
	or	[rex_prefix],44h
6597
	and	[postbyte_register],111b
6609
	and	[postbyte_register],111b
6598
      reg_code_ok:
6610
      reg_code_ok:
6599
	cmp	[code_type],64
6611
	cmp	[code_type],64
Line 6615... Line 6627...
6615
	test	[vex_required],4
6627
	test	[vex_required],4
6616
	jnz	address_vsib
6628
	jnz	address_vsib
6617
	or	bx,bx
6629
	or	bx,bx
6618
	jz	address_immediate
6630
	jz	address_immediate
6619
	cmp	bx,0F800h
6631
	cmp	bx,9800h
6620
	je	address_rip_based
6632
	je	address_rip_based
6621
	cmp	bx,0F400h
6633
	cmp	bx,9400h
6622
	je	address_eip_based
6634
	je	address_eip_based
6623
	cmp	bx,0FF00h
6635
	cmp	bx,9900h
6624
	je	address_relative
6636
	je	address_relative
6625
	mov	al,bl
6637
	mov	al,bl
6626
	or	al,bh
6638
	or	al,bh
6627
	and	al,11110000b
6639
	and	al,11110000b
6628
	cmp	al,80h
6640
	cmp	al,80h
6629
	je	postbyte_64bit
6641
	je	postbyte_64bit
Line 6633... Line 6645...
6633
	jne	invalid_address
6645
	jne	invalid_address
6634
	cmp	[code_type],64
6646
	cmp	[code_type],64
6635
	je	invalid_address_size
6647
	je	invalid_address_size
6636
	call	address_16bit_prefix
6648
	call	address_16bit_prefix
6637
	call	store_instruction_code
6649
	test	ch,22h
-
 
6650
	setz	[displacement_compression]
-
 
6651
	call	store_instruction_code
6638
	cmp	bl,bh
6652
	cmp	bl,bh
6639
	jbe	determine_16bit_address
6653
	jbe	determine_16bit_address
6640
	xchg	bl,bh
6654
	xchg	bl,bh
6641
      determine_16bit_address:
6655
      determine_16bit_address:
6642
	cmp	bx,2600h
6656
	cmp	bx,2600h
Line 6688... Line 6702...
6688
	cmp	edx,-8000h
6702
	cmp	edx,-8000h
6689
	jl	value_out_of_range
6703
	jl	value_out_of_range
6690
	or	dx,dx
6704
	or	dx,dx
6691
	jz	address
6705
	jz	address
6692
	cmp	dx,80h
6706
	cmp	[displacement_compression],2
-
 
6707
	ja	address_8bit_value
-
 
6708
	je	address_16bit_value
-
 
6709
	cmp	dx,80h
6693
	jb	address_8bit_value
6710
	jb	address_8bit_value
6694
	cmp	dx,-80h
6711
	cmp	dx,-80h
6695
	jae	address_8bit_value
6712
	jae	address_8bit_value
6696
      address_16bit_value:
6713
      address_16bit_value:
6697
	or	al,10000000b
6714
	or	al,10000000b
Line 6709... Line 6726...
6709
	or	al,cl
6726
	or	al,cl
6710
	stos	byte [edi]
6727
	stos	byte [edi]
6711
	mov	al,dl
6728
	mov	al,dl
6712
	stos	byte [edi]
6729
	stos	byte [edi]
6713
	cmp	dx,80h
6730
	ret
6714
	jge	value_out_of_range
-
 
6715
	cmp	dx,-80h
-
 
6716
	jl	value_out_of_range
-
 
6717
	ret
-
 
6718
      address:
6731
      address:
6719
	cmp	al,110b
6732
	cmp	al,110b
6720
	je	address_8bit_value
6733
	je	address_8bit_value
6721
	mov	cl,[postbyte_register]
6734
	mov	cl,[postbyte_register]
6722
	shl	cl,3
6735
	shl	cl,3
Line 6725... Line 6738...
6725
	ret
6738
	ret
6726
      address_vsib:
6739
      address_vsib:
6727
	mov	al,bl
6740
	mov	al,bl
6728
	shr	al,4
6741
	shr	al,4
6729
	cmp	al,0Ch
6742
	test	al,1
-
 
6743
	jz	vsib_high_code_ok
-
 
6744
	or	[vex_register],10000b
-
 
6745
	or	[vex_required],8
-
 
6746
	xor	al,1
-
 
6747
      vsib_high_code_ok:
-
 
6748
	cmp	al,6
-
 
6749
	je	vsib_index_ok
-
 
6750
	cmp	al,0Ch
6730
	je	vector_index_ok
6751
	jb	invalid_address
6731
	cmp	al,0Dh
-
 
6732
	jne	invalid_address
-
 
6733
      vector_index_ok:
6752
      vsib_index_ok:
6734
	mov	al,bh
6753
	mov	al,bh
6735
	shr	al,4
6754
	shr	al,4
6736
	cmp	al,4
6755
	cmp	al,4
6737
	je	postbyte_32bit
6756
	je	postbyte_32bit
6738
	cmp	[code_type],64
6757
	cmp	[code_type],64
6739
	je	address_prefix_ok
6758
	je	address_prefix_ok
Line 6757... Line 6776...
6757
	test	bl,1000b
6776
	test	bl,1000b
6758
	jz	index_code_ok
6777
	jz	index_code_ok
6759
	or	[rex_prefix],42h
6778
	or	[rex_prefix],42h
6760
      index_code_ok:
6779
      index_code_ok:
6761
	call	store_instruction_code
6780
	test	ch,44h or 88h
-
 
6781
	setz	[displacement_compression]
-
 
6782
	call	store_instruction_code
6762
	or	cl,cl
6783
	or	cl,cl
6763
	jz	only_base_register
6784
	jz	only_base_register
6764
      base_and_index:
6785
      base_and_index:
6765
	mov	al,100b
6786
	mov	al,100b
6766
	xor	ah,ah
6787
	xor	ah,ah
Line 6785... Line 6806...
6785
	or	ah,bl
6806
	or	ah,bl
6786
	and	bh,111b
6807
	and	bh,111b
6787
	or	ah,bh
6808
	or	ah,bh
6788
      sib_ready:
6809
      sib_ready:
6789
	test	ch,44h
6810
	test	ch,44h or 88h
6790
	jnz	sib_address_32bit_value
-
 
6791
	test	ch,88h
-
 
6792
	jnz	sib_address_32bit_value
6811
	jnz	sib_address_32bit_value
6793
	or	ch,ch
6812
	or	ch,ch
6794
	jnz	address_sizes_do_not_agree
6813
	jnz	address_sizes_do_not_agree
6795
	cmp	bh,5
6814
	cmp	bh,5
6796
	je	address_value
6815
	je	address_value
6797
	or	edx,edx
6816
	or	edx,edx
6798
	jz	sib_address
6817
	jz	sib_address
6799
      address_value:
6818
      address_value:
6800
	cmp	edx,80h
6819
	cmp	[displacement_compression],2
-
 
6820
	ja	sib_address_8bit_value
-
 
6821
	je	sib_address_32bit_value
-
 
6822
	cmp	edx,80h
6801
	jb	sib_address_8bit_value
6823
	jb	sib_address_8bit_value
6802
	cmp	edx,-80h
6824
	cmp	edx,-80h
6803
	jae	sib_address_8bit_value
6825
	jnb	sib_address_8bit_value
6804
      sib_address_32bit_value:
6826
      sib_address_32bit_value:
6805
	or	al,10000000b
6827
	or	al,10000000b
6806
	mov	cl,[postbyte_register]
6828
	mov	cl,[postbyte_register]
6807
	shl	cl,3
6829
	shl	cl,3
6808
	or	al,cl
6830
	or	al,cl
6809
	stos	word [edi]
6831
	stos	word [edi]
Line 6815... Line 6837...
6815
	or	al,cl
6837
	or	al,cl
6816
	stos	word [edi]
6838
	stos	word [edi]
6817
	mov	al,dl
6839
	mov	al,dl
6818
	stos	byte [edi]
6840
	stos	byte [edi]
6819
	cmp	edx,80h
6841
	ret
6820
	jge	value_out_of_range
-
 
6821
	cmp	edx,-80h
-
 
6822
	jl	value_out_of_range
-
 
6823
	ret
-
 
6824
      sib_address:
6842
      sib_address:
6825
	mov	cl,[postbyte_register]
6843
	mov	cl,[postbyte_register]
6826
	shl	cl,3
6844
	shl	cl,3
6827
	or	al,cl
6845
	or	al,cl
6828
	stos	word [edi]
6846
	stos	word [edi]
Line 6835... Line 6853...
6835
	mov	cl,[postbyte_register]
6853
	mov	cl,[postbyte_register]
6836
	shl	cl,3
6854
	shl	cl,3
6837
	or	al,cl
6855
	or	al,cl
6838
	stos	word [edi]
6856
	stos	word [edi]
6839
	test	ch,44h
6857
	test	ch,44h or 88h
6840
	jnz	store_address_32bit_value
-
 
6841
	test	ch,88h
-
 
6842
	jnz	store_address_32bit_value
6858
	jnz	store_address_32bit_value
6843
	or	ch,ch
6859
	or	ch,ch
6844
	jnz	invalid_address_size
6860
	jnz	invalid_address_size
6845
	jmp	store_address_32bit_value
6861
	cmp	[displacement_compression],2
-
 
6862
	jbe	store_address_32bit_value
-
 
6863
	mov	edx,[uncompressed_displacement]
-
 
6864
	jmp	store_address_32bit_value
6846
      zero_index_register:
6865
      zero_index_register:
6847
	mov	bl,4
6866
	mov	bl,4
6848
	mov	cl,1
6867
	mov	cl,1
6849
	jmp	base_and_index
6868
	jmp	base_and_index
6850
      only_base_register:
6869
      only_base_register:
6851
	mov	al,bh
6870
	mov	al,bh
6852
	and	al,111b
6871
	and	al,111b
6853
	cmp	al,4
6872
	cmp	al,4
6854
	je	zero_index_register
6873
	je	zero_index_register
6855
	test	ch,44h
6874
	test	ch,44h or 88h
6856
	jnz	simple_address_32bit_value
-
 
6857
	test	ch,88h
-
 
6858
	jnz	simple_address_32bit_value
6875
	jnz	simple_address_32bit_value
6859
	or	ch,ch
6876
	or	ch,ch
6860
	jnz	address_sizes_do_not_agree
6877
	jnz	address_sizes_do_not_agree
6861
	or	edx,edx
6878
	or	edx,edx
6862
	jz	simple_address
6879
	jz	simple_address
6863
	cmp	edx,80h
6880
	cmp	[displacement_compression],2
-
 
6881
	ja	simple_address_8bit_value
-
 
6882
	je	simple_address_32bit_value
-
 
6883
	cmp	edx,80h
6864
	jb	simple_address_8bit_value
6884
	jb	simple_address_8bit_value
6865
	cmp	edx,-80h
6885
	cmp	edx,-80h
6866
	jae	simple_address_8bit_value
6886
	jnb	simple_address_8bit_value
6867
      simple_address_32bit_value:
6887
      simple_address_32bit_value:
6868
	or	al,10000000b
6888
	or	al,10000000b
6869
	mov	cl,[postbyte_register]
6889
	mov	cl,[postbyte_register]
6870
	shl	cl,3
6890
	shl	cl,3
6871
	or	al,cl
6891
	or	al,cl
6872
	stos	byte [edi]
6892
	stos	byte [edi]
Line 6878... Line 6898...
6878
	or	al,cl
6898
	or	al,cl
6879
	stos	byte [edi]
6899
	stos	byte [edi]
6880
	mov	al,dl
6900
	mov	al,dl
6881
	stos	byte [edi]
6901
	stos	byte [edi]
6882
	cmp	edx,80h
6902
	ret
6883
	jge	value_out_of_range
-
 
6884
	cmp	edx,-80h
-
 
6885
	jl	value_out_of_range
-
 
6886
	ret
-
 
6887
      simple_address:
6903
      simple_address:
6888
	cmp	al,5
6904
	cmp	al,5
6889
	je	simple_address_8bit_value
6905
	je	simple_address_8bit_value
6890
	mov	cl,[postbyte_register]
6906
	mov	cl,[postbyte_register]
6891
	shl	cl,3
6907
	shl	cl,3
Line 6894... Line 6910...
6894
	ret
6910
	ret
6895
      address_immediate:
6911
      address_immediate:
6896
	cmp	[code_type],64
6912
	cmp	[code_type],64
6897
	je	address_immediate_sib
6913
	je	address_immediate_sib
6898
	test	ch,44h
6914
	test	ch,44h or 88h
6899
	jnz	address_immediate_32bit
-
 
6900
	test	ch,88h
-
 
6901
	jnz	address_immediate_32bit
6915
	jnz	address_immediate_32bit
6902
	test	ch,22h
6916
	test	ch,22h
6903
	jnz	address_immediate_16bit
6917
	jnz	address_immediate_16bit
6904
	or	ch,ch
6918
	or	ch,ch
6905
	jnz	invalid_address_size
6919
	jnz	invalid_address_size
6906
	cmp	[code_type],16
6920
	cmp	[code_type],16
Line 6986... Line 7000...
6986
	add	eax,edi
7000
	add	eax,edi
6987
	sub	eax,[current_offset]
7001
	sub	eax,[current_offset]
6988
	add	eax,5
7002
	add	eax,5
6989
	sub	edx,eax
7003
	sub	edx,eax
6990
	jo	value_out_of_range
7004
	jno	@f
-
 
7005
	call	recoverable_overflow
6991
	mov	al,101b
7006
      @@:
-
 
7007
	mov	al,101b
6992
	mov	cl,[postbyte_register]
7008
	mov	cl,[postbyte_register]
6993
	shl	cl,3
7009
	shl	cl,3
6994
	or	al,cl
7010
	or	al,cl
6995
	stos	byte [edi]
7011
	stos	byte [edi]
6996
	shr	ecx,16
7012
	shr	ecx,16