Mail Archives: djgpp/2000/01/13/14:07:08
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
- Raw text -