> > Best thing would be to have compiler defines and rewrite those > > assembler instructions as normal Pascal code (would help porting to > > other CPUs) > > > > Yes,I considered it ...but it's impossible.I've asked fpc > developers about it and in fact stack manipulation is > impossible with pure pascal code.But good news is that there > is only a few small parts of code which need to be in > assembler (most of them in uPSRuntime.pas if I good remember)
You can inject machine code (can translate assembly 1-1 to machinecode using any assembler you like) in memory with PURE pascal code and then jump to it by calling a procedure pointer that points to that memory area ;o). That is if they mean they need to inject stack processing headers/footers into autogenerated code in memory (do they mean so though?) BTW, when they say stack manipulation what do they really mean? The ROPS stack? (I don't think so, since the ROPS VM is Pascal code and you could do as you like). I assume it's for calling from ROPS into Delphi procedures/functions/methods. To push data into the stack you could write to memory directly, couldn't you? Why do you have to use PUSH/POP and the SP (stack Pointer)? Is there already a memory protection scheme in FP runtime that doesn't allow stack manipulation? Btw, Memory data protection features of FPC compiler or the OS might interfere with such practices in the future though (if not currently), but an app should be able to tell the OS which memory is protected from jumping into I'd really like to know more about the issue, in case I can help ...still remember that nice Peter Norton's book building their hexeditor step-by-step in assembler (used to make game cheats in the past ;-). I have a x64 CPU at hand too and respective OS to test if needed (what's the conditional compilation symbols used at FPC for CPU architectures?) Cheers, George ---------------- George Birbilis ([EMAIL PROTECTED]) Microsoft MVP J# for 2004-2006 Borland "Spirit of Delphi" * QuickTime, QTVR, ActiveX, .NET, Delphi VCL, XML, IPC http://www.kagi.com/birbilis * Robotics http://www.mech.upatras.gr/~Robotics http://www.mech.upatras.gr/~robgroup _____ avast! Antivirus <http://www.avast.com> : Outbound message clean. Virus Database (VPS): 0630-2, 26/07/2006 Tested on: 27/7/2006 4:09:09 ?? avast! - copyright (c) 1988-2006 ALWIL Software. _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
