Path: utzoo!mnetor!uunet!husc6!rutgers!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.UUCP (Rahul Dhesi) Newsgroups: comp.arch Subject: Re: self-modifying code Message-ID: <2169@bsu-cs.UUCP> Date: 20 Feb 88 17:32:29 GMT References: <486@taux01.UUCP> <666@cresswell.quintus.UUCP> <815@spar.SPAR.SLB.COM> Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 16 Summary: solution [re: how to overcome the code versus data distinction] For those implementors who wish to allow data to be safely treated as code, I suggest a system call that will accept a range of memory addresses and a request to change it from code to data or from data to code. E.g.: #include if (modech(startadd, endadd, TO_CODE) == -1) error ("could not change data into code for execution"); This preserves the advantages if any of the code/data distinction without being a pain to the implementor. No doubt there would be some alignment restrictions on the values of startadd and endadd. -- Rahul Dhesi UUCP: !{iuvax,pur-ee,uunet}!bsu-cs!dhesi