🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #2252

Writing code at run-time

#2252
From: Junaid A. Walker
Date: Mon, 06 Jun 1994 08:59
30 lines
2272 bytes
	Well its that time of year....

	How does one set up an area under Linux gcc/ MSDOS djgpp 
write some machine code instructions to this area, and then execute this
code all at runtime.
	I am programming a sprite library that reads in a gif, compiles it
to machine code that will copy the sprite onto the screen.  (Xlib people
listenning?)

	For the curious, a few ideas;

***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)

***MSDOS djgpp:
	As above, but is the data segment executable?  If not go32 hacking
required.

***MSDOS real mode:
	Trivial, all segments are executable.


	Regards,
	Junaid.
Technical Details
Message-ID: <2suogv$s60@harbinger.cc.monash.edu.au>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!EU.net!sunic!trane.uninett.no!ifi.uio.no!wabbit.cc.uow.edu.au!metro!inferno.mpx.com.au!news.cs.su.oz.au!harbinger.cc.monash.edu.au!barney.eng.monash.edu.au!junaid

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10f6aa,e6b2b5751c2b9056,start
X-Google-Attributes: gid10f6aa,public
X-Google-Thread: fe306,e6b2b5751c2b9056,start
X-Google-Attributes: gidfe306,public
X-Google-Thread: 1103af,e6b2b5751c2b9056,start
X-Google-Attributes: gid1103af,public
X-Google-Thread: 102bfa,e6b2b5751c2b9056,start
X-Google-Attributes: gid102bfa,public
X-Google-Thread: 102983,e6b2b5751c2b9056,start
X-Google-Attributes: gid102983,public
X-Google-Thread: 10a997,e6b2b5751c2b9056,start
X-Google-Attributes: gid10a997,public
X-Google-Thread: f9382,e6b2b5751c2b9056,start
X-Google-Attributes: gidf9382,public
X-Google-ArrivalTime: 1994-06-06 03:15:52 PST
Path: arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!EU.net!sunic!trane.uninett.no!ifi.uio.no!wabbit.cc.uow.edu.au!metro!inferno.mpx.com.au!news.cs.su.oz.au!harbinger.cc.monash.edu.au!barney.eng.monash.edu.au!junaid
From: junaid@barney.eng.monash.edu.au (Junaid A. Walker)
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
Subject: Writing code at run-time
Date: 6 Jun 1994 08:59:11 GMT
Organization: Monash University
Lines: 30
Message-ID: <2suogv$s60@harbinger.cc.monash.edu.au>
NNTP-Posting-Host: barney.eng.monash.edu.au
X-Newsreader: TIN [version 1.2 PL1]