Comments (7)
Can you please elaborate?
I don't see a bug anywhere right now. AsmJit assembles far jumps as other assemblers via ljmp
and lcall
instructions.
from asmjit.
Assembler assembler;
CodeHolder asmcode;
asmcode.reset();
asmcode.init(asmjit::Environment(Arch::kX64), 0);
asmcode.attach(&assembler);
assembler.addDiagnosticOptions(asmjit::DiagnosticOptions::kValidateAssembler);
{
assembler.jmp(0xA123456789);
assembler.call(0xA123456789);
}
asmjit::String encodedOpcode;
asmjit::Section* text = asmcode.textSection();
text->buffer()[0];
encodedOpcode.appendHex(text->data(), text->bufferSize());
printf(encodedOpcode.data());
it outputs:
40 E9 00000000
40 E8 00000000
from asmjit.
the correct absolute address jump in 64-bit programs should be:
FF25 00 00 00 00 [64bit address]
and absolute address call:
FF15 02 00 00 00 [64bit address]
from asmjit.
FF25/FF15 encodes jmp|call r64/m64
forms - you can have that if you use jmp [mem]
form of the instruction. When you specify absolute address as an immediate AsmJit bails to relative encoding and in some cases it would output a relocable code so it can patch it later.
In your case there is REX prefix so it can patch the instruction to FFxx form later when relative addressing would be out of reach.
from asmjit.
so it is
from asmjit.
I'm going to clarify this.
The instruction sequences proposed are not instructions, but they are instructions or multiple instructions + data. To do a jump with absolute address that is stored next to the jump, you can simply do:
Label L = assembler->newLabel();
assembler->jmp(x86::mem(L));
assembler->bind(L);
assembler->dq(uint64_t(address));
Alternatively, without a label with RIP addressing:
assembler->jmp(x86::ptr(x86::rip));
assembler->dq(uint64_t(address));
The thing is that I don't want to create a macro-assembler from AsmJit as that would be much more confusing than just offering what the target ISA offers. AsmJit still supports some extra functionality (for example the address-table stuff), but that's just for convenience.
from asmjit.
Closing as the behavior of AsmJit is OK.
from asmjit.
Related Issues (20)
- InvalidDisplacement error when use loop instruction HOT 3
- Calling void function on a64 (android) not working HOT 2
- LAHF issue with x86_64 compiler HOT 2
- Return "Segmentation fault" when use std instruction HOT 4
- Jmp to label size HOT 3
- How to load the address of a label to a register? HOT 1
- "memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set" HOT 9
- No matter what I do. I am not able to get it working in my C++ CLI project. HOT 3
- Build Problem: Android Ndk build failed HOT 1
- Invalid movzx instruction generated by x86 EmitHelper::emitArgMove HOT 8
- Liveness analysis differs in Release mode vs Debug mode HOT 19
- calling names when use call instruction HOT 2
- Are the generated ISA databases still in the public domain? HOT 3
- Ports Meta Issue
- mov eax,[r11+rcx*4+00004C28] how? HOT 2
- The correctness question of InstInfo for sub and sub instructions HOT 2
- 64-bit immediate HOT 1
- pblendvb has wrong opcode in isa_x86.json HOT 1
- linker giving error when using the library. HOT 8
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 asmjit.