Subversion Repositories Kolibri OS

Rev

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

Rev 1115 Rev 1189
Line 42... Line 42...
42
	jmp	instruction_assembled
42
	jmp	instruction_assembled
43
simple_extended_instruction_64bit:
43
simple_extended_instruction_64bit:
44
	cmp	[code_type],64
44
	cmp	[code_type],64
45
	jne	illegal_instruction
45
	jne	illegal_instruction
46
	mov	al,48h
46
	mov	byte [edi],48h
47
	stos	byte [edi]
47
	inc	edi
48
simple_extended_instruction:
48
simple_extended_instruction:
49
	mov	ah,al
49
	mov	ah,al
50
	mov	al,0Fh
50
	mov	al,0Fh
51
	stos	word [edi]
51
	stos	word [edi]
52
	jmp	instruction_assembled
52
	jmp	instruction_assembled
53
prefix_instruction:
53
prefix_instruction:
Line 470... Line 470...
470
	call	address_32bit_prefix
470
	call	address_32bit_prefix
471
	mov	[base_code],0A2h
471
	mov	[base_code],0A2h
472
      store_mov_address32:
472
      store_mov_address32:
473
	call	store_instruction_code
473
	call	store_instruction_code
474
	push	instruction_assembled
474
	call	store_address_32bit_value
475
	jmp	store_address_32bit_value
475
	jmp	instruction_assembled
476
      mov_mem_address16_al:
476
      mov_mem_address16_al:
477
	call	store_segment_prefix_if_necessary
477
	call	store_segment_prefix_if_necessary
478
	call	address_16bit_prefix
478
	call	address_16bit_prefix
479
	mov	[base_code],0A2h
479
	mov	[base_code],0A2h
480
      store_mov_address16:
480
      store_mov_address16:
481
	cmp	[code_type],64
481
	cmp	[code_type],64
Line 490... Line 490...
490
	call	store_segment_prefix_if_necessary
490
	call	store_segment_prefix_if_necessary
491
	mov	[base_code],0A2h
491
	mov	[base_code],0A2h
492
      store_mov_address64:
492
      store_mov_address64:
493
	call	store_instruction_code
493
	call	store_instruction_code
494
	push	instruction_assembled
494
	call	store_address_64bit_value
495
	jmp	store_address_64bit_value
495
	jmp	instruction_assembled
496
      mov_mem_ax:
496
      mov_mem_ax:
497
	test	ch,22h
497
	test	ch,22h
498
	jnz	mov_mem_address16_ax
498
	jnz	mov_mem_address16_ax
499
	test	ch,44h
499
	test	ch,44h
500
	jnz	mov_mem_address32_ax
500
	jnz	mov_mem_address32_ax
501
	test	ch,88h
501
	test	ch,88h
Line 3282... Line 3282...
3282
      loop_jump_64bit:
3282
      loop_jump_64bit:
3283
	cmp	[code_type],64
3283
	cmp	[code_type],64
3284
	jne	invalid_operand_size
3284
	jne	invalid_operand_size
3285
	call	get_address_qword_value
3285
	call	get_address_qword_value
3286
	call	calculate_jump_offset
3286
	call	loop_counter_size
-
 
3287
	call	calculate_jump_offset
3287
	mov	ecx,edx
3288
	mov	ecx,edx
3288
	cdq
3289
	cdq
3289
	cmp	edx,ecx
3290
	cmp	edx,ecx
3290
	jne	value_out_of_range
3291
	jne	value_out_of_range
3291
	jmp	make_loop_jump
3292
	jmp	make_loop_jump
Line 4891... Line 4892...
4891
	je	mmx_imm8
4892
	je	mmx_imm8
4892
	cmp	[immediate_size],-1
4893
	cmp	[immediate_size],-1
4893
	jne	sse_ok
4894
	jne	sse_ok
4894
	call	take_additional_xmm0
4895
	call	take_additional_xmm0
4895
      sse_ok:
4896
	mov	[immediate_size],0
-
 
4897
      sse_ok:
4896
	jmp	instruction_ready
4898
	jmp	instruction_ready
4897
      sse_xmmreg_xmmreg:
4899
      sse_xmmreg_xmmreg:
4898
	cmp	[operand_prefix],66h
4900
	cmp	[operand_prefix],66h
4899
	jne	sse_xmmreg_xmmreg_ok
4901
	jne	sse_xmmreg_xmmreg_ok
4900
	cmp	[extended_code],12h
4902
	cmp	[extended_code],12h
Line 4911... Line 4913...
4911
	je	mmx_nomem_imm8
4913
	je	mmx_nomem_imm8
4912
	cmp	[immediate_size],-1
4914
	cmp	[immediate_size],-1
4913
	jne	sse_nomem_ok
4915
	jne	sse_nomem_ok
4914
	call	take_additional_xmm0
4916
	call	take_additional_xmm0
