Hello,
I am creating a program that writes a jump to a DMA and goes to a static location. And I was wondering 2 things:
First, if there is a cleaver way to do this in ASM?
or
If anyone know the reverse long jump formula so i can code my program to figure out the jump? I found the short jump formula (JMP_Address + 2 + Second_Byte_value = Next_Instruction_Address) off the Internet but found nothing about regular jumps.
Any help will be greatly appreciated, thanks for your time!
I am creating a program that writes a jump to a DMA and goes to a static location. And I was wondering 2 things:
First, if there is a cleaver way to do this in ASM?
or
If anyone know the reverse long jump formula so i can code my program to figure out the jump? I found the short jump formula (JMP_Address + 2 + Second_Byte_value = Next_Instruction_Address) off the Internet but found nothing about regular jumps.
Any help will be greatly appreciated, thanks for your time!
What do you mean by "long" jump and "regular" jump?
Is it near 32-bit or far?
The definite way to find out what you are trying to achieve is to
read Intel manual vol. 2 - both in jmp entry and the appendix on op code.
Is it near 32-bit or far?
The definite way to find out what you are trying to achieve is to
read Intel manual vol. 2 - both in jmp entry and the appendix on op code.
I mean not short, as in 5 bytes, not 2. Im going to be jumping very far away from the address.
I found the short jump formula (JMP_Address + 2 + Second_Byte_value = Next_Instruction_Address) off the Internet but found nothing about regular jumps.
Any help will be greatly appreciated, thanks for your time!
did you actually think that it might be...
JMP_ADDRESS+5+second _DWORD_value = next_instruction_address?
e9 xx xx xx xx xx
va + xx xx xx xx + 5 (opcode length)
sorted
it is
e9 q
where q is a dword
q = target address - opcode address - 5
for example, if q is 0, a jmp will jump to the opcode right after it.
e9 q
where q is a dword
q = target address - opcode address - 5
for example, if q is 0, a jmp will jump to the opcode right after it.
BYTE 0E9h
DWORD DestinationAddress - StartAddress
StartAddress:
.
.
.
DestinationAddress:
BYTE 0EBh
BYTE DestinationAddress - StartAddress
StartAddress:
.
.
.
DestinationAddress:
Thank you very much for the replys, works great, but i have a small problem with this...
Say i want to jump from c0ab6a4 to 10900, the dword should be: 57 52 F6 F3 but using this mothod i get: FFFFFFFFF3F65257. I know i could just - FFFFFFFFF00000000 and poke 3F65257E9 to c0ab6a4 but im having problems converting/storing values larger than &H7FFFFFFF(long) in VB. Any ideas there?
Also, how would i go about using that code you posted, that looks very nice.
Say i want to jump from c0ab6a4 to 10900, the dword should be: 57 52 F6 F3 but using this mothod i get: FFFFFFFFF3F65257. I know i could just - FFFFFFFFF00000000 and poke 3F65257E9 to c0ab6a4 but im having problems converting/storing values larger than &H7FFFFFFF(long) in VB. Any ideas there?
Also, how would i go about using that code you posted, that looks very nice.
Just use the low dword - works for positive and negative. The code was just to show the calculation is relatively the same for byte and dword offsets. Sorry, I don't use VB enough to know the correct code - isn't a LONG 32 bits?