Commit a21ad51a authored by Tomasz Buchert's avatar Tomasz Buchert

Imported Upstream version 1.71.42

parent 308fb0f8
No preview for this file type
......@@ -54,7 +54,8 @@ Chapter 2 Instruction set
2.1.21 AVX instructions
2.1.22 AVX2 instructions
2.1.23 Auxiliary sets of computational instructions
2.1.24 Other extensions of instruction set
2.1.24 AVX-512 instructions
2.1.25 Other extensions of instruction set
2.2 Control directives
2.2.1 Numerical constants
......@@ -3154,7 +3155,12 @@ and writes the result to destination. These instructions have the same rules
for operands as "blsi".
2.1.24 Other extensions of instruction set
2.1.24 AVX-512 instructions
[This section has not been written yet.]
2.1.25 Other extensions of instruction set
There is a number of additional instruction set extensions recognized by flat
assembler, and the general syntax of the instructions introduced by those
......@@ -3954,13 +3960,13 @@ of "mov" extended with the macroinstructions defined above, you can disable
syntax with three operands back by using "purge mov" directive. Next
"purge mov" will disable also syntax for two operands being segment registers,
and all the next such directives will do nothing.
If after the "macro" directive you enclose some group of arguments' names in
square brackets, it will allow giving more values for this group of arguments
when using that macroinstruction. Any more argument given after the last
argument of such group will begin the new group and will become the first
argument of it. That's why after closing the square bracket no more argument
names can follow. The contents of macroinstruction will be processed for each
such group of arguments separately. The simplest example is to enclose one
If after the "macro" directive you enclose a group of argument declarations
in square brackets, it will allow giving more values for this group of arguments
when using that macroinstruction. Any additional argument following the last
argument of such group will start the new group and will become the first
argument of it. For this reason after the closing square bracket no more
argument names can follow. The contents of macroinstruction will be processed for
each such group of arguments separately. The simplest example is to enclose one
argument name in square brackets:
macro stoschar [char]
......
flat assembler version 1.71
Copyright (c) 1999-2013, Tomasz Grysztar.
Copyright (c) 1999-2015, Tomasz Grysztar.
All rights reserved.
This program is free for commercial and non-commercial use as long as
......
......@@ -32,6 +32,7 @@ assembler:
mov [next_pass_needed],al
mov [output_format],al
mov [adjustment_sign],al
mov [evex_mode],al
mov [code_type],16
call init_addressing_space
pass_loop:
......@@ -330,7 +331,7 @@ assemble_line:
jb invalid_use_of_symbol
je reserved_word_used_as_symbol
push eax
or [size_override],-1
or [operand_flags],1
call get_value
pop ebx
xor cl,cl
......@@ -433,15 +434,15 @@ assemble_line:
jmp continue_line
assemble_instruction:
; mov [operand_size],0
; mov [size_override],0
; mov [operand_flags],0
; mov [operand_prefix],0
; mov [opcode_prefix],0
and dword [operand_size],0
; mov [rex_prefix],0
and dword [operand_size],0
; mov [opcode_prefix],0
; mov [vex_required],0
; mov [vex_register],0
; mov [immediate_size],0
and dword [rex_prefix],0
and dword [opcode_prefix],0
call instruction_handler
instruction_handler:
movzx ebx,word [esi]
......@@ -650,7 +651,7 @@ load_directive:
push ebx
cmp byte [esi],'.'
je invalid_value
or [size_override],-1
or [operand_flags],1
call get_address_value
pop ebp
call calculate_relative_offset
......@@ -697,7 +698,7 @@ store_directive:
mov [operand_size],1
jmp store_value_ok
sized_store:
or [size_override],-1
or [operand_flags],1
call get_value
store_value_ok:
cmp [value_type],0
......@@ -1356,7 +1357,7 @@ data_bytes:
inc esi
or eax,eax
jz duplicate_zero_times
cmp byte [esi],'{'
cmp byte [esi],91h
jne duplicate_single_data_value
inc esi
duplicate_data:
......@@ -1368,7 +1369,7 @@ data_bytes:
lods byte [esi]
cmp al,','
je duplicated_values
cmp al,'}'
cmp al,92h
jne invalid_argument
pop ebx eax
dec eax
......@@ -1386,13 +1387,13 @@ data_bytes:
mov esi,ebx
jmp duplicate_single_data_value
duplicate_zero_times:
cmp byte [esi],'{'
cmp byte [esi],91h
jne skip_single_data_value
inc esi
skip_data_value:
call skip_symbol
jc invalid_argument
cmp byte [esi],'}'
cmp byte [esi],92h
jne skip_data_value
inc esi
jmp data_defined
......
This diff is collapsed.
......@@ -204,14 +204,8 @@ calculate_expression:
mov al,[ebx+10]
or al,al
jz calculation_loop
cmp [size_override],-1
je calculation_loop
cmp [size_override],0
je check_size
cmp [operand_size],0
jne calculation_loop
mov [operand_size],al
jmp calculation_loop
test [operand_flags],1
jnz calculation_loop
check_size:
xchg [operand_size],al
or al,al
......@@ -1216,7 +1210,7 @@ calculate_expression:
get_byte_value:
mov [value_size],1
mov [size_override],-1
or [operand_flags],1
call calculate_value
or al,al
jz check_byte_value
......@@ -1260,7 +1254,7 @@ get_byte_value:
ret
get_word_value:
mov [value_size],2
mov [size_override],-1
or [operand_flags],1
call calculate_value
cmp al,2
jb check_word_value
......@@ -1283,7 +1277,7 @@ get_word_value:
ret
get_dword_value:
mov [value_size],4
mov [size_override],-1
or [operand_flags],1
call calculate_value
cmp al,4
jne check_dword_value
......@@ -1311,7 +1305,7 @@ get_dword_value:
ret
get_pword_value:
mov [value_size],6
mov [size_override],-1
or [operand_flags],1
call calculate_value
cmp al,4
jne check_pword_value
......@@ -1330,7 +1324,7 @@ get_pword_value:
ret
get_qword_value:
mov [value_size],8
mov [size_override],-1
or [operand_flags],1
call calculate_value
check_qword_value:
mov eax,[edi]
......@@ -1338,7 +1332,7 @@ get_qword_value:
ret
get_count_value:
mov [value_size],8
mov [size_override],-1
or [operand_flags],1
call calculate_expression
cmp word [edi+8],0
jne invalid_value
......@@ -1507,33 +1501,31 @@ get_address_value:
mov ax,bx
shr ah,4
shr al,4
cmp ah,0Ch
je check_vsib_address
cmp ah,0Dh
je check_vsib_address
cmp al,0Ch
je check_vsib_address
cmp al,0Dh
je check_vsib_address
or bh,bh
jz check_address_registers
or bl,bl
jz check_address_registers
cmp al,ah
jne invalid_address
jne check_vsib
check_address_registers:
or al,ah
cmp al,0Ch
jae check_vsib
cmp al,6
je check_vsib
cmp al,7
je check_vsib
mov ah,[address_size]
and ah,0Fh
jz address_registers_sizes_ok
cmp al,ah
jne address_sizes_do_not_match
jne invalid_address
address_registers_sizes_ok:
cmp al,4
je sib_allowed
cmp al,8
je sib_allowed
cmp al,0Fh
cmp al,9
je check_ip_relative_address
cmp cl,1
ja invalid_address
......@@ -1550,9 +1542,9 @@ get_address_value:
check_ip_relative_address:
or bl,bl
jnz invalid_address
cmp bh,0F8h
cmp bh,98h
je check_rip_relative_address
cmp bh,0F4h
cmp bh,94h
jne invalid_address
cmp [free_address_range],0
je check_dword_value
......@@ -1665,35 +1657,41 @@ get_address_value:
and al,cl
jz check_immediate_address
jmp invalid_address
check_vsib_address:
cmp ah,0Ch
je swap_vsib_registers
cmp ah,0Dh
jne check_vsib_base
swap_vsib_registers:
cmp cl,1
ja invalid_address
xchg bl,bh
mov cl,1
check_vsib:
xor ah,ah
check_vsib_base:
test bh,bh
jz vsib_base_ok
jz check_vsib_index
mov al,bh
shr al,4
cmp al,4
je vsib_base_ok
je check_vsib_base_size
cmp [code_type],64
jne invalid_address
jne swap_vsib_registers
cmp al,8
jne swap_vsib_registers
check_vsib_base_size:
mov ah,[address_size]
and ah,0Fh
jz check_vsib_index
cmp al,ah
jne invalid_address
vsib_base_ok:
check_vsib_index:
mov al,bl
shr al,4
cmp al,0Ch
je check_index_scale
cmp al,0Dh
and al,0E0h
cmp al,0C0h
jae check_index_scale
cmp al,60h
je check_index_scale
jmp invalid_address
swap_vsib_registers:
xor al,-1
jz invalid_address
cmp cl,1
ja invalid_address
xchg bl,bh
mov cl,1
jmp check_vsib_base
calculate_relative_offset:
cmp [value_undefined],0
......@@ -1785,7 +1783,7 @@ calculate_logical_expression:
jmp logical_loop
get_value_for_comparison:
mov [value_size],8
mov [size_override],-1
or [operand_flags],1
lods byte [esi]
call calculate_expression
cmp byte [edi+8],0
......@@ -1816,7 +1814,7 @@ calculate_logical_expression:
negation_ok:
push eax
mov al,[esi]
cmp al,'{'
cmp al,91h
je logical_expression
cmp al,0FFh
je invalid_expression
......@@ -1838,7 +1836,7 @@ calculate_logical_expression:
jz logical_number
cmp al,0Fh
je logical_number
cmp al,'}'
cmp al,92h
je logical_number
cmp al,'&'
je logical_number
......@@ -2079,7 +2077,7 @@ calculate_logical_expression:
mov [logical_value_wrapping],dl
push eax
lods byte [esi]
cmp al,'}'
cmp al,92h
jne invalid_expression
pop eax
logical_value_ok:
......
......@@ -151,16 +151,13 @@ convert_number:
shr ah,4
cmp ah,4
je register_value
and ah,not 1
cmp ah,8
je register_value
cmp ah,0Ch
jae register_value
cmp ah,6
je register_value
cmp ah,0Dh
je register_value
cmp ah,0Fh
je register_value
cmp ah,2
jne no_address_register
cmp al,23h
je register_value
cmp al,25h
......@@ -916,7 +913,7 @@ preevaluate_logical_expression:
je preevaluate_or
cmp dl,'&'
je preevaluate_and
cmp dl,'}'
cmp dl,92h
je preevaluation_done
or dl,dl
jnz invalid_logical_expression
......@@ -991,7 +988,7 @@ preevaluate_logical_expression:
jmp skip_logical_value
negation_skipped:
mov al,[esi]
cmp al,'{'
cmp al,91h
jne skip_simple_logical_value
inc esi
xchg al,[logical_value_wrapping]
......@@ -1007,7 +1004,7 @@ preevaluate_logical_expression:
je skip_logical_expression
cmp al,'&'
je skip_logical_expression
cmp al,'}'
cmp al,92h
jne wrongly_structured_logical_expression
pop eax
mov [logical_value_wrapping],al
......@@ -1030,13 +1027,13 @@ preevaluate_logical_expression:
je logical_value_skipped
cmp al,'&'
je logical_value_skipped
cmp al,'{'
cmp al,91h
je skip_logical_value_internal_parenthesis
cmp al,'}'
cmp al,92h
jne skip_logical_value_symbol
sub [logical_value_parentheses],1
jnc skip_logical_value_symbol
cmp [logical_value_wrapping],'{'
cmp [logical_value_wrapping],91h
jne skip_logical_value_symbol
jmp logical_value_skipped
skip_logical_value_internal_parenthesis:
......@@ -1053,7 +1050,7 @@ preevaluate_logical_expression:
jmp preevaluate_negation
preevaluate_negation_ok:
mov ebx,esi
cmp byte [esi],'{'
cmp byte [esi],91h
jne preevaluate_simple_logical_value
lods byte [esi]
stos byte [edi]
......@@ -1066,7 +1063,7 @@ preevaluate_logical_expression:
pop ebp
cmp al,0FFh
je invalid_logical_value
cmp byte [esi],'}'
cmp byte [esi],92h
jne invalid_logical_value
or al,al
jnz preevaluated_expression_value
......@@ -1093,9 +1090,9 @@ preevaluate_logical_expression:
mov al,[esi]
or al,al
jz logical_value_boundaries_found
cmp al,'{'
cmp al,91h
je logical_value_internal_parentheses
cmp al,'}'
cmp al,92h
je logical_value_boundaries_parenthesis_close
cmp al,'|'
je logical_value_boundaries_found
......@@ -1120,7 +1117,7 @@ preevaluate_logical_expression:
logical_value_boundaries_parenthesis_close:
sub [logical_value_parentheses],1
jnc next_symbol_in_logical_value
cmp [logical_value_wrapping],'{'
cmp [logical_value_wrapping],91h
jne next_symbol_in_logical_value
logical_value_boundaries_found:
or edx,edx
......
......@@ -34,6 +34,7 @@ parser:
add esi,16
parse_line:
mov [formatter_symbols_allowed],0
mov [decorator_symbols_allowed],0
cmp byte [esi],1Ah
jne empty_instruction
push edi
......@@ -529,15 +530,20 @@ parse_line_contents:
cmp al,']'
je separator
cmp al,'{'
je unallowed_character
je open_decorator
cmp al,'}'
je unallowed_character
je close_decorator
cmp al,'#'
je unallowed_character
cmp al,'`'
je unallowed_character
cmp al,3Bh
je foreign_argument
cmp [decorator_symbols_allowed],0
je not_a_separator
cmp al,'-'
je separator
not_a_separator:
dec esi
cmp al,1Ah
jne expression_argument
......@@ -825,7 +831,7 @@ parse_line_contents:
jb stack_overflow
push esi edi
inc esi
mov al,'{'
mov al,91h
stos byte [edi]
inc [parenthesis_stack]
jmp parse_argument
......@@ -908,8 +914,9 @@ parse_line_contents:
jne unknown_segment_prefix
mov al,ah
and ah,11110000b
cmp ah,60h
cmp ah,30h
jne unknown_segment_prefix
add al,30h
stos byte [edi]
jmp convert_address
unknown_segment_prefix:
......@@ -928,13 +935,19 @@ parse_line_contents:
cmp byte [esi],'('
jne argument_parsed
inc esi
mov al,'{'
mov al,91h
jmp separator
unallowed_character:
mov al,0FFh
jmp separator
open_decorator:
inc [decorator_symbols_allowed]
jmp separator
close_decorator:
dec [decorator_symbols_allowed]
jmp separator
close_parenthesis:
mov al,'}'
mov al,92h
separator:
stos byte [edi]
argument_parsed:
......@@ -1049,7 +1062,7 @@ get_symbol:
mov ecx,ebp
cmp cl,11
ja no_symbol
sub cl,2
sub cl,1
jc no_symbol
movzx ebx,word [symbols+ecx*4]
add ebx,symbols
......@@ -1070,6 +1083,8 @@ get_symbol:
mov ax,[edi]
cmp al,18h
jb symbol_ok
cmp al,1Fh
je decorator_symbol
cmp [formatter_symbols_allowed],0
je no_symbol
symbol_ok:
......@@ -1077,6 +1092,9 @@ get_symbol:
add esi,ebp
clc
ret
decorator_symbol:
cmp [decorator_symbols_allowed],0
jne symbol_ok
no_symbol:
pop esi
mov ecx,ebp
......
This diff is collapsed.
......@@ -70,6 +70,7 @@ adjustment dq ?
symbol_identifier dd ?
address_symbol dd ?
address_high dd ?
uncompressed_displacement dd ?
format_flags dd ?
resolver_flags dd ?
symbols_stream dd ?
......@@ -97,13 +98,16 @@ logical_value_parentheses dd ?
file_extension dd ?
operand_size db ?
size_override db ?
operand_flags db ?
operand_prefix db ?
opcode_prefix db ?
rex_prefix db ?
opcode_prefix db ?
vex_required db ?
vex_register db ?
immediate_size db ?
mask_register db ?
broadcast_size db ?
rounding_mode db ?
base_code db ?
extended_code db ?
......@@ -119,6 +123,7 @@ value_size db ?
address_size db ?
label_size db ?
size_declared db ?
displacement_compression db ?
value_undefined db ?
value_constant db ?
......@@ -133,11 +138,13 @@ next_pass_needed db ?
output_format db ?
code_type db ?
adjustment_sign db ?
evex_mode db ?
macro_status db ?
skip_default_argument_value db ?
prefixed_instruction db ?
formatter_symbols_allowed db ?
decorator_symbols_allowed db ?
free_address_range db ?
......
......@@ -33,7 +33,7 @@
; cannot simply be copied and put under another distribution licence
; (including the GNU Public Licence).
VERSION_STRING equ "1.71.39"
VERSION_STRING equ "1.71.42"
VERSION_MAJOR = 1
VERSION_MINOR = 71
This diff is collapsed.
......@@ -274,7 +274,7 @@ write_address_register:
find_register:
lodsb
test al,al
jz register_found
jz register_not_found
cmp al,bl
je register_found
cmp bl,[esi]
......@@ -283,10 +283,20 @@ write_address_register:
movzx eax,al
add esi,eax
jmp find_register
register_not_found:
mov al,bl
shr al,5
cmp al,0Ch shr 1
je xmm_register
cmp al,0Eh shr 1
je ymm_register
cmp al,6 shr 1
je zmm_register
register_found:
lodsb
movzx ecx,al
rep movsb
write_register_scale:
pop esi
cmp bh,1
je register_ok
......@@ -296,6 +306,23 @@ write_address_register:
call write_dec_number
register_ok:
ret
zmm_register:
mov al,'z'
jmp vector_address_register
ymm_register:
mov al,'y'
jmp vector_address_register
xmm_register:
mov al,'x'
vector_address_register:
stosb
mov ax,'mm'
stosw
mov al,bl
and eax,11111b
call write_dec_number
jmp write_register_scale
write_line_identifier:
test dword [ebx+4],80000000h
jnz identify_macro_generated_line
......@@ -401,8 +428,8 @@ address_registers db 23h,2,'bx'
db 8Dh,3,'r13'
db 8Eh,3,'r14'
db 8Fh,3,'r15'
db 0F4h,3,'eip'
db 0F8h,3,'rip'
db 94h,3,'eip'
db 98h,3,'rip'
db 0,1,'?'
_negated db 'negated ',0
......
......@@ -2,6 +2,23 @@
Visit http://flatassembler.net/ for more information.
version 1.71.42 (Oct 22, 2015)
[-] Fixed a couple of regression bugs.
version 1.71.41 (Oct 21, 2015)
[-] Fixed a bug that caused the "word" operator inside square brackets to
have no effect.
version 1.71.40 (Oct 19, 2015)
[+] Added support for Intel AVX-512, SHA, CLFLUSHOPT, CLWB and
PCOMMIT instruction sets.
version 1.71.39 (Mar 11, 2015)
[-] Minor bug fix.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment