flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > IP Overlay. A bug or not a bug? [NOT] |
Author |
|
revolution 07 Apr 2010, 00:40
1. You can't jump to address 0x10000 in 16-bit code. So jmp $+2 will never work. The CPU will force IP to 0x0000. In 16-bit code IP is always masked with 0xffff so executing past 0xffff will wrap back to 0x0000.
2. Remove "USE32" and put "jmp fword 1Bh:beBack". |
|||
07 Apr 2010, 00:40 |
|
l_inc 07 Apr 2010, 12:59
revolution
Quote: You can't jump to address 0x10000 in 16-bit code. So jmp $+2 will never work. Sure I can. The only thing I need in this case is a prefix (and surely sufficient segment limit in a descriptor). Anyway jmp $+2 is still a valid instruction on this place and it will surely work. Only in different ways depending on if there is a prefix or not. But if you attentively read my post (well... I know you didn't ) you probably would understand, that eip-truncation is exactly the thing I need. And I'd like to have a possibility to write valid instructions with their mnemonics in fasm, not with a db-directive. Quote: In 16-bit code IP is always masked with 0xffff so executing past 0xffff will wrap back to 0x0000. You obviously didn't try to run the code. Cause if you did, you would know, that eip is not always masked with 0FFFFh. Otherwise the code would never get back to the 32-bit segment and one would never see the message box. Quote: Remove "USE32" and put "jmp fword 1Bh:beBack". Thanks. That worked fine. |
|||
07 Apr 2010, 12:59 |
|
revolution 07 Apr 2010, 13:11
To generate a 32-bit jmp in 16-bit mode you need this:
Code: jmp dword $+3 |
|||
07 Apr 2010, 13:11 |
|
l_inc 07 Apr 2010, 13:19
revolution
As I already twice said, I don't need a 32-bit jump. I need a short 16-bit jump, that goes 64K (or even more in some cases) backwards. |
|||
07 Apr 2010, 13:19 |
|
revolution 07 Apr 2010, 13:32
If that is all you need then simply:
Code: jmp 0 BTW: The talk about jmp $+2 is confusing the issue, you should just put the destination where you actually want to go. |
|||
07 Apr 2010, 13:32 |
|
l_inc 07 Apr 2010, 13:51
revolution
Thank you. My fault. Didn't think about it. The conclusion is: "not a bug". Fasm proved me again its flatness (in a good sense). What you code is what you get. Quote: I still stand by what I said, you can't jmp past 0xffff in 16-bit code, you have to switch to 32-code (with a prefix, like you mentioned). I think it's a definition question in this case. I still consider a prefixed code as 16-bit code with a redefined operand size. But at least I think you understand now, that even if we can't jump into an ip overlay with 16-bit code (we can't with your definition but we can with mine), we still can get to the ip overlay(with both definitions) if we don't use any call's or jumps. Thanks again for the answer. |
|||
07 Apr 2010, 13:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.