From 64fde13bca7905e9ec8feebf7acbe6d78b99cfde Mon Sep 17 00:00:00 2001 From: Tomasz Grysztar Date: Fri, 4 Jan 2019 11:20:50 +0100 Subject: [PATCH] release 1.73.06 --- LICENSE.TXT | 2 +- SOURCE/FORMATS.INC | 66 ++++++++++++++++++++++------------------------ SOURCE/TABLES.INC | 4 +++ SOURCE/VERSION.INC | 2 +- SOURCE/X86_64.INC | 12 +++++++++ WHATSNEW.TXT | 7 +++++ 6 files changed, 56 insertions(+), 37 deletions(-) diff --git a/LICENSE.TXT b/LICENSE.TXT index 6a51e0e..9e0d2ce 100644 --- a/LICENSE.TXT +++ b/LICENSE.TXT @@ -1,6 +1,6 @@ flat assembler version 1.73 -Copyright (c) 1999-2018, Tomasz Grysztar. +Copyright (c) 1999-2019, Tomasz Grysztar. All rights reserved. This program is free for commercial and non-commercial use as long as diff --git a/SOURCE/FORMATS.INC b/SOURCE/FORMATS.INC index fdf6ccc..b66c360 100644 --- a/SOURCE/FORMATS.INC +++ b/SOURCE/FORMATS.INC @@ -3922,9 +3922,10 @@ elf_segment: cmp ecx,-1 je merge_elf_header mov eax,[ecx+8] + mov ecx,[ecx+4] + elf_segment_separated_base: mov [ebx+8],eax mov [ebx+0Ch],eax - mov ecx,[ecx+4] mov [ebx+4],ecx sub eax,ecx add eax,edi @@ -3933,13 +3934,8 @@ elf_segment: jmp elf_segment_addressing_setup merge_elf_header: mov eax,[image_base] - mov [ebx+8],eax - mov [ebx+0Ch],eax - and dword [ebx+4],0 - add eax,edi - sub eax,[code_start] - xor edx,edx - jmp elf_segment_addressing_setup + xor ecx,ecx + jmp elf_segment_separated_base close_elf_segment: cmp [number_of_sections],0 jne finish_elf_segment @@ -3963,6 +3959,8 @@ elf_segment: mov edx,edi cmp edi,[undefined_data_end] jne elf_segment_size_ok + cmp byte [ebx],1 + jne elf_segment_size_ok mov edi,[undefined_data_start] elf_segment_size_ok: mov [ebx+14h],eax @@ -3971,17 +3969,18 @@ elf_segment: mov [ebx+10h],eax and [undefined_data_end],0 mov eax,[ebx+8] - mov cl,[ebx] - cmp cl,3 - ja elf_segment_position_ok - add eax,[ebx+14h] - cmp cl,1 - je elf_segment_position_adjust + cmp byte [ebx],1 + je elf_segment_position_move_and_align cmp [merge_segment],0 - jne elf_segment_position_ok + jne elf_segment_position_move + cmp byte [ebx],3 + ja elf_segment_position_ok mov [merge_segment],ebx + elf_segment_position_move: + add eax,[ebx+14h] jmp elf_segment_position_ok - elf_segment_position_adjust: + elf_segment_position_move_and_align: + add eax,[ebx+14h] add eax,0FFFh elf_segment_position_ok: and eax,not 0FFFh @@ -4070,11 +4069,12 @@ elf_segment: je merge_elf64_header mov eax,[ecx+10h] mov edx,[ecx+10h+4] + mov ecx,[ecx+8] + elf64_segment_separated_base: mov [ebx+10h],eax mov [ebx+10h+4],edx mov [ebx+18h],eax mov [ebx+18h+4],edx - mov ecx,[ecx+8] mov [ebx+8],ecx neg ecx add ecx,edi @@ -4085,16 +4085,8 @@ elf_segment: merge_elf64_header: mov eax,[image_base] mov edx,[image_base_high] - mov [ebx+10h],eax - mov [ebx+10h+4],edx - mov [ebx+18h],eax - mov [ebx+18h+4],edx - and dword [ebx+8],0 - mov ecx,edi - sub ecx,[code_start] - add eax,ecx - adc edx,0 - jmp elf_segment_addressing_setup + xor ecx,ecx + jmp elf64_segment_separated_base close_elf64_segment: cmp [number_of_sections],0 jne finish_elf64_segment @@ -4119,6 +4111,8 @@ elf_segment: mov edx,edi cmp edi,[undefined_data_end] jne elf64_segment_size_ok + cmp byte [ebx],1 + jne elf64_segment_size_ok mov edi,[undefined_data_start] elf64_segment_size_ok: mov [ebx+28h],eax @@ -4128,18 +4122,20 @@ elf_segment: and [undefined_data_end],0 mov eax,[ebx+10h] mov edx,[ebx+10h+4] - mov cl,[ebx] - cmp cl,3 + cmp byte [ebx],1 + je elf64_segment_position_move_and_align + cmp [merge_segment],0 + jne elf64_segment_position_move + cmp byte [ebx],3 ja elf64_segment_position_ok + mov [merge_segment],ebx + elf64_segment_position_move: add eax,[ebx+28h] adc edx,0 - cmp cl,1 - je elf64_segment_position_adjust - cmp [merge_segment],0 - jne elf64_segment_position_ok - mov [merge_segment],ebx jmp elf64_segment_position_ok - elf64_segment_position_adjust: + elf64_segment_position_move_and_align: + add eax,[ebx+28h] + adc edx,0 add eax,0FFFh adc edx,0 elf64_segment_position_ok: diff --git a/SOURCE/TABLES.INC b/SOURCE/TABLES.INC index 072bcad..caf7356 100644 --- a/SOURCE/TABLES.INC +++ b/SOURCE/TABLES.INC @@ -658,6 +658,10 @@ instructions_3: dw pm_store_word_instruction-instruction_handler db 'sub',28h dw basic_instruction-instruction_handler + db 'ud0',0FFh + dw ud_instruction-instruction_handler + db 'ud1',0B9h + dw ud_instruction-instruction_handler db 'ud2',0Bh dw simple_extended_instruction-instruction_handler db 'xor',30h diff --git a/SOURCE/VERSION.INC b/SOURCE/VERSION.INC index f489571..f01bcd3 100644 --- a/SOURCE/VERSION.INC +++ b/SOURCE/VERSION.INC @@ -33,7 +33,7 @@ ; cannot simply be copied and put under another distribution licence ; (including the GNU Public Licence). -VERSION_STRING equ "1.73.05" +VERSION_STRING equ "1.73.06" VERSION_MAJOR = 1 VERSION_MINOR = 73 diff --git a/SOURCE/X86_64.INC b/SOURCE/X86_64.INC index 5f1534c..3424f25 100644 --- a/SOURCE/X86_64.INC +++ b/SOURCE/X86_64.INC @@ -2375,6 +2375,18 @@ bs_instruction: mov bl,al stc ret +ud_instruction: + mov [extended_code],al + mov [base_code],0Fh + call get_reg_mem + jc ud_reg_reg + cmp [operand_size],4 + jne invalid_operand_size + jmp instruction_ready + ud_reg_reg: + cmp ah,4 + jne invalid_operand_size + jmp nomem_instruction_ready imul_instruction: mov [base_code],0F6h diff --git a/WHATSNEW.TXT b/WHATSNEW.TXT index 41a0426..8feccff 100644 --- a/WHATSNEW.TXT +++ b/WHATSNEW.TXT @@ -2,6 +2,13 @@ Visit http://flatassembler.net/ for more information. +version 1.73.06 (Jan 04, 2019) + +[+] Added "ud0" and "ud1" instruction. + +[-] Fixed a minor bug in ELF formatter. + + version 1.73.05 (Jan 03, 2019) [-] Segments in ELF executable format automatically expanded to cover headers