delorie.com/archives/browse.cgi | search |
From: | "Andrew Davidson" <andrew AT lemure DOT freeserve DOT co DOT uk> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Generating Machine Code on the fly |
Date: | Fri, 26 Feb 1999 01:12:29 -0000 |
Organization: | Customer of Planet Online |
Lines: | 24 |
Message-ID: | <7b7gra$5nh$1@news4.svr.pol.co.uk> |
References: | <7b6qpv$39t$1 AT news8 DOT svr DOT pol DOT co DOT uk> <199902261912 DOT OAA24117 AT envy DOT delorie DOT com> |
NNTP-Posting-Host: | modem-116.praseodymium.dialup.pol.co.uk |
X-Trace: | news4.svr.pol.co.uk 920077994 5873 62.136.29.116 (27 Feb 1999 01:13:14 GMT) |
NNTP-Posting-Date: | 27 Feb 1999 01:13:14 GMT |
X-Complaints-To: | abuse AT theplanet DOT net |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.0810.800 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.0810.800 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
DJ Delorie <dj AT delorie DOT com> wrote in message news:199902261912 DOT OAA24117 AT envy DOT delorie DOT com... > >> Is it possible to allocate an area of memory in djgpp using malloc, >> fill it full of bytes of machine code, and then, using an asm >> statement, push all the registers, call the area of memory as a >> subroutine, pop all the registers when that subroutine returns, and >> continue running the C program without any damage being done? > >This is exactly what the stub does :-) so it should work for you. > >Of course, getting the machine code *right* might not be trivial. > >> I assume that there would be some kind of limitation on the quantity of >> machine code that could be run in this way? > >You're limited to a few hundred megabytes, probably. Depends on how >much memory you can malloc. Really? I can malloc 200mb and jump around within that code to my hearts content? How? Surely I'd have to write my own flat memory mapping code?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |