Article View: rec.games.programmer
Article #2253Re: Writing code at run-time
From: Alan Cox
Date: Mon, 06 Jun 1994 11:56
Date: Mon, 06 Jun 1994 11:56
20 lines
2166 bytes
2166 bytes
In article <2suogv$s60@harbinger.cc.monash.edu.au> junaid@barney.eng.monash.edu.au (Junaid A. Walker) writes: >***Linux: > >1) malloc the required # bytes >2) use mmap() to create a executable segment mapping of 1) >3) store a pointer to 1) in a function pointer, and invoke pointed to > function (making sure function passing prolog is included in code). > OR use a bit of inline assembler to make a direct call to register > loaded with pointer in 1) 1) will not work the way you want - you can't go off writing self modifying code or you'll get attacked by cache problems - especially on the newer chips. 2) ought to work - thats how Linux shared libraries are bound. Writing code to do custom gif rendering is quite a neat concept. I'm not sure how much it will save you but I don't see why you can't compile the executable of the gif renderer into the program, or dynamically link it either at run time as a shared library (which uses mmap()) or using the GNU dynamic linker Alan
Technical Details
Message-ID:
<1994Jun6.115625.10787@uk.ac.swan.pyr>Path:
arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!EU.net!uknet!cf-cm!cybaswan!iiitacReferences:
<2suogv$s60@harbinger.cc.monash.edu.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f6aa,e6b2b5751c2b9056 X-Google-Attributes: gid10f6aa,public X-Google-Thread: fe306,e6b2b5751c2b9056 X-Google-Attributes: gidfe306,public X-Google-Thread: 10a997,e6b2b5751c2b9056 X-Google-Attributes: gid10a997,public X-Google-Thread: 1103af,e6b2b5751c2b9056 X-Google-Attributes: gid1103af,public X-Google-Thread: 102bfa,e6b2b5751c2b9056 X-Google-Attributes: gid102bfa,public X-Google-Thread: 102983,e6b2b5751c2b9056 X-Google-Attributes: gid102983,public X-Google-Thread: f9382,e6b2b5751c2b9056 X-Google-Attributes: gidf9382,public X-Google-ArrivalTime: 1994-06-06 06:16:02 PST Newsgroups: rec.games.programmer,alt.uu.comp.os.linux.questions,aus.computers.linux,comp.os.linux,comp.os.linux.misc,alt.msdos.programmer,comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!EU.net!uknet!cf-cm!cybaswan!iiitac From: iiitac@uk.ac.swan.pyr (Alan Cox) Subject: Re: Writing code at run-time Message-ID: <1994Jun6.115625.10787@uk.ac.swan.pyr> Organization: Swansea University College References: <2suogv$s60@harbinger.cc.monash.edu.au> Date: Mon, 6 Jun 1994 11:56:25 GMT Lines: 20