2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
; flat assembler core
|
|
|
|
; Copyright (c) 1999-2006, Tomasz Grysztar.
|
|
|
|
; All rights reserved.
|
|
|
|
|
|
|
|
simple_instruction_except64:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_instruction_only64:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
jmp simple_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_instruction_16bit_except64:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_instruction_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
jne size_prefix
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
size_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
mov al,66h
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_instruction_32bit_except64:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_instruction_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je size_prefix
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_instruction_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
mov ah,al
|
|
|
|
mov al,48h
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
|
|
|
simple_extended_instruction_64bit:
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
mov al,48h
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_extended_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
mov al,0Fh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
prefix_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
stos byte [edi]
|
|
|
|
or [prefixed_instruction],-1
|
|
|
|
jmp continue_line
|
2006-07-28 17:39:16 +04:00
|
|
|
segment_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
shr ah,4
|
|
|
|
cmp ah,6
|
|
|
|
jne illegal_instruction
|
|
|
|
and al,1111b
|
|
|
|
mov [segment_register],al
|
|
|
|
call store_segment_prefix
|
|
|
|
or [prefixed_instruction],-1
|
|
|
|
jmp continue_line
|
2006-07-28 17:39:16 +04:00
|
|
|
int_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp ah,1
|
|
|
|
ja invalid_operand_size
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
call get_byte_value
|
|
|
|
mov ah,al
|
|
|
|
mov al,0CDh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
iret_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne simple_instruction
|
|
|
|
call operand_64bit
|
|
|
|
jmp simple_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
aa_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
push eax
|
|
|
|
mov bl,10
|
|
|
|
cmp byte [esi],'('
|
|
|
|
jne aa_store
|
|
|
|
inc esi
|
|
|
|
xor al,al
|
|
|
|
xchg al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
ja invalid_operand_size
|
|
|
|
call get_byte_value
|
|
|
|
mov bl,al
|
2006-07-28 17:39:16 +04:00
|
|
|
aa_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [operand_size],0
|
|
|
|
jne invalid_operand
|
|
|
|
pop eax
|
|
|
|
mov ah,bl
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
basic_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je basic_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je basic_mem_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je basic_mem_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je basic_mem_imm_8bit
|
|
|
|
cmp al,2
|
|
|
|
je basic_mem_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je basic_mem_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je basic_mem_imm_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne basic_mem_imm_8bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
|
|
|
mov al,[base_code]
|
|
|
|
shr al,3
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],80h
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call get_word_value
|
|
|
|
mov word [value],ax
|
|
|
|
mov al,[base_code]
|
|
|
|
shr al,3
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [value_type],0
|
|
|
|
jne basic_mem_imm_16bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne basic_mem_imm_16bit_store
|
|
|
|
cmp word [value],80h
|
|
|
|
jb basic_mem_simm_8bit
|
|
|
|
cmp word [value],-80h
|
|
|
|
jae basic_mem_simm_8bit
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm_16bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],81h
|
|
|
|
call store_instruction_with_imm16
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_simm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],83h
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call get_dword_value
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm_32bit_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dword [value],eax
|
|
|
|
mov al,[base_code]
|
|
|
|
shr al,3
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [value_type],0
|
|
|
|
jne basic_mem_imm_32bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne basic_mem_imm_32bit_store
|
|
|
|
cmp dword [value],80h
|
|
|
|
jb basic_mem_simm_8bit
|
|
|
|
cmp dword [value],-80h
|
|
|
|
jae basic_mem_simm_8bit
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],81h
|
|
|
|
call store_instruction_with_imm32
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_mem_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne long_immediate_not_encodable
|
|
|
|
call operand_64bit
|
|
|
|
call get_simm32
|
|
|
|
cmp [value_type],4
|
|
|
|
jae long_immediate_not_encodable
|
|
|
|
jmp basic_mem_imm_32bit_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
get_simm32:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_qword_value
|
|
|
|
mov ecx,edx
|
|
|
|
cdq
|
|
|
|
cmp ecx,edx
|
|
|
|
jne value_out_of_range
|
2006-11-02 17:18:23 +03:00
|
|
|
cmp [value_type],4
|
|
|
|
jne get_simm32_ok
|
|
|
|
mov [value_type],2
|
|
|
|
get_simm32_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je basic_reg_reg
|
|
|
|
cmp al,'('
|
|
|
|
je basic_reg_imm
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je basic_reg_mem_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
add [base_code],3
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
add [base_code],2
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je basic_reg_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je basic_reg_imm_8bit
|
|
|
|
cmp al,2
|
|
|
|
je basic_reg_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je basic_reg_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je basic_reg_imm_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne basic_reg_imm_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp basic_reg_imm_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
mov bl,[base_code]
|
|
|
|
shr bl,3
|
|
|
|
xchg bl,[postbyte_register]
|
|
|
|
or bl,bl
|
|
|
|
jz basic_al_imm
|
|
|
|
mov [base_code],80h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_al_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[base_code]
|
|
|
|
add al,4
|
|
|
|
stos byte [edi]
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call get_word_value
|
|
|
|
mov dx,ax
|
|
|
|
mov bl,[base_code]
|
|
|
|
shr bl,3
|
|
|
|
xchg bl,[postbyte_register]
|
|
|
|
cmp [value_type],0
|
|
|
|
jne basic_reg_imm_16bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne basic_reg_imm_16bit_store
|
|
|
|
cmp dx,80h
|
|
|
|
jb basic_reg_simm_8bit
|
|
|
|
cmp dx,-80h
|
|
|
|
jae basic_reg_simm_8bit
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm_16bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
or bl,bl
|
|
|
|
jz basic_ax_imm
|
|
|
|
mov [base_code],81h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov ax,dx
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_simm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],83h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_ax_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
add [base_code],5
|
|
|
|
call store_instruction_code
|
|
|
|
mov ax,dx
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call get_dword_value
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm_32bit_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov edx,eax
|
|
|
|
mov bl,[base_code]
|
|
|
|
shr bl,3
|
|
|
|
xchg bl,[postbyte_register]
|
|
|
|
cmp [value_type],0
|
|
|
|
jne basic_reg_imm_32bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne basic_reg_imm_32bit_store
|
|
|
|
cmp edx,80h
|
|
|
|
jb basic_reg_simm_8bit
|
|
|
|
cmp edx,-80h
|
|
|
|
jae basic_reg_simm_8bit
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
or bl,bl
|
|
|
|
jz basic_eax_imm
|
|
|
|
mov [base_code],81h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_eax_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
add [base_code],5
|
|
|
|
call store_instruction_code
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_reg_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne long_immediate_not_encodable
|
|
|
|
call operand_64bit
|
|
|
|
call get_simm32
|
|
|
|
cmp [value_type],4
|
|
|
|
jae long_immediate_not_encodable
|
|
|
|
jmp basic_reg_imm_32bit_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
single_operand_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0F6h
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je single_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
single_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je single_mem_8bit
|
|
|
|
jb single_mem_nosize
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
single_mem_nosize:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne single_mem_8bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
single_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
single_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je single_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
single_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],88h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je mov_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je mov_mem_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,60h
|
|
|
|
jb mov_mem_general_reg
|
|
|
|
cmp al,70h
|
|
|
|
jb mov_mem_sreg
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_general_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,1
|
|
|
|
je mov_mem_reg_8bit
|
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
mov al,[postbyte_register]
|
|
|
|
or al,bl
|
|
|
|
or al,bh
|
|
|
|
jz mov_mem_ax
|
|
|
|
inc [base_code]
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,bl
|
|
|
|
or al,bh
|
|
|
|
jz mov_mem_al
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_al:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,22h
|
|
|
|
jnz mov_mem_address16_al
|
|
|
|
test ch,44h
|
|
|
|
jnz mov_mem_address32_al
|
|
|
|
test ch,88h
|
|
|
|
jnz mov_mem_address64_al
|
|
|
|
or ch,ch
|
|
|
|
jnz invalid_address_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je mov_mem_address64_al
|
|
|
|
cmp [code_type],32
|
|
|
|
je mov_mem_address32_al
|
|
|
|
cmp edx,10000h
|
|
|
|
jb mov_mem_address16_al
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_address32_al:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_32bit_prefix
|
|
|
|
mov [base_code],0A2h
|
2006-07-28 17:39:16 +04:00
|
|
|
store_mov_address32:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
push instruction_assembled
|
|
|
|
jmp store_address_32bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_address16_al:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_16bit_prefix
|
|
|
|
mov [base_code],0A2h
|
2006-07-28 17:39:16 +04:00
|
|
|
store_mov_address16:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address
|
|
|
|
call store_instruction_code
|
|
|
|
mov eax,edx
|
|
|
|
stos word [edi]
|
|
|
|
cmp edx,10000h
|
|
|
|
jge value_out_of_range
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_address64_al:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
mov [base_code],0A2h
|
2006-07-28 17:39:16 +04:00
|
|
|
store_mov_address64:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
push instruction_assembled
|
|
|
|
jmp store_address_64bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_ax:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,22h
|
|
|
|
jnz mov_mem_address16_ax
|
|
|
|
test ch,44h
|
|
|
|
jnz mov_mem_address32_ax
|
|
|
|
test ch,88h
|
|
|
|
jnz mov_mem_address64_ax
|
|
|
|
or ch,ch
|
|
|
|
jnz invalid_address_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je mov_mem_address64_ax
|
|
|
|
cmp [code_type],32
|
|
|
|
je mov_mem_address32_ax
|
|
|
|
cmp edx,10000h
|
|
|
|
jb mov_mem_address16_ax
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_address32_ax:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_32bit_prefix
|
|
|
|
mov [base_code],0A3h
|
|
|
|
jmp store_mov_address32
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_address16_ax:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_16bit_prefix
|
|
|
|
mov [base_code],0A3h
|
|
|
|
jmp store_mov_address16
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_address64_ax:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
mov [base_code],0A3h
|
|
|
|
jmp store_mov_address64
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_sreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
sub al,61h
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,[operand_size]
|
|
|
|
or ah,ah
|
|
|
|
jz mov_mem_sreg_store
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_sreg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],8Ch
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je mov_mem_imm_8bit
|
|
|
|
cmp al,2
|
|
|
|
je mov_mem_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je mov_mem_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je mov_mem_imm_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne mov_mem_imm_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp mov_mem_imm_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0C6h
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call get_word_value
|
|
|
|
mov word [value],ax
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0C7h
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm16
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call get_dword_value
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dword [value],eax
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0C7h
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm32
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_mem_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne long_immediate_not_encodable
|
|
|
|
call operand_64bit
|
|
|
|
call get_simm32
|
|
|
|
cmp [value_type],4
|
|
|
|
jae long_immediate_not_encodable
|
|
|
|
jmp mov_mem_imm_32bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
mov ah,al
|
|
|
|
sub ah,10h
|
|
|
|
and ah,al
|
|
|
|
test ah,0F0h
|
|
|
|
jnz mov_sreg
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
je mov_reg_mem
|
|
|
|
cmp al,'('
|
|
|
|
je mov_reg_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
mov ah,al
|
|
|
|
sub ah,10h
|
|
|
|
and ah,al
|
|
|
|
test ah,0F0h
|
|
|
|
jnz mov_reg_sreg
|
|
|
|
call convert_register
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je mov_reg_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_sreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov ah,al
|
|
|
|
and al,1111b
|
|
|
|
mov [postbyte_register],al
|
|
|
|
shr ah,4
|
|
|
|
cmp ah,5
|
|
|
|
je mov_reg_creg
|
|
|
|
cmp ah,7
|
|
|
|
je mov_reg_dreg
|
|
|
|
ja mov_reg_treg
|
|
|
|
dec [postbyte_register]
|
|
|
|
cmp [operand_size],8
|
|
|
|
je mov_reg_sreg64
|
|
|
|
cmp [operand_size],4
|
|
|
|
je mov_reg_sreg32
|
|
|
|
cmp [operand_size],2
|
|
|
|
jne invalid_operand_size
|
|
|
|
call operand_16bit
|
|
|
|
jmp mov_reg_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_sreg64:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
|
|
|
jmp mov_reg_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_sreg32:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_sreg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],8Ch
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_treg:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,9
|
|
|
|
jne invalid_operand
|
|
|
|
mov [extended_code],24h
|
|
|
|
jmp mov_reg_xrx
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_dreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],21h
|
|
|
|
jmp mov_reg_xrx
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_creg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],20h
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_xrx:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
cmp [code_type],64
|
|
|
|
je mov_reg_xrx_64bit
|
|
|
|
cmp [operand_size],4
|
|
|
|
jne invalid_operand_size
|
|
|
|
cmp [postbyte_register],8
|
|
|
|
jne mov_reg_xrx_store
|
|
|
|
cmp [extended_code],20h
|
|
|
|
jne mov_reg_xrx_store
|
|
|
|
mov al,0F0h
|
|
|
|
stos byte [edi]
|
|
|
|
mov [postbyte_register],0
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_xrx_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_xrx_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [operand_size],8
|
|
|
|
jne invalid_operand_size
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je mov_reg_mem_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
mov al,[postbyte_register]
|
|
|
|
or al,bl
|
|
|
|
or al,bh
|
|
|
|
jz mov_ax_mem
|
|
|
|
add [base_code],3
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[postbyte_register]
|
|
|
|
or al,bl
|
|
|
|
or al,bh
|
|
|
|
jz mov_al_mem
|
|
|
|
add [base_code],2
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_al_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,22h
|
|
|
|
jnz mov_al_mem_address16
|
|
|
|
test ch,44h
|
|
|
|
jnz mov_al_mem_address32
|
|
|
|
test ch,88h
|
|
|
|
jnz mov_al_mem_address64
|
|
|
|
or ch,ch
|
|
|
|
jnz invalid_address_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je mov_al_mem_address64
|
|
|
|
cmp [code_type],32
|
|
|
|
je mov_al_mem_address32
|
|
|
|
cmp edx,10000h
|
|
|
|
jb mov_al_mem_address16
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_al_mem_address32:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_32bit_prefix
|
|
|
|
mov [base_code],0A0h
|
|
|
|
jmp store_mov_address32
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_al_mem_address16:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_16bit_prefix
|
|
|
|
mov [base_code],0A0h
|
|
|
|
jmp store_mov_address16
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_al_mem_address64:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
mov [base_code],0A0h
|
|
|
|
jmp store_mov_address64
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_ax_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,22h
|
|
|
|
jnz mov_ax_mem_address16
|
|
|
|
test ch,44h
|
|
|
|
jnz mov_ax_mem_address32
|
|
|
|
test ch,88h
|
|
|
|
jnz mov_ax_mem_address64
|
|
|
|
or ch,ch
|
|
|
|
jnz invalid_address_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je mov_ax_mem_address64
|
|
|
|
cmp [code_type],32
|
|
|
|
je mov_ax_mem_address32
|
|
|
|
cmp edx,10000h
|
|
|
|
jb mov_ax_mem_address16
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_ax_mem_address32:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_32bit_prefix
|
|
|
|
mov [base_code],0A1h
|
|
|
|
jmp store_mov_address32
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_ax_mem_address16:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
call address_16bit_prefix
|
|
|
|
mov [base_code],0A1h
|
|
|
|
jmp store_mov_address16
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_ax_mem_address64:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
mov [base_code],0A1h
|
|
|
|
jmp store_mov_address64
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je mov_reg_imm_8bit
|
|
|
|
cmp al,2
|
|
|
|
je mov_reg_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je mov_reg_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je mov_reg_imm_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne mov_reg_imm_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp mov_reg_imm_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
mov al,0B0h
|
|
|
|
call store_mov_reg_imm_code
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_word_value
|
|
|
|
mov dx,ax
|
|
|
|
call operand_16bit
|
|
|
|
mov al,0B8h
|
|
|
|
call store_mov_reg_imm_code
|
|
|
|
mov ax,dx
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call get_dword_value
|
|
|
|
mov edx,eax
|
|
|
|
mov al,0B8h
|
|
|
|
call store_mov_reg_imm_code
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
|
|
|
call get_qword_value
|
|
|
|
mov ecx,edx
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne mov_reg_imm_64bit_store
|
|
|
|
cmp [value_type],4
|
|
|
|
jae mov_reg_imm_64bit_store
|
|
|
|
cdq
|
|
|
|
cmp ecx,edx
|
|
|
|
je mov_reg_64bit_imm_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_imm_64bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
push eax ecx
|
|
|
|
mov al,0B8h
|
|
|
|
call store_mov_reg_imm_code
|
|
|
|
pop edx eax
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
mov eax,edx
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
store_mov_reg_imm_code:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,[postbyte_register]
|
|
|
|
test ah,1000b
|
|
|
|
jz mov_reg_imm_prefix_ok
|
|
|
|
or [rex_prefix],41h
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_imm_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
and ah,111b
|
|
|
|
add al,ah
|
|
|
|
mov [base_code],al
|
|
|
|
call store_instruction_code
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_reg_64bit_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov edx,eax
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0C7h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_sreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
and al,1111b
|
|
|
|
mov [postbyte_register],al
|
|
|
|
shr ah,4
|
|
|
|
cmp ah,5
|
|
|
|
je mov_creg
|
|
|
|
cmp ah,7
|
|
|
|
je mov_dreg
|
|
|
|
ja mov_treg
|
|
|
|
cmp al,2
|
|
|
|
je illegal_instruction
|
|
|
|
dec [postbyte_register]
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
je mov_sreg_mem
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_sreg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
or ah,ah
|
|
|
|
jz mov_sreg_reg_size_ok
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_sreg_reg_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],8Eh
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_sreg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz mov_sreg_mem_size_ok
|
|
|
|
cmp al,2
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_sreg_mem_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],8Eh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_treg:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,9
|
|
|
|
jne invalid_operand
|
|
|
|
mov [extended_code],26h
|
|
|
|
jmp mov_xrx
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_dreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],23h
|
|
|
|
jmp mov_xrx
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_creg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],22h
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_xrx:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
cmp [code_type],64
|
|
|
|
je mov_xrx_64bit
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
cmp [postbyte_register],8
|
|
|
|
jne mov_xrx_store
|
|
|
|
cmp [extended_code],22h
|
|
|
|
jne mov_xrx_store
|
|
|
|
mov al,0F0h
|
|
|
|
stos byte [edi]
|
|
|
|
mov [postbyte_register],0
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_xrx_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mov_xrx_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cmov_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
je cmov_reg_mem
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
cmov_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cmov_reg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
call operand_autodetect
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],84h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je test_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je test_mem_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je test_mem_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je test_mem_imm_8bit
|
|
|
|
cmp al,2
|
|
|
|
je test_mem_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je test_mem_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je test_mem_imm_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne test_mem_imm_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp test_mem_imm_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0F6h
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call get_word_value
|
|
|
|
mov word [value],ax
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0F7h
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm16
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call get_dword_value
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dword [value],eax
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0F7h
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm32
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_mem_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne long_immediate_not_encodable
|
|
|
|
call operand_64bit
|
|
|
|
call get_simm32
|
|
|
|
cmp [value_type],4
|
|
|
|
jae long_immediate_not_encodable
|
|
|
|
jmp test_mem_imm_32bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
je test_reg_mem
|
|
|
|
cmp al,'('
|
|
|
|
je test_reg_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je test_reg_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je test_reg_imm_8bit
|
|
|
|
cmp al,2
|
|
|
|
je test_reg_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je test_reg_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je test_reg_imm_64bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0F6h
|
|
|
|
or bl,bl
|
|
|
|
jz test_al_imm
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_al_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0A8h
|
|
|
|
call store_instruction_code
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call get_word_value
|
|
|
|
mov dx,ax
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0F7h
|
|
|
|
or bl,bl
|
|
|
|
jz test_ax_imm
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov ax,dx
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_ax_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0A9h
|
|
|
|
call store_instruction_code
|
|
|
|
mov ax,dx
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call get_dword_value
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov edx,eax
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],0
|
|
|
|
mov [base_code],0F7h
|
|
|
|
or bl,bl
|
|
|
|
jz test_eax_imm
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_eax_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0A9h
|
|
|
|
call store_instruction_code
|
|
|
|
mov eax,edx
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne long_immediate_not_encodable
|
|
|
|
call operand_64bit
|
|
|
|
call get_simm32
|
|
|
|
cmp [value_type],4
|
|
|
|
jae long_immediate_not_encodable
|
|
|
|
jmp test_reg_imm_32bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je test_reg_mem_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
test_reg_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],86h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je xchg_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je test_mem_reg
|
|
|
|
jmp invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
je test_reg_mem
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je xchg_reg_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
cmp [postbyte_register],0
|
|
|
|
je xchg_ax_reg
|
|
|
|
or bl,bl
|
|
|
|
jnz xchg_reg_reg_store
|
|
|
|
mov bl,[postbyte_register]
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_ax_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne xchg_ax_reg_ok
|
|
|
|
cmp ah,4
|
|
|
|
jne xchg_ax_reg_ok
|
|
|
|
or bl,bl
|
|
|
|
jz xchg_reg_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_ax_reg_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
test bl,1000b
|
|
|
|
jz xchg_ax_reg_store
|
|
|
|
or [rex_prefix],41h
|
|
|
|
and bl,111b
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_ax_reg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
add bl,90h
|
|
|
|
mov [base_code],bl
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_reg_reg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
xchg_reg_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
push_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [push_size],al
|
2006-07-28 17:39:16 +04:00
|
|
|
push_next:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je push_reg
|
|
|
|
cmp al,'('
|
|
|
|
je push_imm
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
push_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
mov ah,[push_size]
|
|
|
|
cmp al,2
|
|
|
|
je push_mem_16bit
|
|
|
|
cmp al,4
|
|
|
|
je push_mem_32bit
|
|
|
|
cmp al,8
|
|
|
|
je push_mem_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp ah,2
|
|
|
|
je push_mem_16bit
|
|
|
|
cmp ah,4
|
|
|
|
je push_mem_32bit
|
|
|
|
cmp ah,8
|
|
|
|
je push_mem_64bit
|
|
|
|
cmp [error_line],0
|
|
|
|
jne push_mem_store
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp push_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 2
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call operand_16bit
|
|
|
|
jmp push_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_mem_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call operand_32bit
|
|
|
|
jmp push_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_mem_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
push_mem_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0FFh
|
|
|
|
mov [postbyte_register],110b
|
|
|
|
call store_instruction
|
|
|
|
jmp push_done
|
2006-07-28 17:39:16 +04:00
|
|
|
push_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
mov ah,al
|
|
|
|
sub ah,10h
|
|
|
|
and ah,al
|
|
|
|
test ah,0F0h
|
|
|
|
jnz push_sreg
|
|
|
|
call convert_register
|
|
|
|
test al,1000b
|
|
|
|
jz push_reg_ok
|
|
|
|
or [rex_prefix],41h
|
|
|
|
and al,111b
|
2006-07-28 17:39:16 +04:00
|
|
|
push_reg_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
add al,50h
|
|
|
|
mov [base_code],al
|
|
|
|
mov al,ah
|
|
|
|
mov ah,[push_size]
|
|
|
|
cmp al,2
|
|
|
|
je push_reg_16bit
|
|
|
|
cmp al,4
|
|
|
|
je push_reg_32bit
|
|
|
|
cmp al,8
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
push_reg_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
jmp push_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_reg_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call operand_32bit
|
|
|
|
jmp push_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_reg_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 2
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call operand_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
push_reg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
jmp push_done
|
2006-07-28 17:39:16 +04:00
|
|
|
push_sreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov bl,al
|
|
|
|
mov dl,[operand_size]
|
|
|
|
mov dh,[push_size]
|
|
|
|
cmp dl,2
|
|
|
|
je push_sreg16
|
|
|
|
cmp dl,4
|
|
|
|
je push_sreg32
|
|
|
|
cmp dl,8
|
|
|
|
je push_sreg64
|
|
|
|
or dl,dl
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp dh,2
|
|
|
|
je push_sreg16
|
|
|
|
cmp dh,4
|
|
|
|
je push_sreg32
|
|
|
|
cmp dh,8
|
|
|
|
je push_sreg64
|
|
|
|
jmp push_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_sreg16:
|
2006-09-22 19:55:59 +04:00
|
|
|
test dh,not 2
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call operand_16bit
|
|
|
|
jmp push_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_sreg32:
|
2006-09-22 19:55:59 +04:00
|
|
|
test dh,not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call operand_32bit
|
|
|
|
jmp push_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_sreg64:
|
2006-09-22 19:55:59 +04:00
|
|
|
test dh,not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
push_sreg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,bl
|
|
|
|
cmp al,70h
|
|
|
|
jae invalid_operand
|
|
|
|
sub al,61h
|
|
|
|
cmp al,4
|
|
|
|
jae push_sreg_386
|
|
|
|
shl al,3
|
|
|
|
add al,6
|
|
|
|
mov [base_code],al
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
jmp push_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_sreg_386:
|
2006-09-22 19:55:59 +04:00
|
|
|
sub al,4
|
|
|
|
shl al,3
|
|
|
|
add al,0A0h
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
jmp push_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
mov ah,[push_size]
|
|
|
|
or al,al
|
|
|
|
je push_imm_size_ok
|
|
|
|
or ah,ah
|
|
|
|
je push_imm_size_ok
|
|
|
|
cmp al,ah
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,2
|
|
|
|
je push_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je push_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je push_imm_64bit
|
|
|
|
cmp ah,2
|
|
|
|
je push_imm_optimized_16bit
|
|
|
|
cmp ah,4
|
|
|
|
je push_imm_optimized_32bit
|
|
|
|
cmp ah,8
|
|
|
|
je push_imm_optimized_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],16
|
|
|
|
je push_imm_optimized_16bit
|
|
|
|
cmp [code_type],32
|
|
|
|
je push_imm_optimized_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_optimized_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
call get_simm32
|
|
|
|
mov edx,eax
|
|
|
|
cmp [value_type],0
|
|
|
|
jne push_imm_32bit_store
|
|
|
|
cmp eax,-80h
|
|
|
|
jl push_imm_32bit_store
|
|
|
|
cmp eax,80h
|
|
|
|
jge push_imm_32bit_store
|
|
|
|
jmp push_imm_8bit
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_optimized_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call get_dword_value
|
|
|
|
mov edx,eax
|
|
|
|
call operand_32bit
|
|
|
|
cmp [value_type],0
|
|
|
|
jne push_imm_32bit_store
|
|
|
|
cmp eax,-80h
|
|
|
|
jl push_imm_32bit_store
|
|
|
|
cmp eax,80h
|
|
|
|
jge push_imm_32bit_store
|
|
|
|
jmp push_imm_8bit
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_optimized_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_word_value
|
|
|
|
mov dx,ax
|
|
|
|
call operand_16bit
|
|
|
|
cmp [value_type],0
|
|
|
|
jne push_imm_16bit_store
|
|
|
|
cmp ax,-80h
|
|
|
|
jl push_imm_16bit_store
|
|
|
|
cmp ax,80h
|
|
|
|
jge push_imm_16bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
mov [base_code],6Ah
|
|
|
|
call store_instruction_code
|
|
|
|
mov al,ah
|
|
|
|
stos byte [edi]
|
|
|
|
jmp push_done
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_word_value
|
|
|
|
mov dx,ax
|
|
|
|
call operand_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_16bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],68h
|
|
|
|
call store_instruction_code
|
|
|
|
mov ax,dx
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
jmp push_done
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
call get_simm32
|
|
|
|
mov edx,eax
|
|
|
|
jmp push_imm_32bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call get_dword_value
|
|
|
|
mov edx,eax
|
|
|
|
call operand_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
push_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],68h
|
|
|
|
call store_instruction_code
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
push_done:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
dec esi
|
|
|
|
cmp al,0Fh
|
|
|
|
je instruction_assembled
|
|
|
|
or al,al
|
|
|
|
jz instruction_assembled
|
|
|
|
mov [operand_size],0
|
|
|
|
mov [size_override],0
|
|
|
|
mov [operand_prefix],0
|
|
|
|
mov [rex_prefix],0
|
|
|
|
jmp push_next
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [push_size],al
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_next:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je pop_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
mov ah,[push_size]
|
|
|
|
cmp al,2
|
|
|
|
je pop_mem_16bit
|
|
|
|
cmp al,4
|
|
|
|
je pop_mem_32bit
|
|
|
|
cmp al,8
|
|
|
|
je pop_mem_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp ah,2
|
|
|
|
je pop_mem_16bit
|
|
|
|
cmp ah,4
|
|
|
|
je pop_mem_32bit
|
|
|
|
cmp ah,8
|
|
|
|
je pop_mem_64bit
|
|
|
|
cmp [error_line],0
|
|
|
|
jne pop_mem_store
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp pop_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 2
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call operand_16bit
|
|
|
|
jmp pop_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_mem_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call operand_32bit
|
|
|
|
jmp pop_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_mem_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_mem_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],08Fh
|
|
|
|
mov [postbyte_register],0
|
|
|
|
call store_instruction
|
|
|
|
jmp pop_done
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
mov ah,al
|
|
|
|
sub ah,10h
|
|
|
|
and ah,al
|
|
|
|
test ah,0F0h
|
|
|
|
jnz pop_sreg
|
|
|
|
call convert_register
|
|
|
|
test al,1000b
|
|
|
|
jz pop_reg_ok
|
|
|
|
or [rex_prefix],41h
|
|
|
|
and al,111b
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_reg_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
add al,58h
|
|
|
|
mov [base_code],al
|
|
|
|
mov al,ah
|
|
|
|
mov ah,[push_size]
|
|
|
|
cmp al,2
|
|
|
|
je pop_reg_16bit
|
|
|
|
cmp al,4
|
|
|
|
je pop_reg_32bit
|
|
|
|
cmp al,8
|
|
|
|
je pop_reg_64bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_reg_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
jmp pop_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_reg_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call operand_32bit
|
|
|
|
jmp pop_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_reg_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ah,not 2
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call operand_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_reg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_done:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
dec esi
|
|
|
|
cmp al,0Fh
|
|
|
|
je instruction_assembled
|
|
|
|
or al,al
|
|
|
|
jz instruction_assembled
|
|
|
|
mov [operand_size],0
|
|
|
|
mov [size_override],0
|
|
|
|
mov [operand_prefix],0
|
|
|
|
mov [rex_prefix],0
|
|
|
|
jmp pop_next
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_sreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dl,[operand_size]
|
|
|
|
mov dh,[push_size]
|
|
|
|
cmp al,62h
|
|
|
|
je pop_cs
|
|
|
|
mov bl,al
|
|
|
|
cmp dl,2
|
|
|
|
je pop_sreg16
|
|
|
|
cmp dl,4
|
|
|
|
je pop_sreg32
|
|
|
|
cmp dl,8
|
|
|
|
je pop_sreg64
|
|
|
|
or dl,dl
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp dh,2
|
|
|
|
je pop_sreg16
|
|
|
|
cmp dh,4
|
|
|
|
je pop_sreg32
|
|
|
|
cmp dh,8
|
|
|
|
je pop_sreg64
|
|
|
|
jmp pop_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_sreg16:
|
2006-09-22 19:55:59 +04:00
|
|
|
test dh,not 2
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call operand_16bit
|
|
|
|
jmp pop_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_sreg32:
|
2006-09-22 19:55:59 +04:00
|
|
|
test dh,not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call operand_32bit
|
|
|
|
jmp pop_sreg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_sreg64:
|
2006-09-22 19:55:59 +04:00
|
|
|
test dh,not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_sreg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,bl
|
|
|
|
cmp al,70h
|
|
|
|
jae invalid_operand
|
|
|
|
sub al,61h
|
|
|
|
cmp al,4
|
|
|
|
jae pop_sreg_386
|
|
|
|
shl al,3
|
|
|
|
add al,7
|
|
|
|
mov [base_code],al
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
jmp pop_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_cs:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
jne illegal_instruction
|
|
|
|
cmp dl,2
|
|
|
|
je pop_cs_store
|
|
|
|
or dl,dl
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp dh,2
|
|
|
|
je pop_cs_store
|
|
|
|
or dh,dh
|
|
|
|
jnz illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_cs_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
test dh,not 2
|
|
|
|
jnz invalid_operand_size
|
|
|
|
mov al,0Fh
|
|
|
|
stos byte [edi]
|
|
|
|
jmp pop_done
|
2006-07-28 17:39:16 +04:00
|
|
|
pop_sreg_386:
|
2006-09-22 19:55:59 +04:00
|
|
|
sub al,4
|
|
|
|
shl al,3
|
|
|
|
add al,0A1h
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
jmp pop_reg_store
|
2006-07-28 17:39:16 +04:00
|
|
|
inc_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je inc_reg
|
|
|
|
cmp al,'['
|
|
|
|
je inc_mem
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
inc_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je inc_mem_8bit
|
|
|
|
jb inc_mem_nosize
|
|
|
|
call operand_autodetect
|
|
|
|
mov al,0FFh
|
|
|
|
xchg al,[base_code]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
inc_mem_nosize:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne inc_mem_8bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
inc_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0FEh
|
|
|
|
xchg al,[base_code]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
inc_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,0FEh
|
|
|
|
xchg al,[base_code]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je inc_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
cmp [code_type],64
|
|
|
|
je inc_reg_long_form
|
|
|
|
mov al,[postbyte_register]
|
|
|
|
shl al,3
|
|
|
|
add al,bl
|
|
|
|
add al,40h
|
|
|
|
mov [base_code],al
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
inc_reg_long_form:
|
2006-09-22 19:55:59 +04:00
|
|
|
inc [base_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
inc_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
set_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je set_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
set_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
cmp [operand_size],1
|
|
|
|
ja invalid_operand_size
|
|
|
|
mov [postbyte_register],0
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
set_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,1
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
mov [postbyte_register],0
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
arpl_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
mov [base_code],63h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je arpl_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
arpl_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bound_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je bound_16bit
|
|
|
|
cmp al,4
|
|
|
|
je bound_32bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
bound_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
mov [base_code],62h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bound_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
mov [base_code],62h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
enter_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp ah,2
|
|
|
|
je enter_imm16_size_ok
|
|
|
|
or ah,ah
|
|
|
|
jnz invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
enter_imm16_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
call get_word_value
|
|
|
|
cmp [next_pass_needed],0
|
|
|
|
jne enter_imm16_ok
|
|
|
|
cmp [value_type],0
|
|
|
|
jne invalid_use_of_symbol
|
2006-07-28 17:39:16 +04:00
|
|
|
enter_imm16_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
push eax
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp ah,1
|
|
|
|
je enter_imm8_size_ok
|
|
|
|
or ah,ah
|
|
|
|
jnz invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
enter_imm8_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
pop ebx
|
|
|
|
mov al,0C8h
|
|
|
|
stos byte [edi]
|
|
|
|
mov ax,bx
|
|
|
|
stos word [edi]
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_instruction_only64:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
jmp ret_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_instruction_32bit_except64:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_instruction_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
jmp ret_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_instruction_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
jmp ret_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
retf_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne ret_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_instruction_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
dec esi
|
|
|
|
or al,al
|
|
|
|
jz simple_ret
|
|
|
|
cmp al,0Fh
|
|
|
|
je simple_ret
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
or ah,ah
|
|
|
|
jz ret_imm
|
|
|
|
cmp ah,2
|
|
|
|
je ret_imm
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
call get_word_value
|
|
|
|
cmp [next_pass_needed],0
|
|
|
|
jne ret_imm_ok
|
|
|
|
cmp [value_type],0
|
|
|
|
jne invalid_use_of_symbol
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_imm_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne ret_imm_store
|
|
|
|
or ax,ax
|
|
|
|
jz simple_ret
|
2006-07-28 17:39:16 +04:00
|
|
|
ret_imm_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dx,ax
|
|
|
|
call store_instruction_code
|
|
|
|
mov ax,dx
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_ret:
|
2006-09-22 19:55:59 +04:00
|
|
|
inc [base_code]
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
lea_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],8Dh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
xor al,al
|
|
|
|
xchg al,[operand_size]
|
|
|
|
push eax
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
mov [size_override],-1
|
|
|
|
call get_address
|
|
|
|
pop eax
|
|
|
|
mov [operand_size],al
|
|
|
|
call operand_autodetect
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
ls_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,al
|
|
|
|
jz les_instruction
|
|
|
|
cmp al,3
|
|
|
|
jz lds_instruction
|
|
|
|
add al,0B0h
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
jmp ls_code_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
les_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0C4h
|
|
|
|
jmp ls_short_code
|
2006-07-28 17:39:16 +04:00
|
|
|
lds_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0C5h
|
2006-07-28 17:39:16 +04:00
|
|
|
ls_short_code:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
ls_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
add [operand_size],2
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,4
|
|
|
|
je ls_16bit
|
|
|
|
cmp al,6
|
|
|
|
je ls_32bit
|
|
|
|
cmp al,10
|
|
|
|
je ls_64bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
ls_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
ls_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
ls_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je sh_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
push eax
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je sh_mem_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,11h
|
|
|
|
jne invalid_operand
|
2006-10-11 02:15:57 +04:00
|
|
|
pop eax ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,1
|
|
|
|
je sh_mem_cl_8bit
|
|
|
|
jb sh_mem_cl_nosize
|
|
|
|
call operand_autodetect
|
|
|
|
mov [base_code],0D3h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_cl_nosize:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne sh_mem_cl_8bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_cl_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D2h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz sh_mem_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop eax ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,1
|
|
|
|
je sh_mem_imm_8bit
|
|
|
|
jb sh_mem_imm_nosize
|
|
|
|
call operand_autodetect
|
|
|
|
cmp byte [value],1
|
|
|
|
je sh_mem_1
|
|
|
|
mov [base_code],0C1h
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_1:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D1h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_imm_nosize:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne sh_mem_imm_8bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp byte [value],1
|
|
|
|
je sh_mem_1_8bit
|
|
|
|
mov [base_code],0C0h
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_mem_1_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D0h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bx,ax
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je sh_reg_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,11h
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,bh
|
|
|
|
cmp al,1
|
|
|
|
je sh_reg_cl_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
mov [base_code],0D3h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg_cl_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D2h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz sh_reg_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
push ebx
|
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
pop ebx
|
|
|
|
mov al,bh
|
|
|
|
cmp al,1
|
|
|
|
je sh_reg_imm_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
cmp dl,1
|
|
|
|
je sh_reg_1
|
|
|
|
mov [base_code],0C1h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg_1:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D1h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg_imm_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp dl,1
|
|
|
|
je sh_reg_1_8bit
|
|
|
|
mov [base_code],0C0h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sh_reg_1_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D0h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
shd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je shd_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
shd_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,ah
|
|
|
|
mov [operand_size],0
|
|
|
|
push eax
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je shd_mem_reg_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,11h
|
|
|
|
jne invalid_operand
|
2006-10-11 02:15:57 +04:00
|
|
|
pop eax ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_autodetect
|
|
|
|
inc [extended_code]
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
shd_mem_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz shd_mem_reg_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
shd_mem_reg_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop eax ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_autodetect
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
shd_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
push eax ebx
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je shd_reg_reg_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,11h
|
|
|
|
jne invalid_operand
|
|
|
|
pop ebx eax
|
|
|
|
call operand_autodetect
|
|
|
|
inc [extended_code]
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
shd_reg_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz shd_reg_reg_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
shd_reg_reg_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
pop ebx eax
|
|
|
|
call operand_autodetect
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
push eax
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movx_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
pop eax
|
|
|
|
mov ah,[operand_size]
|
|
|
|
or ah,ah
|
|
|
|
jz movx_unknown_size
|
|
|
|
cmp ah,al
|
|
|
|
jae invalid_operand_size
|
|
|
|
cmp ah,1
|
|
|
|
je movx_mem_8bit
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
movx_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
inc [extended_code]
|
|
|
|
call operand_autodetect
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movx_unknown_size:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne movx_mem_8bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
movx_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_autodetect
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movx_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
pop ebx
|
|
|
|
xchg bl,al
|
|
|
|
cmp ah,al
|
|
|
|
jae invalid_operand_size
|
|
|
|
cmp ah,1
|
|
|
|
je movx_reg_8bit
|
|
|
|
cmp ah,2
|
|
|
|
je movx_reg_16bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
movx_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_autodetect
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movx_reg_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_autodetect
|
|
|
|
inc [extended_code]
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movsxd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movsxd_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
cmp [operand_size],4
|
|
|
|
je movsxd_mem_store
|
|
|
|
cmp [operand_size],0
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
movsxd_mem_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movsxd_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call operand_64bit
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
shl al,3
|
|
|
|
add al,83h
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je bt_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push eax ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
cmp byte [esi],'('
|
|
|
|
je bt_mem_imm
|
|
|
|
cmp byte [esi],11h
|
|
|
|
jne bt_mem_reg
|
|
|
|
cmp byte [esi+2],'('
|
|
|
|
je bt_mem_imm
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_mem_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_mem_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
xor al,al
|
|
|
|
xchg al,[operand_size]
|
|
|
|
push eax
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz bt_mem_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_mem_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
|
|
|
pop eax
|
|
|
|
or al,al
|
|
|
|
jz bt_mem_imm_nosize
|
|
|
|
call operand_autodetect
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_mem_imm_store:
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],0BAh
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_mem_imm_nosize:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne bt_mem_imm_store
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp bt_mem_imm_store
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
cmp byte [esi],'('
|
|
|
|
je bt_reg_imm
|
|
|
|
cmp byte [esi],11h
|
|
|
|
jne bt_reg_reg
|
|
|
|
cmp byte [esi+2],'('
|
|
|
|
je bt_reg_imm
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
xor al,al
|
|
|
|
xchg al,[operand_size]
|
|
|
|
push eax ebx
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz bt_reg_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_reg_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
|
|
|
pop ebx eax
|
|
|
|
call operand_autodetect
|
2006-07-28 17:39:16 +04:00
|
|
|
bt_reg_imm_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],0BAh
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,byte [value]
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bs_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je bs_reg_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_argument
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
call operand_autodetect
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bs_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0F6h
|
|
|
|
mov [postbyte_register],5
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je imul_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,1
|
|
|
|
je imul_mem_8bit
|
|
|
|
jb imul_mem_nosize
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_mem_nosize:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne imul_mem_8bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp byte [esi],','
|
|
|
|
je imul_reg_
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je imul_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [base_code]
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
inc esi
|
|
|
|
cmp byte [esi],'('
|
|
|
|
je imul_reg_imm
|
|
|
|
cmp byte [esi],11h
|
|
|
|
jne imul_reg_noimm
|
|
|
|
cmp byte [esi+2],'('
|
|
|
|
je imul_reg_imm
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_noimm:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je imul_reg_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp byte [esi],','
|
|
|
|
je imul_reg_mem_imm
|
|
|
|
mov al,[operand_size]
|
|
|
|
call operand_autodetect
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0AFh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
inc esi
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je imul_reg_mem_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je imul_reg_mem_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je imul_reg_mem_imm_64bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call get_word_value
|
|
|
|
mov word [value],ax
|
|
|
|
cmp [value_type],0
|
|
|
|
jne imul_reg_mem_imm_16bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne imul_reg_mem_imm_16bit_store
|
|
|
|
cmp ax,-80h
|
|
|
|
jl imul_reg_mem_imm_16bit_store
|
|
|
|
cmp ax,80h
|
|
|
|
jl imul_reg_mem_imm_8bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm_16bit_store:
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],69h
|
|
|
|
call store_instruction_with_imm16
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
call get_dword_value
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm_32bit_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dword [value],eax
|
|
|
|
cmp [value_type],0
|
|
|
|
jne imul_reg_mem_imm_32bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne imul_reg_mem_imm_32bit_store
|
|
|
|
cmp eax,-80h
|
|
|
|
jl imul_reg_mem_imm_32bit_store
|
|
|
|
cmp eax,80h
|
|
|
|
jl imul_reg_mem_imm_8bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm_32bit_store:
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],69h
|
|
|
|
call store_instruction_with_imm32
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne long_immediate_not_encodable
|
|
|
|
call operand_64bit
|
|
|
|
call get_simm32
|
|
|
|
cmp [value_type],4
|
|
|
|
jae long_immediate_not_encodable
|
|
|
|
jmp imul_reg_mem_imm_32bit_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_mem_imm_8bit_store:
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],6Bh
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov bl,[postbyte_register]
|
|
|
|
dec esi
|
|
|
|
jmp imul_reg_reg_imm
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
cmp byte [esi],','
|
|
|
|
je imul_reg_reg_imm
|
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0AFh
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
inc esi
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je imul_reg_reg_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je imul_reg_reg_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je imul_reg_reg_imm_64bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
push ebx
|
|
|
|
call get_word_value
|
|
|
|
pop ebx
|
|
|
|
mov dx,ax
|
|
|
|
cmp [value_type],0
|
|
|
|
jne imul_reg_reg_imm_16bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne imul_reg_reg_imm_16bit_store
|
|
|
|
cmp ax,-80h
|
|
|
|
jl imul_reg_reg_imm_16bit_store
|
|
|
|
cmp ax,80h
|
|
|
|
jl imul_reg_reg_imm_8bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm_16bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],69h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov ax,dx
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
push ebx
|
|
|
|
call get_dword_value
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm_32bit_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
pop ebx
|
|
|
|
mov edx,eax
|
|
|
|
cmp [value_type],0
|
|
|
|
jne imul_reg_reg_imm_32bit_store
|
|
|
|
cmp [size_declared],0
|
|
|
|
jne imul_reg_reg_imm_32bit_store
|
|
|
|
cmp eax,-80h
|
|
|
|
jl imul_reg_reg_imm_32bit_store
|
|
|
|
cmp eax,80h
|
|
|
|
jl imul_reg_reg_imm_8bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],69h
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [size_declared],0
|
|
|
|
jne long_immediate_not_encodable
|
|
|
|
call operand_64bit
|
|
|
|
push ebx
|
|
|
|
call get_simm32
|
|
|
|
cmp [value_type],4
|
|
|
|
jae long_immediate_not_encodable
|
|
|
|
jmp imul_reg_reg_imm_32bit_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
imul_reg_reg_imm_8bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],6Bh
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
in_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,ah
|
|
|
|
push eax
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je in_imm
|
|
|
|
cmp al,10h
|
|
|
|
je in_reg
|
|
|
|
jmp invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
in_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,22h
|
|
|
|
jne invalid_operand
|
|
|
|
pop eax
|
|
|
|
cmp al,1
|
|
|
|
je in_al_dx
|
|
|
|
cmp al,2
|
|
|
|
je in_ax_dx
|
|
|
|
cmp al,4
|
|
|
|
je in_eax_dx
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
in_al_dx:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0ECh
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
in_ax_dx:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
mov [base_code],0EDh
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
in_eax_dx:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
mov [base_code],0EDh
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
in_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz in_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
in_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
pop eax
|
|
|
|
cmp al,1
|
|
|
|
je in_al_imm
|
|
|
|
cmp al,2
|
|
|
|
je in_ax_imm
|
|
|
|
cmp al,4
|
|
|
|
je in_eax_imm
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
in_al_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0E4h
|
|
|
|
stos byte [edi]
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
in_ax_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
mov [base_code],0E5h
|
|
|
|
call store_instruction_code
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
in_eax_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
mov [base_code],0E5h
|
|
|
|
call store_instruction_code
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
out_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je out_imm
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,22h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je out_dx_al
|
|
|
|
cmp al,2
|
|
|
|
je out_dx_ax
|
|
|
|
cmp al,4
|
|
|
|
je out_dx_eax
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
out_dx_al:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0EEh
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
out_dx_ax:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
mov [base_code],0EFh
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
out_dx_eax:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
mov [base_code],0EFh
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
out_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz out_imm_size_ok
|
|
|
|
cmp al,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
out_imm_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov dl,al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je out_imm_al
|
|
|
|
cmp al,2
|
|
|
|
je out_imm_ax
|
|
|
|
cmp al,4
|
|
|
|
je out_imm_eax
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
out_imm_al:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0E6h
|
|
|
|
stos byte [edi]
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
out_imm_ax:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
mov [base_code],0E7h
|
|
|
|
call store_instruction_code
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
out_imm_eax:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
|
|
|
mov [base_code],0E7h
|
|
|
|
call store_instruction_code
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
call_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],10b
|
|
|
|
mov [base_code],0E8h
|
|
|
|
mov [extended_code],9Ah
|
|
|
|
jmp process_jmp
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],100b
|
|
|
|
mov [base_code],0E9h
|
|
|
|
mov [extended_code],0EAh
|
2006-07-28 17:39:16 +04:00
|
|
|
process_jmp:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_jump_operator
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
je jmp_imm
|
|
|
|
mov [base_code],0FFh
|
|
|
|
cmp al,10h
|
|
|
|
je jmp_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],1
|
|
|
|
je illegal_instruction
|
|
|
|
call get_address
|
|
|
|
mov edx,eax
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz jmp_mem_size_not_specified
|
|
|
|
cmp al,2
|
|
|
|
je jmp_mem_16bit
|
|
|
|
cmp al,4
|
|
|
|
je jmp_mem_32bit
|
|
|
|
cmp al,6
|
|
|
|
je jmp_mem_48bit
|
|
|
|
cmp al,8
|
|
|
|
je jmp_mem_64bit
|
|
|
|
cmp al,10
|
|
|
|
je jmp_mem_80bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_size_not_specified:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],3
|
|
|
|
je jmp_mem_far
|
|
|
|
cmp [jump_type],2
|
|
|
|
je jmp_mem_near
|
|
|
|
cmp [error_line],0
|
|
|
|
jne jmp_mem_near
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_near:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je jmp_mem_16bit
|
|
|
|
cmp [code_type],32
|
|
|
|
je jmp_mem_near_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],3
|
|
|
|
je invalid_operand_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_far:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je jmp_mem_far_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_48bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_far_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],2
|
|
|
|
je invalid_operand_size
|
|
|
|
inc [postbyte_register]
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_80bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
|
|
|
jmp jmp_mem_far_store
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_far_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
jmp jmp_mem_far_store
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],3
|
|
|
|
je jmp_mem_far_32bit
|
|
|
|
cmp [jump_type],2
|
|
|
|
je jmp_mem_near_32bit
|
|
|
|
cmp [code_type],16
|
|
|
|
je jmp_mem_far_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_near_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call operand_32bit
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],3
|
|
|
|
je invalid_operand_size
|
|
|
|
call operand_16bit
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
test [jump_type],1
|
|
|
|
jnz invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,2
|
|
|
|
je jmp_reg_16bit
|
|
|
|
cmp al,4
|
|
|
|
je jmp_reg_32bit
|
|
|
|
cmp al,8
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_reg_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_reg_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_reg_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_16bit
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_imm:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp byte [esi],'.'
|
|
|
|
je invalid_value
|
|
|
|
mov ebx,esi
|
|
|
|
dec esi
|
|
|
|
call skip_symbol
|
|
|
|
xchg esi,ebx
|
|
|
|
cmp byte [ebx],':'
|
|
|
|
je jmp_far
|
|
|
|
cmp [jump_type],3
|
|
|
|
je invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_near:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je jmp_imm_16bit
|
|
|
|
cmp al,4
|
|
|
|
je jmp_imm_32bit
|
|
|
|
cmp al,8
|
|
|
|
je jmp_imm_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],16
|
|
|
|
je jmp_imm_16bit
|
|
|
|
cmp [code_type],64
|
|
|
|
je jmp_imm_64bit
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_imm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_operand_size
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_dword_value
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
jne jmp_imm_32bit_prefix_ok
|
|
|
|
mov byte [edi],66h
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_imm_32bit_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
cdq
|
|
|
|
call check_for_short_jump
|
|
|
|
jc jmp_short
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_imm_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov edx,eax
|
|
|
|
sub edx,3
|
|
|
|
mov al,[base_code]
|
|
|
|
stos byte [edi]
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_imm_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_operand_size
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_qword_value
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
mov ecx,edx
|
|
|
|
cdq
|
|
|
|
cmp edx,ecx
|
|
|
|
jne value_out_of_range
|
|
|
|
call check_for_short_jump
|
|
|
|
jnc jmp_imm_32bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_short:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
mov al,0EBh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_imm_16bit:
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_word_value
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je jmp_imm_16bit_prefix_ok
|
|
|
|
mov byte [edi],66h
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_imm_16bit_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
cwde
|
|
|
|
cdq
|
|
|
|
call check_for_short_jump
|
|
|
|
jc jmp_short
|
|
|
|
cmp [value_type],0
|
|
|
|
jne invalid_use_of_symbol
|
|
|
|
mov edx,eax
|
|
|
|
dec edx
|
|
|
|
mov al,[base_code]
|
|
|
|
stos byte [edi]
|
|
|
|
mov eax,edx
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
calculate_jump_offset:
|
2006-10-11 02:15:57 +04:00
|
|
|
add edi,2
|
|
|
|
call calculate_relative_offset
|
|
|
|
sub edi,2
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
check_for_short_jump:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],1
|
|
|
|
je forced_short
|
|
|
|
ja no_short_jump
|
|
|
|
cmp [base_code],0E8h
|
|
|
|
je no_short_jump
|
|
|
|
cmp [value_type],0
|
|
|
|
jne no_short_jump
|
|
|
|
cmp eax,80h
|
|
|
|
jb short_jump
|
|
|
|
cmp eax,-80h
|
|
|
|
jae short_jump
|
2006-07-28 17:39:16 +04:00
|
|
|
no_short_jump:
|
2006-09-22 19:55:59 +04:00
|
|
|
clc
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
forced_short:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [base_code],0E8h
|
|
|
|
je illegal_instruction
|
|
|
|
cmp [next_pass_needed],0
|
|
|
|
jne jmp_short_value_type_ok
|
|
|
|
cmp [value_type],0
|
|
|
|
jne invalid_use_of_symbol
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_short_value_type_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp eax,-80h
|
|
|
|
jae short_jump
|
|
|
|
cmp eax,80h
|
|
|
|
jae jump_out_of_range
|
2006-07-28 17:39:16 +04:00
|
|
|
short_jump:
|
2006-09-22 19:55:59 +04:00
|
|
|
stc
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
jump_out_of_range:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [error_line],0
|
|
|
|
jne instruction_assembled
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],relative_jump_out_of_range
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_far:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [jump_type],2
|
|
|
|
je invalid_operand
|
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
mov al,[extended_code]
|
|
|
|
mov [base_code],al
|
|
|
|
call get_word_value
|
|
|
|
push eax
|
|
|
|
inc esi
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,[value_type]
|
|
|
|
push eax [symbol_identifier]
|
|
|
|
cmp byte [esi],'.'
|
|
|
|
je invalid_value
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,4
|
|
|
|
je jmp_far_16bit
|
|
|
|
cmp al,6
|
|
|
|
je jmp_far_32bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],16
|
|
|
|
jne jmp_far_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_far_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_word_value
|
|
|
|
mov ebx,eax
|
|
|
|
call operand_16bit
|
|
|
|
call store_instruction_code
|
|
|
|
mov ax,bx
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_far_segment:
|
2006-09-22 19:55:59 +04:00
|
|
|
pop [symbol_identifier] eax
|
|
|
|
mov [value_type],al
|
|
|
|
pop eax
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
jmp_far_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_dword_value
|
|
|
|
mov ebx,eax
|
|
|
|
call operand_32bit
|
|
|
|
call store_instruction_code
|
|
|
|
mov eax,ebx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp jmp_far_segment
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_jump_operator
|
|
|
|
cmp [jump_type],3
|
|
|
|
je invalid_operand
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
cmp byte [esi],'.'
|
|
|
|
je invalid_value
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je conditional_jump_16bit
|
|
|
|
cmp al,4
|
|
|
|
je conditional_jump_32bit
|
|
|
|
cmp al,8
|
|
|
|
je conditional_jump_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],16
|
|
|
|
je conditional_jump_16bit
|
|
|
|
cmp [code_type],64
|
|
|
|
je conditional_jump_64bit
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_operand_size
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_dword_value
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
jne conditional_jump_32bit_prefix_ok
|
|
|
|
mov byte [edi],66h
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump_32bit_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
cdq
|
|
|
|
call check_for_short_jump
|
|
|
|
jc conditional_jump_short
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump_32bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov edx,eax
|
|
|
|
sub edx,4
|
|
|
|
mov ah,[base_code]
|
|
|
|
add ah,10h
|
|
|
|
mov al,0Fh
|
|
|
|
stos word [edi]
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_operand_size
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_qword_value
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
mov ecx,edx
|
|
|
|
cdq
|
|
|
|
cmp edx,ecx
|
|
|
|
jne value_out_of_range
|
|
|
|
call check_for_short_jump
|
|
|
|
jnc conditional_jump_32bit_store
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump_short:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
mov al,[base_code]
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump_16bit:
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_word_value
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je conditional_jump_16bit_prefix_ok
|
|
|
|
mov byte [edi],66h
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
conditional_jump_16bit_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
cwde
|
|
|
|
cdq
|
|
|
|
call check_for_short_jump
|
|
|
|
jc conditional_jump_short
|
|
|
|
cmp [value_type],0
|
|
|
|
jne invalid_use_of_symbol
|
|
|
|
mov edx,eax
|
|
|
|
sub edx,2
|
|
|
|
mov ah,[base_code]
|
|
|
|
add ah,10h
|
|
|
|
mov al,0Fh
|
|
|
|
stos word [edi]
|
|
|
|
mov eax,edx
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_instruction_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
mov dl,al
|
|
|
|
call address_16bit_prefix
|
|
|
|
mov al,dl
|
|
|
|
jmp loop_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_instruction_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dl,al
|
|
|
|
call address_32bit_prefix
|
|
|
|
mov al,dl
|
|
|
|
jmp loop_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_instruction_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_jump_operator
|
|
|
|
cmp [jump_type],1
|
|
|
|
ja invalid_operand
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
cmp byte [esi],'.'
|
|
|
|
je invalid_value
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je loop_jump_16bit
|
|
|
|
cmp al,4
|
|
|
|
je loop_jump_32bit
|
|
|
|
cmp al,8
|
|
|
|
je loop_jump_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [code_type],16
|
|
|
|
je loop_jump_16bit
|
|
|
|
cmp [code_type],64
|
|
|
|
je loop_jump_64bit
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_jump_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_operand_size
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_dword_value
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
jne loop_jump_32bit_prefix_ok
|
|
|
|
mov byte [edi],66h
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_jump_32bit_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
cdq
|
2006-07-28 17:39:16 +04:00
|
|
|
make_loop_jump:
|
2006-09-22 19:55:59 +04:00
|
|
|
call check_for_short_jump
|
|
|
|
jc conditional_jump_short
|
|
|
|
jmp jump_out_of_range
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_jump_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_operand_size
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_qword_value
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
mov ecx,edx
|
|
|
|
cdq
|
|
|
|
cmp edx,ecx
|
|
|
|
jne value_out_of_range
|
|
|
|
jmp make_loop_jump
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_jump_16bit:
|
2006-11-26 04:43:33 +03:00
|
|
|
call get_address_word_value
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je loop_jump_16bit_prefix_ok
|
|
|
|
mov byte [edi],66h
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
loop_jump_16bit_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_jump_offset
|
|
|
|
cwde
|
|
|
|
cdq
|
|
|
|
jmp make_loop_jump
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
movs_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
cmp [segment_register],1
|
|
|
|
ja invalid_address
|
|
|
|
push ebx
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
pop edx
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
mov al,dh
|
|
|
|
mov ah,bh
|
|
|
|
shr al,4
|
|
|
|
shr ah,4
|
|
|
|
cmp al,ah
|
|
|
|
jne address_sizes_do_not_agree
|
|
|
|
and bh,111b
|
|
|
|
and dh,111b
|
|
|
|
cmp bh,6
|
|
|
|
jne invalid_address
|
|
|
|
cmp dh,7
|
|
|
|
jne invalid_address
|
|
|
|
cmp al,2
|
|
|
|
je movs_address_16bit
|
|
|
|
cmp al,4
|
|
|
|
je movs_address_32bit
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
|
|
|
jmp movs_store
|
2006-07-28 17:39:16 +04:00
|
|
|
movs_address_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp movs_store
|
2006-07-28 17:39:16 +04:00
|
|
|
movs_address_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
movs_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [segment_register],4
|
|
|
|
je movs_segment_ok
|
|
|
|
call store_segment_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
movs_segment_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0A4h
|
|
|
|
mov bl,[operand_size]
|
|
|
|
cmp bl,1
|
|
|
|
je simple_instruction
|
|
|
|
inc al
|
|
|
|
cmp bl,2
|
|
|
|
je simple_instruction_16bit
|
|
|
|
cmp bl,4
|
|
|
|
je simple_instruction_32bit
|
|
|
|
cmp bl,8
|
|
|
|
je simple_instruction_64bit
|
|
|
|
or bl,bl
|
|
|
|
jz operand_size_not_specified
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
lods_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
cmp bh,26h
|
|
|
|
je lods_address_16bit
|
|
|
|
cmp bh,46h
|
|
|
|
je lods_address_32bit
|
|
|
|
cmp bh,86h
|
|
|
|
jne invalid_address
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
|
|
|
jmp lods_store
|
2006-07-28 17:39:16 +04:00
|
|
|
lods_address_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp lods_store
|
2006-07-28 17:39:16 +04:00
|
|
|
lods_address_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
lods_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [segment_register],4
|
|
|
|
je lods_segment_ok
|
|
|
|
call store_segment_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
lods_segment_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0ACh
|
|
|
|
mov bl,[operand_size]
|
|
|
|
cmp bl,1
|
|
|
|
je simple_instruction
|
|
|
|
inc al
|
|
|
|
cmp bl,2
|
|
|
|
je simple_instruction_16bit
|
|
|
|
cmp bl,4
|
|
|
|
je simple_instruction_32bit
|
|
|
|
cmp bl,8
|
|
|
|
je simple_instruction_64bit
|
|
|
|
or bl,bl
|
|
|
|
jz operand_size_not_specified
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
stos_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
cmp bh,27h
|
|
|
|
je stos_address_16bit
|
|
|
|
cmp bh,47h
|
|
|
|
je stos_address_32bit
|
|
|
|
cmp bh,87h
|
|
|
|
jne invalid_address
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
|
|
|
jmp stos_store
|
2006-07-28 17:39:16 +04:00
|
|
|
stos_address_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp stos_store
|
2006-07-28 17:39:16 +04:00
|
|
|
stos_address_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
stos_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [segment_register],1
|
|
|
|
ja invalid_address
|
|
|
|
mov al,[base_code]
|
|
|
|
mov bl,[operand_size]
|
|
|
|
cmp bl,1
|
|
|
|
je simple_instruction
|
|
|
|
inc al
|
|
|
|
cmp bl,2
|
|
|
|
je simple_instruction_16bit
|
|
|
|
cmp bl,4
|
|
|
|
je simple_instruction_32bit
|
|
|
|
cmp bl,8
|
|
|
|
je simple_instruction_64bit
|
|
|
|
or bl,bl
|
|
|
|
jz operand_size_not_specified
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
cmps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
mov al,[segment_register]
|
2006-10-11 02:15:57 +04:00
|
|
|
push eax ebx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
2006-10-11 02:15:57 +04:00
|
|
|
pop edx eax
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [segment_register],1
|
|
|
|
ja invalid_address
|
|
|
|
mov [segment_register],al
|
|
|
|
mov al,dh
|
|
|
|
mov ah,bh
|
|
|
|
shr al,4
|
|
|
|
shr ah,4
|
|
|
|
cmp al,ah
|
|
|
|
jne address_sizes_do_not_agree
|
|
|
|
and bh,111b
|
|
|
|
and dh,111b
|
|
|
|
cmp bh,7
|
|
|
|
jne invalid_address
|
|
|
|
cmp dh,6
|
|
|
|
jne invalid_address
|
|
|
|
cmp al,2
|
|
|
|
je cmps_address_16bit
|
|
|
|
cmp al,4
|
|
|
|
je cmps_address_32bit
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
|
|
|
jmp cmps_store
|
2006-07-28 17:39:16 +04:00
|
|
|
cmps_address_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp cmps_store
|
2006-07-28 17:39:16 +04:00
|
|
|
cmps_address_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
cmps_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [segment_register],4
|
|
|
|
je cmps_segment_ok
|
|
|
|
call store_segment_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
cmps_segment_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0A6h
|
|
|
|
mov bl,[operand_size]
|
|
|
|
cmp bl,1
|
|
|
|
je simple_instruction
|
|
|
|
inc al
|
|
|
|
cmp bl,2
|
|
|
|
je simple_instruction_16bit
|
|
|
|
cmp bl,4
|
|
|
|
je simple_instruction_32bit
|
|
|
|
cmp bl,8
|
|
|
|
je simple_instruction_64bit
|
|
|
|
or bl,bl
|
|
|
|
jz operand_size_not_specified
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
ins_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
cmp bh,27h
|
|
|
|
je ins_address_16bit
|
|
|
|
cmp bh,47h
|
|
|
|
je ins_address_32bit
|
|
|
|
cmp bh,87h
|
|
|
|
jne invalid_address
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
|
|
|
jmp ins_store
|
2006-07-28 17:39:16 +04:00
|
|
|
ins_address_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp ins_store
|
2006-07-28 17:39:16 +04:00
|
|
|
ins_address_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
ins_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [segment_register],1
|
|
|
|
ja invalid_address
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,22h
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,6Ch
|
|
|
|
mov bl,[operand_size]
|
|
|
|
cmp bl,1
|
|
|
|
je simple_instruction
|
|
|
|
inc al
|
|
|
|
cmp bl,2
|
|
|
|
je simple_instruction_16bit
|
|
|
|
cmp bl,4
|
|
|
|
je simple_instruction_32bit
|
|
|
|
or bl,bl
|
|
|
|
jz operand_size_not_specified
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
outs_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,22h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
cmp bh,26h
|
|
|
|
je outs_address_16bit
|
|
|
|
cmp bh,46h
|
|
|
|
je outs_address_32bit
|
|
|
|
cmp bh,86h
|
|
|
|
jne invalid_address
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
|
|
|
jmp outs_store
|
2006-07-28 17:39:16 +04:00
|
|
|
outs_address_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp outs_store
|
2006-07-28 17:39:16 +04:00
|
|
|
outs_address_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
outs_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [segment_register],4
|
|
|
|
je outs_segment_ok
|
|
|
|
call store_segment_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
outs_segment_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,6Eh
|
|
|
|
mov bl,[operand_size]
|
|
|
|
cmp bl,1
|
|
|
|
je simple_instruction
|
|
|
|
inc al
|
|
|
|
cmp bl,2
|
|
|
|
je simple_instruction_16bit
|
|
|
|
cmp bl,4
|
|
|
|
je simple_instruction_32bit
|
|
|
|
or bl,bl
|
|
|
|
jz operand_size_not_specified
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
xlat_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
or eax,eax
|
|
|
|
jnz invalid_address
|
|
|
|
or bl,ch
|
|
|
|
jnz invalid_address
|
|
|
|
cmp bh,23h
|
|
|
|
je xlat_address_16bit
|
|
|
|
cmp bh,43h
|
|
|
|
je xlat_address_32bit
|
|
|
|
cmp bh,83h
|
|
|
|
jne invalid_address
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
|
|
|
jmp xlat_store
|
2006-07-28 17:39:16 +04:00
|
|
|
xlat_address_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp xlat_store
|
2006-07-28 17:39:16 +04:00
|
|
|
xlat_address_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
xlat_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
mov al,0D7h
|
|
|
|
cmp [operand_size],1
|
|
|
|
jbe simple_instruction
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
pm_word_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
shr ah,4
|
|
|
|
and al,111b
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],ah
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je pm_reg
|
2006-07-28 17:39:16 +04:00
|
|
|
pm_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je pm_mem_store
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
pm_mem_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
pm_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
pm_store_word_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
shr ah,4
|
|
|
|
and al,111b
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],ah
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne pm_mem
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
lgdt_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],1
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,6
|
|
|
|
je lgdt_mem_48bit
|
|
|
|
cmp al,10
|
|
|
|
je lgdt_mem_80bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
jmp lgdt_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
lgdt_mem_80bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
jmp lgdt_mem_store
|
2006-07-28 17:39:16 +04:00
|
|
|
lgdt_mem_48bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je illegal_instruction
|
|
|
|
cmp [postbyte_register],2
|
|
|
|
jb lgdt_mem_store
|
|
|
|
call operand_32bit
|
2006-07-28 17:39:16 +04:00
|
|
|
lgdt_mem_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
lar_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
xor al,al
|
|
|
|
xchg al,[operand_size]
|
|
|
|
call operand_autodetect
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je lar_reg_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz lar_reg_mem
|
|
|
|
cmp al,2
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
lar_reg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
lar_reg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,2
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
invlpg_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],1
|
|
|
|
mov [postbyte_register],7
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
swapgs_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],1
|
|
|
|
mov [postbyte_register],7
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
basic_486_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je basic_486_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
2006-10-11 02:15:57 +04:00
|
|
|
push edx ebx ecx
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop ecx ebx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je basic_486_mem_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [extended_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_486_mem_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_486_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,[postbyte_register]
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov al,ah
|
|
|
|
cmp al,1
|
|
|
|
je basic_486_reg_reg_8bit
|
|
|
|
call operand_autodetect
|
|
|
|
inc [extended_code]
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_486_reg_reg_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bswap_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
test al,1000b
|
|
|
|
jz bswap_reg_code_ok
|
|
|
|
or [rex_prefix],41h
|
|
|
|
and al,111b
|
2006-07-28 17:39:16 +04:00
|
|
|
bswap_reg_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
add al,0C8h
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
cmp ah,8
|
|
|
|
je bswap_reg64
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
call operand_32bit
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
bswap_reg64:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
|
|
|
call store_instruction_code
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cmpxchgx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0C7h
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov ah,1
|
|
|
|
xchg [postbyte_register],ah
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz cmpxchgx_size_ok
|
|
|
|
cmp al,ah
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
cmpxchgx_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,16
|
|
|
|
jne cmpxchgx_store
|
|
|
|
call operand_64bit
|
2006-07-28 17:39:16 +04:00
|
|
|
cmpxchgx_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-10-11 02:15:57 +04:00
|
|
|
nop_instruction:
|
|
|
|
mov ah,[esi]
|
|
|
|
cmp ah,10h
|
|
|
|
je extended_nop
|
|
|
|
cmp ah,11h
|
|
|
|
je extended_nop
|
|
|
|
cmp ah,'['
|
|
|
|
je extended_nop
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
|
|
|
extended_nop:
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],1Fh
|
|
|
|
mov [postbyte_register],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je extended_nop_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz extended_nop_nosize
|
|
|
|
call operand_autodetect
|
|
|
|
extended_nop_store:
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
|
|
|
extended_nop_nosize:
|
|
|
|
cmp [error_line],0
|
|
|
|
jne extended_nop_store
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
|
|
|
jmp extended_nop_store
|
|
|
|
extended_nop_reg:
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov bl,al
|
|
|
|
mov al,ah
|
|
|
|
call operand_autodetect
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
basic_fpu_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [base_code],0D8h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je basic_fpu_streg
|
|
|
|
cmp al,'['
|
|
|
|
je basic_fpu_mem
|
|
|
|
dec esi
|
|
|
|
mov ah,[postbyte_register]
|
|
|
|
cmp ah,2
|
|
|
|
jb invalid_operand
|
|
|
|
cmp ah,3
|
|
|
|
ja invalid_operand
|
|
|
|
mov bl,1
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_fpu_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,4
|
|
|
|
je basic_fpu_mem_32bit
|
|
|
|
cmp al,8
|
|
|
|
je basic_fpu_mem_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne basic_fpu_mem_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_fpu_mem_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_fpu_mem_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DCh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_fpu_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
mov bl,al
|
|
|
|
mov ah,[postbyte_register]
|
|
|
|
cmp ah,2
|
|
|
|
je basic_fpu_single_streg
|
|
|
|
cmp ah,3
|
|
|
|
je basic_fpu_single_streg
|
|
|
|
or al,al
|
|
|
|
jz basic_fpu_st0
|
|
|
|
test ah,110b
|
|
|
|
jz basic_fpu_streg_st0
|
|
|
|
xor [postbyte_register],1
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_fpu_streg_st0:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand
|
|
|
|
mov [base_code],0DCh
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_fpu_st0:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
mov bl,al
|
2006-07-28 17:39:16 +04:00
|
|
|
basic_fpu_single_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D8h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_fpu_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
or ah,11000000b
|
|
|
|
mov al,0D9h
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fi_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je fi_mem_16bit
|
|
|
|
cmp al,4
|
|
|
|
je fi_mem_32bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne fi_mem_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
fi_mem_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DAh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fi_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DEh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fld_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je fld_streg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,4
|
|
|
|
je fld_mem_32bit
|
|
|
|
cmp al,8
|
|
|
|
je fld_mem_64bit
|
|
|
|
cmp al,10
|
|
|
|
je fld_mem_80bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne fld_mem_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
fld_mem_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D9h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fld_mem_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DDh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fld_mem_80bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[postbyte_register]
|
|
|
|
cmp al,0
|
|
|
|
je fld_mem_80bit_store
|
|
|
|
dec [postbyte_register]
|
|
|
|
cmp al,3
|
|
|
|
je fld_mem_80bit_store
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
fld_mem_80bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
add [postbyte_register],5
|
|
|
|
mov [base_code],0DBh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fld_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
mov bl,al
|
|
|
|
cmp [postbyte_register],2
|
|
|
|
jae fst_streg
|
|
|
|
mov [base_code],0D9h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fst_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DDh
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fild_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
cmp al,2
|
|
|
|
je fild_mem_16bit
|
|
|
|
cmp al,4
|
|
|
|
je fild_mem_32bit
|
|
|
|
cmp al,8
|
|
|
|
je fild_mem_64bit
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp [error_line],0
|
|
|
|
jne fild_mem_32bit
|
|
|
|
mov eax,[current_line]
|
|
|
|
mov [error_line],eax
|
|
|
|
mov [error],operand_size_not_specified
|
2006-07-28 17:39:16 +04:00
|
|
|
fild_mem_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DBh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fild_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DFh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fild_mem_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[postbyte_register]
|
|
|
|
cmp al,1
|
|
|
|
je fisttp_64bit_store
|
|
|
|
jb fild_mem_64bit_store
|
|
|
|
dec [postbyte_register]
|
|
|
|
cmp al,3
|
|
|
|
je fild_mem_64bit_store
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
fild_mem_64bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
add [postbyte_register],5
|
|
|
|
mov [base_code],0DFh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fisttp_64bit_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DDh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fbld_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz fbld_mem_80bit
|
|
|
|
cmp al,10
|
|
|
|
je fbld_mem_80bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
fbld_mem_80bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DFh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
faddp_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [base_code],0DEh
|
|
|
|
mov edx,esi
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je faddp_streg
|
|
|
|
mov esi,edx
|
|
|
|
mov bl,1
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
faddp_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
mov bl,al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fcompp_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ax,0D9DEh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fucompp_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ax,0E9DAh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fxch_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dx,01D9h
|
|
|
|
jmp fpu_single_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
ffreep_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dx,00DFh
|
|
|
|
jmp fpu_single_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
ffree_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dl,0DDh
|
|
|
|
mov dh,al
|
2006-07-28 17:39:16 +04:00
|
|
|
fpu_single_operand:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ebx,esi
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je fpu_streg
|
|
|
|
or dh,dh
|
|
|
|
jz invalid_operand
|
|
|
|
mov esi,ebx
|
|
|
|
shl dh,3
|
|
|
|
or dh,11000001b
|
|
|
|
mov ax,dx
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fpu_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
shl dh,3
|
|
|
|
or dh,al
|
|
|
|
or dh,11000000b
|
|
|
|
mov ax,dx
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fstenv_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov byte [edi],9Bh
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
fldenv_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0D9h
|
|
|
|
jmp fpu_mem
|
2006-07-28 17:39:16 +04:00
|
|
|
fsave_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov byte [edi],9Bh
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
fnsave_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DDh
|
2006-07-28 17:39:16 +04:00
|
|
|
fpu_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
cmp [operand_size],0
|
|
|
|
jne invalid_operand_size
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fstcw_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov byte [edi],9Bh
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
fldcw_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [base_code],0D9h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz fldcw_mem_16bit
|
|
|
|
cmp al,2
|
|
|
|
je fldcw_mem_16bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
fldcw_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fstsw_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,9Bh
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
fnstsw_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0DDh
|
|
|
|
mov [postbyte_register],7
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je fstsw_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz fstsw_mem_16bit
|
|
|
|
cmp al,2
|
|
|
|
je fstsw_mem_16bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
fstsw_mem_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fstsw_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ax,0200h
|
|
|
|
jne invalid_operand
|
|
|
|
mov ax,0E0DFh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
finit_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov byte [edi],9Bh
|
|
|
|
inc edi
|
2006-07-28 17:39:16 +04:00
|
|
|
fninit_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
mov al,0DBh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fcmov_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dh,0DAh
|
|
|
|
jmp fcomi_streg
|
2006-07-28 17:39:16 +04:00
|
|
|
fcomi_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dh,0DBh
|
|
|
|
jmp fcomi_streg
|
2006-07-28 17:39:16 +04:00
|
|
|
fcomip_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dh,0DFh
|
2006-07-28 17:39:16 +04:00
|
|
|
fcomi_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov dl,al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
mov ah,al
|
|
|
|
cmp byte [esi],','
|
|
|
|
je fcomi_st0_streg
|
|
|
|
add ah,dl
|
|
|
|
mov al,dh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
fcomi_st0_streg:
|
2006-09-22 19:55:59 +04:00
|
|
|
or ah,ah
|
|
|
|
jnz invalid_operand
|
|
|
|
inc esi
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_fpu_register
|
|
|
|
mov ah,al
|
|
|
|
add ah,dl
|
|
|
|
mov al,dh
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
2006-10-11 02:15:57 +04:00
|
|
|
basic_mmx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
2006-10-11 02:15:57 +04:00
|
|
|
mmx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
call make_mmx_prefix
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je mmx_mmreg_mmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
mmx_mmreg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mmx_mmreg_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mmx_ps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
call make_mmx_prefix
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je mmx_mmreg_mmreg
|
|
|
|
cmp al,'('
|
|
|
|
je mmx_ps_mmreg_imm8
|
|
|
|
cmp al,'['
|
|
|
|
je mmx_mmreg_mem
|
|
|
|
jmp invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
mmx_ps_mmreg_imm8:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
|
|
|
test [operand_size],not 1
|
|
|
|
jnz invalid_value
|
|
|
|
mov bl,[extended_code]
|
|
|
|
mov al,bl
|
|
|
|
shr bl,4
|
|
|
|
and al,1111b
|
|
|
|
add al,70h
|
|
|
|
mov [extended_code],al
|
|
|
|
sub bl,0Ch
|
|
|
|
shl bl,1
|
|
|
|
xchg bl,[postbyte_register]
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,byte [value]
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
pextrw_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov bl,al
|
|
|
|
call make_mmx_prefix
|
|
|
|
cmp [extended_code],0C5h
|
|
|
|
je mmx_nomem_imm8
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mmx_imm8:
|
2006-10-11 02:15:57 +04:00
|
|
|
push ebx ecx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
test ah,not 1
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
call get_byte_value
|
|
|
|
mov byte [value],al
|
2006-10-11 02:15:57 +04:00
|
|
|
pop edx ecx ebx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
mmx_nomem_imm8:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_nomem_instruction
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
test ah,not 1
|
|
|
|
jnz invalid_operand_size
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
call get_byte_value
|
|
|
|
stosb
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
pinsrw_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
call make_mmx_prefix
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je pinsrw_mmreg_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
cmp [operand_size],0
|
|
|
|
je mmx_imm8
|
|
|
|
cmp [operand_size],2
|
|
|
|
jne invalid_operand_size
|
|
|
|
jmp mmx_imm8
|
2006-07-28 17:39:16 +04:00
|
|
|
pinsrw_mmreg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
jmp mmx_nomem_imm8
|
2006-07-28 17:39:16 +04:00
|
|
|
pshufw_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],8
|
|
|
|
mov [operand_prefix],al
|
|
|
|
jmp pshuf_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
pshufd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],16
|
|
|
|
mov [operand_prefix],al
|
2006-07-28 17:39:16 +04:00
|
|
|
pshuf_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],70h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,[mmx_size]
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je pshuf_mmreg_mmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
jmp mmx_imm8
|
2006-07-28 17:39:16 +04:00
|
|
|
pshuf_mmreg_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov bl,al
|
|
|
|
jmp mmx_nomem_imm8
|
2006-07-28 17:39:16 +04:00
|
|
|
movd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],7Eh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movd_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
test [operand_size],not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
call make_mmx_prefix
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movd_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,0B0h
|
|
|
|
jae movd_mmreg
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [operand_size],0
|
|
|
|
mov bl,al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call make_mmx_prefix
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movd_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],6Eh
|
|
|
|
call convert_mmx_register
|
|
|
|
call make_mmx_prefix
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movd_mmreg_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
test [operand_size],not 4
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movd_mmreg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
make_mmx_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [operand_size],16
|
|
|
|
jne no_mmx_prefix
|
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
no_mmx_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movq_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
test [operand_size],not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
cmp ah,16
|
|
|
|
je movq_mem_xmmreg
|
|
|
|
mov [extended_code],7Fh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_mem_xmmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],0D6h
|
|
|
|
mov [operand_prefix],66h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,0B0h
|
|
|
|
jae movq_mmreg
|
|
|
|
call convert_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call make_mmx_prefix
|
|
|
|
mov [extended_code],7Eh
|
|
|
|
call operand_64bit
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
call convert_mmx_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [extended_code],6Fh
|
|
|
|
mov [mmx_size],ah
|
|
|
|
cmp ah,16
|
|
|
|
jne movq_mmreg_
|
|
|
|
mov [extended_code],7Eh
|
|
|
|
mov [operand_prefix],0F3h
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_mmreg_:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movq_mmreg_reg
|
|
|
|
call get_address
|
|
|
|
test [operand_size],not 8
|
|
|
|
jnz invalid_operand_size
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_mmreg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,0B0h
|
|
|
|
jae movq_mmreg_mmreg
|
|
|
|
mov [operand_size],0
|
|
|
|
call convert_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [extended_code],6Eh
|
|
|
|
mov [operand_prefix],0
|
|
|
|
mov bl,al
|
|
|
|
cmp [mmx_size],16
|
|
|
|
jne movq_mmreg_reg_store
|
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_mmreg_reg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call operand_64bit
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movq_mmreg_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
call convert_mmx_register
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movdq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],6Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movdq_mmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [extended_code],7Fh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movdq_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je movdq_mmreg_mmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movdq_mmreg_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
lddqu_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
push eax
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
pop eax
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_prefix],0F2h
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0F0h
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movq2dq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
mov [operand_prefix],0F3h
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0D6h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movdq2q_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
mov [operand_prefix],0F2h
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0D6h
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
sse_ps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],16
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_pd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],16
|
|
|
|
mov [operand_prefix],66h
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_ss_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],4
|
|
|
|
mov [operand_prefix],0F3h
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_sd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],8
|
|
|
|
mov [operand_prefix],0F2h
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
comiss_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],4
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
comisd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],8
|
|
|
|
mov [operand_prefix],66h
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtps2pd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],8
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtpd2dq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],16
|
|
|
|
mov [operand_prefix],0F2h
|
|
|
|
jmp sse_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtdq2pd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],16
|
|
|
|
mov [operand_prefix],0F3h
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_xmmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je sse_xmmreg_xmmreg
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_reg_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
cmp [operand_size],0
|
|
|
|
je sse_mem_size_ok
|
|
|
|
mov al,[mmx_size]
|
|
|
|
cmp [operand_size],al
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_mem_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [extended_code],0C6h
|
|
|
|
je mmx_imm8
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_xmmreg_xmmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [operand_prefix],66h
|
|
|
|
jne sse_xmmreg_xmmreg_ok
|
|
|
|
cmp [extended_code],12h
|
|
|
|
je invalid_operand
|
|
|
|
cmp [extended_code],16h
|
|
|
|
je invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_xmmreg_xmmreg_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
cmp [extended_code],0C6h
|
|
|
|
je mmx_nomem_imm8
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
ps_dq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_prefix],66h
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],73h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
jmp mmx_nomem_imm8
|
2006-07-28 17:39:16 +04:00
|
|
|
movpd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
movps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [mmx_size],16
|
|
|
|
jmp sse_mov_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
movss_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],4
|
|
|
|
mov [operand_prefix],0F3h
|
|
|
|
jmp sse_movs
|
2006-07-28 17:39:16 +04:00
|
|
|
movsd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0A5h
|
|
|
|
mov ah,[esi]
|
|
|
|
or ah,ah
|
|
|
|
jz simple_instruction_32bit
|
|
|
|
cmp ah,0Fh
|
|
|
|
je simple_instruction_32bit
|
|
|
|
mov [mmx_size],8
|
|
|
|
mov [operand_prefix],0F2h
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_movs:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],10h
|
|
|
|
jmp sse_mov_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_mov_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je sse_xmmreg
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_mem:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
inc [extended_code]
|
|
|
|
call get_address
|
|
|
|
cmp [operand_size],0
|
|
|
|
je sse_mem_xmmreg
|
|
|
|
mov al,[mmx_size]
|
|
|
|
cmp [operand_size],al
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [operand_size],0
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_mem_xmmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movlpd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
movlps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [mmx_size],8
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne sse_mem
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
jmp sse_reg_mem
|
2006-07-28 17:39:16 +04:00
|
|
|
movhlps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
mov [mmx_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je sse_xmmreg_xmmreg_ok
|
|
|
|
jmp invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
maskmovq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov cl,8
|
|
|
|
jmp maskmov_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
maskmovdqu_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov cl,16
|
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
maskmov_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0F7h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,cl
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movmskpd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
movmskps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],50h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [operand_size],0
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cmppd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
cmpps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0C2h
|
|
|
|
mov [mmx_size],16
|
|
|
|
mov byte [value],-1
|
|
|
|
jmp sse_cmp_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp_pd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp_ps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0C2h
|
|
|
|
mov [mmx_size],16
|
|
|
|
mov byte [value],al
|
|
|
|
jmp sse_cmp_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cmpss_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],4
|
|
|
|
mov [operand_prefix],0F3h
|
|
|
|
jmp cmpsx_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cmpsd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,0A7h
|
|
|
|
mov ah,[esi]
|
|
|
|
or ah,ah
|
|
|
|
jz simple_instruction_32bit
|
|
|
|
cmp ah,0Fh
|
|
|
|
je simple_instruction_32bit
|
|
|
|
mov [mmx_size],8
|
|
|
|
mov [operand_prefix],0F2h
|
2006-07-28 17:39:16 +04:00
|
|
|
cmpsx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0C2h
|
|
|
|
mov byte [value],-1
|
|
|
|
jmp sse_cmp_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp_ss_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],4
|
|
|
|
mov [operand_prefix],0F3h
|
|
|
|
jmp cmp_sx_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp_sd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],8
|
|
|
|
mov [operand_prefix],0F2h
|
2006-07-28 17:39:16 +04:00
|
|
|
cmp_sx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0C2h
|
|
|
|
mov byte [value],al
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_cmp_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je sse_cmp_xmmreg_xmmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz sse_cmp_size_ok
|
|
|
|
cmp al,[mmx_size]
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_cmp_size_ok:
|
2006-10-11 02:15:57 +04:00
|
|
|
push ebx ecx edx
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_nextbyte
|
2006-10-11 02:15:57 +04:00
|
|
|
pop edx ecx ebx
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
sse_cmp_xmmreg_xmmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
call get_nextbyte
|
|
|
|
mov al,byte [value]
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
get_nextbyte:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp byte [value],-1
|
|
|
|
jne nextbyte_ok
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
test [operand_size],not 1
|
|
|
|
jnz invalid_value
|
|
|
|
cmp al,'('
|
|
|
|
jne invalid_operand
|
|
|
|
call get_byte_value
|
|
|
|
cmp al,7
|
|
|
|
ja invalid_value
|
|
|
|
mov byte [value],al
|
2006-07-28 17:39:16 +04:00
|
|
|
nextbyte_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtpi2pd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtpi2ps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je cvtpi_xmmreg_xmmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
cmp [operand_size],0
|
|
|
|
je cvtpi_size_ok
|
|
|
|
cmp [operand_size],8
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtpi_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtpi_xmmreg_xmmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtsi2ss_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],0F3h
|
|
|
|
jmp cvtsi_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtsi2sd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],0F2h
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtsi_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,16
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je cvtsi_xmmreg_reg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
cmp [operand_size],0
|
|
|
|
je cvtsi_size_ok
|
|
|
|
cmp [operand_size],4
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtsi_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtsi_xmmreg_reg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
je cvtsi_xmmreg_reg_store
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
call operand_64bit
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtsi_xmmreg_reg_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtps2pi_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],8
|
|
|
|
jmp cvtpd_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtpd2pi_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
|
|
|
mov [mmx_size],16
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtpd_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [operand_size],0
|
|
|
|
jmp sse_reg
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtss2si_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],0F3h
|
|
|
|
mov [mmx_size],4
|
|
|
|
jmp cvt2si_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
cvtsd2si_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],0F2h
|
|
|
|
mov [mmx_size],8
|
2006-07-28 17:39:16 +04:00
|
|
|
cvt2si_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [operand_size],0
|
|
|
|
cmp ah,4
|
|
|
|
je sse_reg
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
call operand_64bit
|
|
|
|
jmp sse_reg
|
2006-10-11 02:15:57 +04:00
|
|
|
|
|
|
|
ssse3_instruction:
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],38h
|
|
|
|
mov [supplemental_code],al
|
|
|
|
jmp mmx_instruction
|
|
|
|
palignr_instruction:
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],3Ah
|
|
|
|
mov [supplemental_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
call make_mmx_prefix
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je palignr_mmreg_mmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
jmp mmx_imm8
|
|
|
|
palignr_mmreg_mmreg:
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
mov bl,al
|
|
|
|
jmp mmx_nomem_imm8
|
2006-07-28 17:39:16 +04:00
|
|
|
amd3dnow_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],0Fh
|
|
|
|
mov byte [value],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
je amd3dnow_mmreg_mmreg
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
call store_instruction_with_imm8
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
amd3dnow_mmreg_mmreg:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov bl,al
|
|
|
|
call store_nomem_instruction
|
|
|
|
mov al,byte [value]
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
fxsave_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],0AEh
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov ah,[operand_size]
|
|
|
|
or ah,ah
|
|
|
|
jz fxsave_size_ok
|
|
|
|
mov al,[postbyte_register]
|
|
|
|
cmp al,111b
|
|
|
|
je clflush_size_check
|
|
|
|
cmp al,10b
|
|
|
|
jb invalid_operand_size
|
|
|
|
cmp al,11b
|
|
|
|
ja invalid_operand_size
|
|
|
|
cmp ah,4
|
|
|
|
jne invalid_operand_size
|
|
|
|
jmp fxsave_size_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
clflush_size_check:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
fxsave_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
prefetch_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],18h
|
2006-07-28 17:39:16 +04:00
|
|
|
prefetch_mem_8bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
or ah,ah
|
|
|
|
jz prefetch_size_ok
|
|
|
|
cmp ah,1
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
prefetch_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call get_address
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
amd_prefetch_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],0Dh
|
|
|
|
jmp prefetch_mem_8bit
|
2006-07-28 17:39:16 +04:00
|
|
|
fence_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov bl,al
|
|
|
|
mov ax,0AE0Fh
|
|
|
|
stos word [edi]
|
|
|
|
mov al,bl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
pause_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ax,90F3h
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movntq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],8
|
|
|
|
jmp movnt_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
movntps_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [mmx_size],16
|
|
|
|
jmp movnt_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
movntdq_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
|
|
|
mov [mmx_size],16
|
2006-07-28 17:39:16 +04:00
|
|
|
movnt_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],al
|
|
|
|
mov [base_code],0Fh
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_mmx_register
|
|
|
|
cmp ah,[mmx_size]
|
|
|
|
jne invalid_operand_size
|
|
|
|
mov [postbyte_register],al
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
movnti_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ah,4
|
|
|
|
je movnti_store
|
|
|
|
cmp ah,8
|
|
|
|
jne invalid_operand_size
|
|
|
|
call operand_64bit
|
2006-07-28 17:39:16 +04:00
|
|
|
movnti_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
monitor_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ax,0400h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ax,0401h
|
|
|
|
jne invalid_operand
|
|
|
|
cmp [postbyte_register],0C8h
|
|
|
|
jne monitor_instruction_store
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ax,0402h
|
|
|
|
jne invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
monitor_instruction_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ax,010Fh
|
|
|
|
stos word [edi]
|
|
|
|
mov al,[postbyte_register]
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
simple_vmx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
mov al,0Fh
|
|
|
|
stos byte [edi]
|
|
|
|
mov al,1
|
|
|
|
stos word [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
vmclear_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],66h
|
|
|
|
jmp vmx_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
vmxon_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [operand_prefix],0F3h
|
2006-07-28 17:39:16 +04:00
|
|
|
vmx_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [postbyte_register],al
|
|
|
|
mov [extended_code],0C7h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
mov al,[operand_size]
|
|
|
|
or al,al
|
|
|
|
jz vmx_size_ok
|
|
|
|
cmp al,8
|
|
|
|
jne invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
vmx_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [base_code],0Fh
|
|
|
|
call store_instruction
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
vmread_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],78h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
2006-07-28 17:39:16 +04:00
|
|
|
vmread_check_size:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je vmread_long
|
|
|
|
cmp [operand_size],4
|
|
|
|
je vmx_size_ok
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
vmread_long:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [operand_size],8
|
|
|
|
je vmx_size_ok
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
vmwrite_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [extended_code],79h
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
mov [postbyte_register],al
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,'['
|
|
|
|
jne invalid_operand
|
|
|
|
call get_address
|
|
|
|
jmp vmread_check_size
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_svm_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
push eax
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],1
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_svm_detect_size:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,2
|
|
|
|
je simple_svm_16bit
|
|
|
|
cmp ah,4
|
|
|
|
je simple_svm_32bit
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_operand_size
|
|
|
|
jmp simple_svm_store
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_svm_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je simple_svm_store
|
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_operand_size
|
|
|
|
jmp prefixed_svm_store
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_svm_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],32
|
|
|
|
je simple_svm_store
|
2006-07-28 17:39:16 +04:00
|
|
|
prefixed_svm_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,67h
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_svm_store:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
pop eax
|
|
|
|
stos byte [edi]
|
|
|
|
jmp instruction_assembled
|
2006-07-28 17:39:16 +04:00
|
|
|
skinit_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ax,0400h
|
|
|
|
jne invalid_operand
|
|
|
|
mov al,0DEh
|
|
|
|
jmp simple_vmx_instruction
|
2006-07-28 17:39:16 +04:00
|
|
|
invlpga_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
push eax
|
|
|
|
mov [base_code],0Fh
|
|
|
|
mov [extended_code],1
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
or al,al
|
|
|
|
jnz invalid_operand
|
|
|
|
mov bl,ah
|
|
|
|
mov [operand_size],0
|
|
|
|
lods byte [esi]
|
|
|
|
cmp al,','
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call get_size_operator
|
|
|
|
cmp al,10h
|
|
|
|
jne invalid_operand
|
|
|
|
lods byte [esi]
|
|
|
|
call convert_register
|
|
|
|
cmp ax,0401h
|
|
|
|
jne invalid_operand
|
|
|
|
mov ah,bl
|
|
|
|
jmp simple_svm_detect_size
|
2006-07-28 17:39:16 +04:00
|
|
|
|
|
|
|
convert_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
shr ah,4
|
|
|
|
and al,0Fh
|
|
|
|
cmp ah,8
|
|
|
|
je match_register_size
|
|
|
|
cmp ah,4
|
|
|
|
ja invalid_operand
|
|
|
|
cmp ah,1
|
|
|
|
ja match_register_size
|
|
|
|
cmp al,4
|
|
|
|
jb match_register_size
|
|
|
|
or ah,ah
|
|
|
|
jz high_byte_register
|
|
|
|
or [rex_prefix],40h
|
2006-07-28 17:39:16 +04:00
|
|
|
match_register_size:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp ah,[operand_size]
|
|
|
|
je register_size_ok
|
|
|
|
cmp [operand_size],0
|
|
|
|
jne operand_sizes_do_not_match
|
|
|
|
mov [operand_size],ah
|
2006-07-28 17:39:16 +04:00
|
|
|
register_size_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
high_byte_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,1
|
|
|
|
or [rex_prefix],80h
|
|
|
|
jmp match_register_size
|
2006-07-28 17:39:16 +04:00
|
|
|
convert_fpu_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
shr ah,4
|
|
|
|
and al,111b
|
|
|
|
cmp ah,10
|
|
|
|
jne invalid_operand
|
|
|
|
jmp match_register_size
|
2006-07-28 17:39:16 +04:00
|
|
|
convert_mmx_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ah,al
|
|
|
|
shr ah,4
|
|
|
|
cmp ah,0Ch
|
|
|
|
je xmm_register
|
|
|
|
ja invalid_operand
|
|
|
|
and al,111b
|
|
|
|
cmp ah,0Bh
|
|
|
|
jne invalid_operand
|
|
|
|
mov ah,8
|
|
|
|
jmp match_register_size
|
2006-07-28 17:39:16 +04:00
|
|
|
xmm_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
and al,0Fh
|
|
|
|
mov ah,16
|
|
|
|
cmp al,8
|
|
|
|
jb match_register_size
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_operand
|
|
|
|
jmp match_register_size
|
2006-07-28 17:39:16 +04:00
|
|
|
get_size_operator:
|
2006-09-22 19:55:59 +04:00
|
|
|
xor ah,ah
|
|
|
|
cmp al,11h
|
|
|
|
jne no_size_operator
|
|
|
|
mov [size_declared],1
|
|
|
|
lods word [esi]
|
|
|
|
xchg al,ah
|
|
|
|
mov [size_override],1
|
|
|
|
cmp ah,[operand_size]
|
|
|
|
je size_operator_ok
|
|
|
|
cmp [operand_size],0
|
|
|
|
jne operand_sizes_do_not_match
|
|
|
|
mov [operand_size],ah
|
2006-07-28 17:39:16 +04:00
|
|
|
size_operator_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
no_size_operator:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [size_declared],0
|
|
|
|
cmp al,'['
|
|
|
|
jne size_operator_ok
|
|
|
|
mov [size_override],0
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
get_jump_operator:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [jump_type],0
|
|
|
|
cmp al,12h
|
|
|
|
jne jump_operator_ok
|
|
|
|
lods word [esi]
|
|
|
|
mov [jump_type],al
|
|
|
|
mov al,ah
|
2006-07-28 17:39:16 +04:00
|
|
|
jump_operator_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
get_address:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [segment_register],0
|
|
|
|
mov [address_size],0
|
|
|
|
mov al,[code_type]
|
|
|
|
shr al,3
|
|
|
|
mov [value_size],al
|
|
|
|
mov al,[esi]
|
|
|
|
and al,11110000b
|
|
|
|
cmp al,60h
|
|
|
|
jne get_size_prefix
|
|
|
|
lods byte [esi]
|
|
|
|
sub al,60h
|
|
|
|
mov [segment_register],al
|
|
|
|
mov al,[esi]
|
|
|
|
and al,11110000b
|
2006-07-28 17:39:16 +04:00
|
|
|
get_size_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,70h
|
|
|
|
jne address_size_prefix_ok
|
|
|
|
lods byte [esi]
|
|
|
|
sub al,70h
|
|
|
|
cmp al,2
|
|
|
|
jb invalid_address_size
|
|
|
|
cmp al,8
|
|
|
|
ja invalid_address_size
|
|
|
|
mov [address_size],al
|
|
|
|
mov [value_size],al
|
2006-07-28 17:39:16 +04:00
|
|
|
address_size_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_address
|
|
|
|
cmp byte [esi-1],']'
|
|
|
|
jne invalid_address
|
|
|
|
mov [address_high],edx
|
|
|
|
mov edx,eax
|
|
|
|
cmp [code_type],64
|
|
|
|
jne address_ok
|
|
|
|
or bx,bx
|
|
|
|
jnz address_ok
|
|
|
|
test ch,0Fh
|
|
|
|
jnz address_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
calculate_relative_address:
|
2006-10-27 11:38:46 +04:00
|
|
|
mov edx,[address_symbol]
|
|
|
|
mov [symbol_identifier],edx
|
2006-10-11 14:51:26 +04:00
|
|
|
mov edx,[address_high]
|
2006-09-22 19:55:59 +04:00
|
|
|
call calculate_relative_offset
|
|
|
|
mov [address_high],edx
|
2006-10-11 14:51:26 +04:00
|
|
|
cdq
|
|
|
|
cmp edx,[address_high]
|
|
|
|
jne value_out_of_range
|
2006-09-22 19:55:59 +04:00
|
|
|
mov edx,eax
|
2006-11-02 17:18:23 +03:00
|
|
|
ror ecx,16
|
|
|
|
mov cl,[value_type]
|
|
|
|
rol ecx,16
|
2006-09-22 19:55:59 +04:00
|
|
|
mov bx,0FF00h
|
2006-07-28 17:39:16 +04:00
|
|
|
address_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
operand_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je size_prefix_ok
|
|
|
|
mov [operand_prefix],66h
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
operand_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
jne size_prefix_ok
|
|
|
|
mov [operand_prefix],66h
|
2006-07-28 17:39:16 +04:00
|
|
|
size_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
operand_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne illegal_instruction
|
|
|
|
or [rex_prefix],48h
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
operand_autodetect:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,2
|
|
|
|
je operand_16bit
|
|
|
|
cmp al,4
|
|
|
|
je operand_32bit
|
|
|
|
cmp al,8
|
|
|
|
je operand_64bit
|
|
|
|
jmp invalid_operand_size
|
2006-07-28 17:39:16 +04:00
|
|
|
store_segment_prefix_if_necessary:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[segment_register]
|
|
|
|
or al,al
|
|
|
|
jz segment_prefix_ok
|
|
|
|
cmp al,3
|
|
|
|
je ss_prefix
|
|
|
|
cmp al,4
|
|
|
|
ja segment_prefix_386
|
|
|
|
jb segment_prefix_86
|
|
|
|
cmp bl,25h
|
|
|
|
je segment_prefix_86
|
|
|
|
cmp bh,25h
|
|
|
|
je segment_prefix_86
|
|
|
|
cmp bh,45h
|
|
|
|
je segment_prefix_86
|
|
|
|
cmp bh,44h
|
|
|
|
je segment_prefix_86
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
ss_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp bl,25h
|
|
|
|
je segment_prefix_ok
|
|
|
|
cmp bh,25h
|
|
|
|
je segment_prefix_ok
|
|
|
|
cmp bh,45h
|
|
|
|
je segment_prefix_ok
|
|
|
|
cmp bh,44h
|
|
|
|
je segment_prefix_ok
|
|
|
|
jmp segment_prefix_86
|
2006-07-28 17:39:16 +04:00
|
|
|
store_segment_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[segment_register]
|
|
|
|
or al,al
|
|
|
|
jz segment_prefix_ok
|
|
|
|
cmp al,5
|
|
|
|
jae segment_prefix_386
|
2006-07-28 17:39:16 +04:00
|
|
|
segment_prefix_86:
|
2006-09-22 19:55:59 +04:00
|
|
|
dec al
|
|
|
|
shl al,3
|
|
|
|
add al,26h
|
|
|
|
stos byte [edi]
|
|
|
|
jmp segment_prefix_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
segment_prefix_386:
|
2006-09-22 19:55:59 +04:00
|
|
|
add al,64h-5
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
segment_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
store_instruction_code:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[operand_prefix]
|
|
|
|
or al,al
|
|
|
|
jz operand_prefix_ok
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
operand_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[rex_prefix]
|
|
|
|
test al,40h
|
|
|
|
jz rex_prefix_ok
|
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_operand
|
|
|
|
test al,0B0h
|
|
|
|
jnz prefix_conflict
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
rex_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[base_code]
|
|
|
|
stos byte [edi]
|
|
|
|
cmp al,0Fh
|
|
|
|
jne instruction_code_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
store_extended_code:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,[extended_code]
|
|
|
|
stos byte [edi]
|
2006-10-11 02:15:57 +04:00
|
|
|
cmp al,38h
|
|
|
|
je store_supplemental_code
|
|
|
|
cmp al,3Ah
|
|
|
|
je store_supplemental_code
|
2006-07-28 17:39:16 +04:00
|
|
|
instruction_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-10-11 02:15:57 +04:00
|
|
|
store_supplemental_code:
|
|
|
|
mov al,[supplemental_code]
|
|
|
|
stos byte [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
store_nomem_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
test [postbyte_register],1000b
|
|
|
|
jz nomem_reg_code_ok
|
|
|
|
or [rex_prefix],44h
|
|
|
|
and [postbyte_register],111b
|
2006-07-28 17:39:16 +04:00
|
|
|
nomem_reg_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
test bl,1000b
|
|
|
|
jz nomem_rm_code_ok
|
|
|
|
or [rex_prefix],41h
|
|
|
|
and bl,111b
|
2006-07-28 17:39:16 +04:00
|
|
|
nomem_rm_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
mov al,[postbyte_register]
|
|
|
|
shl al,3
|
|
|
|
or al,bl
|
|
|
|
or al,11000000b
|
|
|
|
stos byte [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
store_instruction:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [current_offset],edi
|
|
|
|
test [postbyte_register],1000b
|
|
|
|
jz reg_code_ok
|
|
|
|
or [rex_prefix],44h
|
|
|
|
and [postbyte_register],111b
|
2006-07-28 17:39:16 +04:00
|
|
|
reg_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_segment_prefix_if_necessary
|
|
|
|
or bx,bx
|
|
|
|
jz address_immediate
|
2006-10-11 14:51:26 +04:00
|
|
|
cmp bx,0F800h
|
2006-09-22 19:55:59 +04:00
|
|
|
je address_rip_based
|
2006-10-11 14:51:26 +04:00
|
|
|
cmp bx,0F400h
|
|
|
|
je address_eip_based
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp bx,0FF00h
|
|
|
|
je address_relative
|
|
|
|
mov al,bl
|
|
|
|
or al,bh
|
|
|
|
and al,11110000b
|
|
|
|
cmp al,80h
|
|
|
|
je postbyte_64bit
|
|
|
|
cmp al,40h
|
|
|
|
je postbyte_32bit
|
|
|
|
cmp al,20h
|
|
|
|
jne invalid_address
|
|
|
|
cmp [code_type],64
|
|
|
|
je invalid_address_size
|
|
|
|
call address_16bit_prefix
|
|
|
|
call store_instruction_code
|
|
|
|
cmp bx,2326h
|
|
|
|
je address_bx_si
|
|
|
|
cmp bx,2623h
|
|
|
|
je address_bx_si
|
|
|
|
cmp bx,2327h
|
|
|
|
je address_bx_di
|
|
|
|
cmp bx,2723h
|
|
|
|
je address_bx_di
|
|
|
|
cmp bx,2526h
|
|
|
|
je address_bp_si
|
|
|
|
cmp bx,2625h
|
|
|
|
je address_bp_si
|
|
|
|
cmp bx,2527h
|
|
|
|
je address_bp_di
|
|
|
|
cmp bx,2725h
|
|
|
|
je address_bp_di
|
|
|
|
cmp bx,2600h
|
|
|
|
je address_si
|
|
|
|
cmp bx,2700h
|
|
|
|
je address_di
|
|
|
|
cmp bx,2300h
|
|
|
|
je address_bx
|
|
|
|
cmp bx,2500h
|
|
|
|
je address_bp
|
|
|
|
jmp invalid_address
|
2006-07-28 17:39:16 +04:00
|
|
|
address_bx_si:
|
2006-09-22 19:55:59 +04:00
|
|
|
xor al,al
|
|
|
|
jmp postbyte_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_bx_di:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,1
|
|
|
|
jmp postbyte_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_bp_si:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,10b
|
|
|
|
jmp postbyte_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_bp_di:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,11b
|
|
|
|
jmp postbyte_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_si:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,100b
|
|
|
|
jmp postbyte_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_di:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,101b
|
|
|
|
jmp postbyte_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_bx:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,111b
|
|
|
|
jmp postbyte_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_bp:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,110b
|
2006-07-28 17:39:16 +04:00
|
|
|
postbyte_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,22h
|
|
|
|
jnz address_16bit_value
|
|
|
|
or ch,ch
|
|
|
|
jnz address_sizes_do_not_agree
|
|
|
|
cmp edx,10000h
|
|
|
|
jge value_out_of_range
|
|
|
|
cmp edx,-8000h
|
|
|
|
jl value_out_of_range
|
|
|
|
or dx,dx
|
|
|
|
jz address
|
|
|
|
cmp dx,80h
|
|
|
|
jb address_8bit_value
|
|
|
|
cmp dx,-80h
|
|
|
|
jae address_8bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
address_16bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,10000000b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
|
|
|
mov eax,edx
|
|
|
|
stos word [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
address_8bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,01000000b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
cmp dx,80h
|
|
|
|
jge value_out_of_range
|
|
|
|
cmp dx,-80h
|
|
|
|
jl value_out_of_range
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
address:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,110b
|
|
|
|
je address_8bit_value
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
postbyte_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
jmp address_prefix_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
postbyte_64bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address_size
|
2006-07-28 17:39:16 +04:00
|
|
|
address_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
test bh,1000b
|
|
|
|
jz base_code_ok
|
|
|
|
or [rex_prefix],41h
|
2006-07-28 17:39:16 +04:00
|
|
|
base_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
test bl,1000b
|
|
|
|
jz index_code_ok
|
|
|
|
or [rex_prefix],42h
|
2006-07-28 17:39:16 +04:00
|
|
|
index_code_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
cmp bl,44h
|
|
|
|
je swap_base_with_index
|
|
|
|
cmp bl,84h
|
|
|
|
jne base_register_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
swap_base_with_index:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp cl,1
|
|
|
|
jne invalid_address
|
|
|
|
xchg bl,bh
|
|
|
|
cmp bl,44h
|
|
|
|
je invalid_address
|
|
|
|
cmp bl,84h
|
|
|
|
je invalid_address
|
2006-07-28 17:39:16 +04:00
|
|
|
base_register_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
or cl,cl
|
|
|
|
jz only_base_register
|
2006-07-28 17:39:16 +04:00
|
|
|
base_and_index:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,100b
|
|
|
|
xor ah,ah
|
|
|
|
cmp cl,1
|
|
|
|
je scale_ok
|
|
|
|
cmp cl,2
|
|
|
|
je scale_1
|
|
|
|
cmp cl,4
|
|
|
|
je scale_2
|
|
|
|
or ah,11000000b
|
|
|
|
jmp scale_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
scale_2:
|
2006-09-22 19:55:59 +04:00
|
|
|
or ah,10000000b
|
|
|
|
jmp scale_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
scale_1:
|
2006-09-22 19:55:59 +04:00
|
|
|
or ah,01000000b
|
2006-07-28 17:39:16 +04:00
|
|
|
scale_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
or bh,bh
|
|
|
|
jz only_index_register
|
|
|
|
and bl,111b
|
|
|
|
shl bl,3
|
|
|
|
or ah,bl
|
|
|
|
and bh,111b
|
|
|
|
or ah,bh
|
|
|
|
test ch,44h
|
|
|
|
jnz sib_address_32bit_value
|
|
|
|
test ch,88h
|
|
|
|
jnz sib_address_32bit_value
|
|
|
|
or ch,ch
|
|
|
|
jnz address_sizes_do_not_agree
|
|
|
|
cmp bh,5
|
|
|
|
je address_value
|
|
|
|
or edx,edx
|
|
|
|
jz sib_address
|
2006-07-28 17:39:16 +04:00
|
|
|
address_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp edx,80h
|
|
|
|
jb sib_address_8bit_value
|
|
|
|
cmp edx,-80h
|
|
|
|
jae sib_address_8bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
sib_address_32bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,10000000b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos word [edi]
|
|
|
|
jmp store_address_32bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
sib_address_8bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,01000000b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos word [edi]
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
cmp edx,80h
|
|
|
|
jge value_out_of_range
|
|
|
|
cmp edx,-80h
|
|
|
|
jl value_out_of_range
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
sib_address:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos word [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
only_index_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
or ah,101b
|
|
|
|
and bl,111b
|
|
|
|
shl bl,3
|
|
|
|
or ah,bl
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos word [edi]
|
|
|
|
test ch,44h
|
|
|
|
jnz store_address_32bit_value
|
|
|
|
or ch,ch
|
|
|
|
jnz invalid_address_size
|
|
|
|
jmp store_address_32bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
zero_index_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov bl,4
|
|
|
|
mov cl,1
|
|
|
|
jmp base_and_index
|
2006-07-28 17:39:16 +04:00
|
|
|
only_base_register:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,bh
|
|
|
|
and al,111b
|
|
|
|
cmp al,4
|
|
|
|
je zero_index_register
|
|
|
|
test ch,44h
|
|
|
|
jnz simple_address_32bit_value
|
|
|
|
test ch,88h
|
|
|
|
jnz simple_address_32bit_value
|
|
|
|
or ch,ch
|
|
|
|
jnz address_sizes_do_not_agree
|
|
|
|
or edx,edx
|
|
|
|
jz simple_address
|
|
|
|
cmp edx,80h
|
|
|
|
jb simple_address_8bit_value
|
|
|
|
cmp edx,-80h
|
|
|
|
jae simple_address_8bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_address_32bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,10000000b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
|
|
|
jmp store_address_32bit_value
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_address_8bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
or al,01000000b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
|
|
|
mov al,dl
|
|
|
|
stos byte [edi]
|
|
|
|
cmp edx,80h
|
|
|
|
jge value_out_of_range
|
|
|
|
cmp edx,-80h
|
|
|
|
jl value_out_of_range
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
simple_address:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp al,5
|
|
|
|
je simple_address_8bit_value
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
address_immediate:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
je address_immediate_sib
|
|
|
|
test ch,44h
|
|
|
|
jnz address_immediate_32bit
|
|
|
|
test ch,22h
|
|
|
|
jnz address_immediate_16bit
|
|
|
|
or ch,ch
|
|
|
|
jnz invalid_address_size
|
|
|
|
cmp [code_type],16
|
|
|
|
je addressing_16bit
|
2006-07-28 17:39:16 +04:00
|
|
|
address_immediate_32bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
|
|
|
call store_instruction_code
|
2006-07-28 17:39:16 +04:00
|
|
|
store_immediate_address:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov al,101b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
store_address_32bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,0F0h
|
|
|
|
jz address_32bit_relocation_ok
|
2006-10-11 02:15:57 +04:00
|
|
|
mov eax,ecx
|
|
|
|
shr eax,16
|
2006-09-22 19:55:59 +04:00
|
|
|
xchg [value_type],al
|
|
|
|
mov ebx,[address_symbol]
|
|
|
|
xchg ebx,[symbol_identifier]
|
|
|
|
call mark_relocation
|
|
|
|
mov [value_type],al
|
|
|
|
mov [symbol_identifier],ebx
|
2006-07-28 17:39:16 +04:00
|
|
|
address_32bit_relocation_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov eax,edx
|
|
|
|
stos dword [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
store_address_64bit_value:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,0F0h
|
|
|
|
jz address_64bit_relocation_ok
|
2006-10-11 02:15:57 +04:00
|
|
|
mov eax,ecx
|
|
|
|
shr eax,16
|
2006-09-22 19:55:59 +04:00
|
|
|
xchg [value_type],al
|
|
|
|
mov ebx,[address_symbol]
|
|
|
|
xchg ebx,[symbol_identifier]
|
|
|
|
call mark_relocation
|
|
|
|
mov [value_type],al
|
|
|
|
mov [symbol_identifier],ebx
|
2006-07-28 17:39:16 +04:00
|
|
|
address_64bit_relocation_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov eax,edx
|
|
|
|
stos dword [edi]
|
|
|
|
mov eax,[address_high]
|
|
|
|
stos dword [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
address_immediate_sib:
|
2006-09-22 19:55:59 +04:00
|
|
|
test ch,not 44h
|
|
|
|
jnz invalid_address_size
|
2006-10-11 02:15:57 +04:00
|
|
|
test ecx,0FF0000h
|
|
|
|
jnz address_immediate_sib_nosignextend
|
2006-09-22 19:55:59 +04:00
|
|
|
test edx,80000000h
|
|
|
|
jz address_immediate_sib_prefix_ok
|
2006-07-28 17:39:16 +04:00
|
|
|
address_immediate_sib_nosignextend:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_32bit_prefix
|
2006-07-28 17:39:16 +04:00
|
|
|
address_immediate_sib_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
mov al,100b
|
|
|
|
mov ah,100101b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos word [edi]
|
|
|
|
jmp store_address_32bit_value
|
2006-10-11 14:51:26 +04:00
|
|
|
address_eip_based:
|
|
|
|
mov al,67h
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
address_rip_based:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],64
|
|
|
|
jne invalid_address
|
|
|
|
call store_instruction_code
|
|
|
|
jmp store_immediate_address
|
2006-07-28 17:39:16 +04:00
|
|
|
address_relative:
|
2006-09-22 19:55:59 +04:00
|
|
|
call store_instruction_code
|
|
|
|
movzx eax,[immediate_size]
|
|
|
|
add eax,edi
|
|
|
|
sub eax,[current_offset]
|
|
|
|
add eax,5
|
|
|
|
sub edx,eax
|
|
|
|
jo value_out_of_range
|
|
|
|
mov al,101b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
2006-10-11 02:15:57 +04:00
|
|
|
shr ecx,16
|
|
|
|
xchg [value_type],cl
|
2006-09-22 19:55:59 +04:00
|
|
|
mov ebx,[address_symbol]
|
|
|
|
xchg ebx,[symbol_identifier]
|
|
|
|
mov eax,edx
|
|
|
|
call mark_relocation
|
2006-10-11 02:15:57 +04:00
|
|
|
mov [value_type],cl
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [symbol_identifier],ebx
|
|
|
|
stos dword [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
addressing_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp edx,10000h
|
|
|
|
jge address_immediate_32bit
|
|
|
|
cmp edx,-8000h
|
|
|
|
jl address_immediate_32bit
|
|
|
|
movzx edx,dx
|
2006-07-28 17:39:16 +04:00
|
|
|
address_immediate_16bit:
|
2006-09-22 19:55:59 +04:00
|
|
|
call address_16bit_prefix
|
|
|
|
call store_instruction_code
|
|
|
|
mov al,110b
|
|
|
|
mov cl,[postbyte_register]
|
|
|
|
shl cl,3
|
|
|
|
or al,cl
|
|
|
|
stos byte [edi]
|
|
|
|
mov eax,edx
|
|
|
|
stos word [edi]
|
|
|
|
cmp edx,10000h
|
|
|
|
jge value_out_of_range
|
|
|
|
cmp edx,-8000h
|
|
|
|
jl value_out_of_range
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
address_16bit_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],16
|
|
|
|
je instruction_prefix_ok
|
|
|
|
mov al,67h
|
|
|
|
stos byte [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
address_32bit_prefix:
|
2006-09-22 19:55:59 +04:00
|
|
|
cmp [code_type],32
|
|
|
|
je instruction_prefix_ok
|
|
|
|
mov al,67h
|
|
|
|
stos byte [edi]
|
2006-07-28 17:39:16 +04:00
|
|
|
instruction_prefix_ok:
|
2006-09-22 19:55:59 +04:00
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
store_instruction_with_imm8:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [immediate_size],1
|
|
|
|
call store_instruction
|
|
|
|
mov al,byte [value]
|
|
|
|
stos byte [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
store_instruction_with_imm16:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [immediate_size],2
|
|
|
|
call store_instruction
|
|
|
|
mov ax,word [value]
|
|
|
|
call mark_relocation
|
|
|
|
stos word [edi]
|
|
|
|
ret
|
2006-07-28 17:39:16 +04:00
|
|
|
store_instruction_with_imm32:
|
2006-09-22 19:55:59 +04:00
|
|
|
mov [immediate_size],4
|
|
|
|
call store_instruction
|
|
|
|
mov eax,dword [value]
|
|
|
|
call mark_relocation
|
|
|
|
stos dword [edi]
|
|
|
|
ret
|