flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Problem with rel32 generation? |
Author |
|
revolution 14 Mar 2010, 01:28
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 |
|||
14 Mar 2010, 01:28 |
|
baldr 14 Mar 2010, 01:31
LocoDelAssembly,
Yes, there is a problem. calculate_jump_offset function in X86_64.INC incorrectly assumes that jcc instruction is exactly 2 bytes long. |
|||
14 Mar 2010, 01:31 |
|
Tomasz Grysztar 16 Mar 2010, 11:39
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. |
|||
16 Mar 2010, 11:39 |
|
baldr 16 Mar 2010, 18:31
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: |
|||
16 Mar 2010, 18:31 |
|
Tomasz Grysztar 16 Mar 2010, 18:43
baldr wrote:
See this thread for some more details about how it was implemented: http://board.flatassembler.net/topic.php?t=5162 |
|||
16 Mar 2010, 18:43 |
|
baldr 16 Mar 2010, 20:08
Tomasz Grysztar,
Sorry, I forgot about address wrap-around. Not a much 16-bit programming lately. |
|||
16 Mar 2010, 20:08 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.