Re: Need a jump opcode generator.



Probably pretty easy:


// generate a jump opcode.

// opcode for jump is FF

// followed by 4 bytes me thinks.

// this is a near absolute jump which might work in protected mode as well
// the docs don't say if it works in protected mode so I assume it works
// otherwise they would have warned about it or had a special section for
protected mode
// and near jumps.

// so the jump instruction is 5 bytes as well.. which is realy nice.
// simple as pie:

// vSendTo points to sendto function in winsuck 2 ;)

byte( pointer(vSendTo)^ ) := $FF;
pointer( pointer( longword(vSendTo)+1 )^ ) := @injected_sendto;

Compiles, but untested.

Bye,
Skybuck.


.



Relevant Pages

  • Re: I want to learn forth but...
    ... ELSE compiles a jump opcode with address argument and semicolon ... But somehow the customers were not willing ...
    (comp.lang.forth)
  • Re: defered word options
    ... implementation of defered words is simply a jump opcode. ... What syntax do you propose for this? ... For a generic DEFER I have DEFER compile a nop and return. ...
    (comp.lang.forth)
  • Re: [GIT PULL] x86 setup: correct booting on 486DX4
    ... regular branch is sufficient. ... jump later (to reload %cs in protected mode), but I'm not sure it's needed ... and I think that was straigh out of the documentation. ...
    (Linux-Kernel)
  • Could not switch back to Real-Address mode from Protected Mode. Help?
    ... the CPU operates at Protected mode with flat memory ... mov eax, cr0 ... mov cr0, eax ... ;Far jump to the real-address mode code. ...
    (comp.lang.asm.x86)
  • Re: [GIT PULL] x86 setup: correct booting on 486DX4
    ... You obviously *do* need to make the long jump later (to reload %cs in protected mode), but I'm not sure it's needed in that place. ... So yeah, I think that's the right fix - not a longjmp ... 9-27, at least in the version I have), but you're right -- the documentation only demands a short jump here, not a long jmp So yes, that is definitely the right fix and avoids the ugly mixing of code. ...
    (Linux-Kernel)