4915
      sse_nomem_ok:
4917
	mov	[immediate_size],0
-
 
4918
      sse_nomem_ok:
4916
	jmp	nomem_instruction_ready
4919
	jmp	nomem_instruction_ready
4917
      take_additional_xmm0:
4920
      take_additional_xmm0:
4918
	lods	byte [esi]
4921
	cmp	byte [esi],','
4919
	cmp	al,','
4922
	jne	additional_xmm0_ok
4920
	jne	invalid_operand
4923
	inc	esi
4921
	lods	byte [esi]
4924
	lods	byte [esi]
4922
	cmp	al,10h
4925
	cmp	al,10h
4923
	jne	invalid_operand
4926
	jne	invalid_operand
4924
	lods	byte [esi]
4927
	lods	byte [esi]
4925
	call	convert_mmx_register
4928
	call	convert_mmx_register
4926
	cmp	ah,16
4929
	cmp	ah,16
4927
	jne	invalid_operand_size
4930
	jne	invalid_operand_size
4928
	test	al,al
4931
	test	al,al
4929
	jnz	invalid_operand
4932
	jnz	invalid_operand
4930
	ret
4933
      additional_xmm0_ok:
-
 
4934
	ret
4931
 
4935
 
Line 4932... Line 4936...
4932
ps_dq_instruction:
4936
ps_dq_instruction:
4933
	mov	[postbyte_register],al
4937
	mov	[postbyte_register],al
4934
	mov	[opcode_prefix],66h
4938
	mov	[opcode_prefix],66h
Line 5481... Line 5485...
5481
	jne	invalid_operand_size
5485
	jne	invalid_operand_size
5482
	mov	[postbyte_register],al
5486
	mov	[postbyte_register],al
5483
	pop	ebx
5487
	pop	ebx
5484
	mov	al,bh
5488
	mov	al,bh
5485
	cmp	al,8
5489
	cmp	al,4
5486
	je	extractps_store
-
 
5487
	cmp	al,4
-
 
5488
	jne	invalid_operand_size
5490
	je	mmx_nomem_imm8
-
 
5491
	cmp	al,8
-
 
5492
	jne	invalid_operand_size
5489
      extractps_store:
5493
	call	operand_64bit
5490
	call	operand_autodetect
-
 
5491
	jmp	mmx_nomem_imm8
5494
	jmp	mmx_nomem_imm8
5492
insertps_instruction:
5495
insertps_instruction:
5493
	mov	[opcode_prefix],66h
5496
	mov	[opcode_prefix],66h
5494
	mov	[base_code],0Fh
5497
	mov	[base_code],0Fh
5495
	mov	[extended_code],3Ah
5498
	mov	[extended_code],3Ah
5496
	mov	[supplemental_code],21h
5499
	mov	[supplemental_code],21h
Line 5872... Line 5875...
5872
	mov	[postbyte_register],al
5875
	mov	[postbyte_register],al
5873
	jmp	instruction_ready
5876
	jmp	instruction_ready
5874
monitor_instruction:
5877
monitor_instruction:
5875
	mov	[postbyte_register],al
5878
	mov	[postbyte_register],al
5876
	lods	byte [esi]
5879
	cmp	byte [esi],0
-
 
5880
	je	monitor_instruction_store
-
 
5881
	cmp	byte [esi],0Fh
-
 
5882
	je	monitor_instruction_store
-
 
5883
	lods	byte [esi]
5877
	call	get_size_operator
5884
	call	get_size_operator
5878
	cmp	al,10h
5885
	cmp	al,10h
5879
	jne	invalid_operand
5886
	jne	invalid_operand
5880
	lods	byte [esi]
5887
	lods	byte [esi]
5881
	call	convert_register
5888
	call	convert_register
Line 6072... Line 6079...
6072
	lods	byte [esi]
6079
	lods	byte [esi]
6073
	cmp	al,','
6080
	cmp	al,','
6074
	jne	invalid_operand
6081
	jne	invalid_operand
6075
	mov	[operand_size],0
6082
	mov	[operand_size],0
6076
	lods	byte [esi]
6083
	call	operand_64bit
-
 
6084
	lods	byte [esi]
6077
	call	get_size_operator
6085
	call	get_size_operator
6078
	cmp	al,10h
6086
	cmp	al,10h
6079
	je	crc32_reg64_reg
6087
	je	crc32_reg64_reg
6080
	cmp	al,'['
6088
	cmp	al,'['
6081
	jne	invalid_operand
6089
	jne	invalid_operand
Line 6103... Line 6111...
6103
	jmp	crc32_reg32_reg_store
6111
	jmp	crc32_reg32_reg_store
6104
popcnt_instruction:
6112
popcnt_instruction:
6105
	mov	[opcode_prefix],0F3h
6113
	mov	[opcode_prefix],0F3h
6106
	jmp	bs_instruction
6114
	jmp	bs_instruction
