flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
Actually it is a bug:
Code: use64 je ($+6)-0x7ffffffe ;0f 84 02 00 00 80 je ($+6)-0x7fffffff ;0f 84 01 00 00 80 je ($+6)-0x80000000 ;0f 84 00 00 00 80 je ($+6)-0x80000001 ;0f 84 ff ff ff 7f (bug) je ($+6)-0x80000002 ;0f 84 fe ff ff 7f (bug) je ($+6)-0x80000003 ;0f 84 fd ff ff 7f (bug) je ($+6)-0x80000004 ;0f 84 fc ff ff 7f (bug) je ($+6)+0x7ffffffb ;0f 84 fb ff ff 7f |
|||
![]() |
|
baldr
LocoDelAssembly,
Yes, there is a problem. calculate_jump_offset function in X86_64.INC incorrectly assumes that jcc instruction is exactly 2 bytes long. |
|||
![]() |
|
Tomasz Grysztar
baldr wrote: Yes, there is a problem. calculate_jump_offset function in X86_64.INC incorrectly assumes that jcc instruction is exactly 2 bytes long. |
|||
![]() |
|
baldr
Tomasz Grysztar,
Yes it is, but mov ecx, edx / cdq / cmp edx, ecx / jne value_out_of_range uses calculated rel32 without adjustment to check for out-of-range jump target. Another kind of a problem is with jmp rel16 – the following code happily compiles: Code: use16 jmp there times 0x8000 nop there: |
|||
![]() |
|
Tomasz Grysztar
baldr wrote:
See this thread for some more details about how it was implemented: http://board.flatassembler.net/topic.php?t=5162 |
|||
![]() |
|
baldr
Tomasz Grysztar,
Sorry, I forgot about address wrap-around. Not a much 16-bit programming lately. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.