Comments (2)
These examples indicate that it's not just the encoder that's mishandling 16-bit address truncation, but the formatter as well.
While displacements can always be treated as signed in x86, address truncation is unsigned. Also - and this is the part that Zydis doesn't appear to handle correctly - the 67h
prefix overrides not just address calculation width but address truncation width as well.
As a result:
- in 32-bit mode, decoding
67 00 3e 00 ff
asadd byte ptr ds:[0x0000FF00],bh
is correct - in this case, the67h
prefix overrides truncation width from 32-bit down to 16-bit, and the resulting memory access goes tods:[0x0000FF00]
, notds:[0xFFFFFF00]
. As a result, re-encoding00 3d 00 ff ff ff
into67 00 3e 00 ff
is not correct, but it would have been correct to re-encode00 3d 00 ff 00 00
into67 00 3e 00 ff
. - in 16-bit mode, decoding
67 3a 05 00 1e 57 1a
ascmp al, byte ptr ds:[0x1E00]
is NOT correct! The67h
prefix will, in this case, override address truncation width from 16-bit to 32-bit, so the memory access will go to addressds:[0x1a571e00]
, notds:[0x1e00]
. As such, the correct decoding iscmp al, byte ptr ds:[0x1a571e00]
- which is what e.g. XED outputs. (Attempting to access addressds:[0x1a571e00]
in 16-bit mode will normally cause a #GP, due to the data segment size normally being 64K in 16-bit mode, however it is perfectly possible to set up a big 32-bit data segment for unreal-mode or 16-bit protected-mode, in which case such an instruction will execute just fine in 16-bit mode.)
from zydis.
@tremalrik I've addressed this already in #472 :)
Separate PR will soon address rest of the issues.
from zydis.
Related Issues (20)
- Compile error in VS2019 HOT 2
- [HELP] OperandDefinitions.inc Need a C89 style define file. HOT 2
- Movabs not supported with ZydisDisassembleIntel HOT 4
- ATT: Missing parenthesis for absolute memory operands HOT 8
- Is there a separate function for Length disassembly in zydis? HOT 11
- Question about ZydisEncoderDecodedInstructionToEncoderRequest's operand_count parameter HOT 3
- Encoder generates wrong relative offset with bnd prefix
- Missing enum definitions in Documentation HOT 1
- Incorrect operand size with mov instruction HOT 3
- How to get operand address as a ZyanU64? HOT 5
- Build failed: build zydis as a dynamic link library on MacOS HOT 4
- Encoder fails to enforce predicted instruction size in some scenarios
- Incorrect disassembly of push rdi HOT 2
- ZydisDecodedInstruction has ZYDIS_ATTRIB_IS_RELATIVE attribute when decoding absolute JMP HOT 3
- ZydisWinKernel.c 0xC0000428 HOT 3
- Zydis.dll dependent on kernel32 HOT 8
- Add [in,out] hints to Doxygen parameter strings HOT 7
- undocumented/unintended ZYDIS_FORMATTER_FUNC_POST_OPERAND behavior HOT 6
- Amalgamated build should auto-define `ZYDIS_STATIC_BUILD` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zydis.