6107
 
6115
movbe_instruction:
-
 
6116
	mov	[supplemental_code],al
-
 
6117
	mov	[extended_code],38h
-
 
6118
	mov	[base_code],0Fh
-
 
6119
	lods	byte [esi]
-
 
6120
	call	get_size_operator
-
 
6121
	cmp	al,'['
-
 
6122
	je	movbe_mem
-
 
6123
	cmp	al,10h
-
 
6124
	jne	invalid_operand
-
 
6125
	lods	byte [esi]
-
 
6126
	call	convert_register
-
 
6127
	mov	[postbyte_register],al
-
 
6128
	lods	byte [esi]
-
 
6129
	cmp	al,','
-
 
6130
	jne	invalid_operand
-
 
6131
	lods	byte [esi]
-
 
6132
	call	get_size_operator
-
 
6133
;       cmp     al,10h
-
 
6134
;       je      movbe_reg_reg
-
 
6135
	cmp	al,'['
-
 
6136
	jne	invalid_argument
-
 
6137
	call	get_address
-
 
6138
	mov	al,[operand_size]
-
 
6139
	call	operand_autodetect
-
 
6140
	jmp	instruction_ready
-
 
6141
;      movbe_reg_reg:
-
 
6142
;       lods    byte [esi]
-
 
6143
;       call    convert_register
-
 
6144
;       mov     bl,al
-
 
6145
;       mov     al,ah
-
 
6146
;       call    operand_autodetect
-
 
6147
;       jmp     nomem_instruction_ready
-
 
6148
      movbe_mem:
-
 
6149
	inc	[supplemental_code]
-
 
6150
	call	get_address
-
 
6151
	push	edx ebx ecx
-
 
6152
	lods	byte [esi]
-
 
6153
	cmp	al,','
-
 
6154
	jne	invalid_operand
-
 
6155
	lods	byte [esi]
-
 
6156
	call	get_size_operator
-
 
6157
	cmp	al,10h
-
 
6158
	jne	invalid_operand
-
 
6159
	lods	byte [esi]
-
 
6160
	call	convert_register
-
 
6161
	mov	[postbyte_register],al
-
 
6162
	pop	ecx ebx edx
-
 
6163
	mov	al,[operand_size]
-
 
6164
	call	operand_autodetect
-
 
6165
	jmp	instruction_ready
-
 
6166
 
Line 6108... Line 6167...
6108
simple_vmx_instruction:
6167
simple_vmx_instruction:
6109
	mov	ah,al
6168
	mov	ah,al
6110
	mov	al,0Fh
6169
	mov	al,0Fh
6111
	stos	byte [edi]
6170
	stos	byte [edi]
Line 6703... Line 6762...
6703
      postbyte_64bit:
6762
      postbyte_64bit:
6704
	cmp	[code_type],64
6763
	cmp	[code_type],64
6705
	jne	invalid_address_size
6764
	jne	invalid_address_size
6706
      address_prefix_ok:
6765
      address_prefix_ok:
6707
	test	bh,1000b
6766
	cmp	bl,44h
6708
	jz	base_code_ok
-
 
6709
	or	[rex_prefix],41h
-
 
6710
      base_code_ok:
-
 
6711
	test	bl,1000b
-
 
6712
	jz	index_code_ok
-
 
6713
	or	[rex_prefix],42h
-
 
6714
      index_code_ok:
-
 
6715
	call	store_instruction_code
-
 
6716
	cmp	bl,44h
-
 
6717
	je	swap_base_with_index
6767
	je	swap_base_with_index
6718
	cmp	bl,84h
6768
	cmp	bl,84h
6719
	jne	base_register_ok
6769
	jne	base_register_ok
6720
      swap_base_with_index:
6770
      swap_base_with_index:
6721
	cmp	cl,1
6771
	cmp	cl,1
Line 6725... Line 6775...
6725
	je	invalid_address
6775
	je	invalid_address
6726
	cmp	bl,84h
6776
	cmp	bl,84h
6727
	je	invalid_address
6777
	je	invalid_address
6728
      base_register_ok:
6778
      base_register_ok:
6729
	or	cl,cl
6779
	test	bh,1000b
-
 
6780
	jz	base_code_ok
-
 
6781
	or	[rex_prefix],41h
-
 
6782
      base_code_ok:
-
 
6783
	test	bl,1000b
-
 
6784
	jz	index_code_ok
-
 
6785
	or	[rex_prefix],42h
-
 
6786
      index_code_ok:
-
 
6787
	call	store_instruction_code
-
 
6788
	or	cl,cl
6730
	jz	only_base_register
6789
	jz	only_base_register
6731
      base_and_index:
6790
      base_and_index:
6732
	mov	al,100b
6791
	mov	al,100b
6733
	xor	ah,ah
6792
	xor	ah,ah
6734
	cmp	cl,1
6793
	cmp	cl,1