From: Martin Stromberg Message-Id: <200001131558.QAA14542@spica-144.lu.erisoft.se> Subject: Re: Problems with protected_mode_int To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii) Date: Thu, 13 Jan 100 16:58:18 +0100 (MET) Cc: djgpp AT delorie DOT com (DJGPP) In-Reply-To: from "Eli Zaretskii" at Jan 13, 0 05:42:30 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Eli said: > On 13 Jan 2000, Martin Stromberg wrote: > > > asm(" > > my_handler: > > ... > > > > my_handler_end: > > "); > > > > int main() > > { > > unsigned char code[1000]; > > > > memcpy(code, &my_handler, my_handler_end - my_handler); > > This will most probably crash, for several good reasons: > > - stack is allocated off the DS selector whose access rights forbid > executing any address accessed via that selector; > > - the only segment register that is guaranteed to be loaded with the > application's selector is CS, so you cannot trust SS. Are you saying the base and offsets of CS is different than those of DS? If yes, then it won't work. If no, it should work (note that at entry to the interrupt hander CS _is_ valid and that is what counts). Please explain more clearly why not. This Mortal Coil, Blood, MartinS