Thread View: comp.windows.ms.programmer
2 messages
2 total messages
Started by Marni Allison Fylling
Sat, 01 Aug 1992 10:54
HELP! Trouble accessing Data Segment in Interrupt Routine
Author: Marni Allison Fylling
Date: Sat, 01 Aug 1992 10:54
Date: Sat, 01 Aug 1992 10:54
63 lines
2819 bytes
2819 bytes
Help me.
I am writing a device driver (as a DLL). Part of the device driver is an
Interrupt routine that needs to access the DLL's Data Segment.
I have been having trouble using FreeSelector in my device driver. I
have to play with Selectors because I use self-modifying code to
allow my interrupt routine to access its Data segment.
Is this the best way to get an Interrupt Routine to access a Data
Segment?
What I do is the following:
In an initialization routine (see below), I modify the interrupt routine by
writing the Data Segment Selector in. In order to write data to
a Code segment (a no-no in protected mode), I first called
(AllocCStoDSAlias) to allocate a Data Selector for the Code Segment,
used it to modify the code, then called FreeSelector() to dispose of it.
*******
In the initialization routine:
(DS points to library's data seg, and this code is in the same
segment as the interrupt code)
push ds ; save Viper Data Selector
Arg <cs> ; get IntCode Code Selector
cCall AllocCStoDSAlias ; create Data Selector copy in ax
mov ds,ax ; ds now has Data Selector to IntCode
pop ax ; get Viper Data Selector
mov ds:[WORD PTR ViperStoreDS], ax ; modify code
Arg <ds>
cCall FreeSelector ; free allocated selector
mov ds,ax ; restore Viper Data Selector
*******
At the beginning of my interrupt routine I have:
mov ax,0000h ; !!! this part of code gets modified !!!
ViperStoreDS EQU $-2 ; label to part of code to modify
mov ds,ax ; load ds with Data Seg Selector
*******
The problem with FreeSelector() is that is causes a GP fault!?! (at
FreeSelector+0061).
Has anyone else had this experience? What am I overlooking?
Thanks,
Marni
--
/| |\ jmufdiwolu ,^.__,^\ o__ ,^\ Ron Goodman at
|\ |' | | fconservet | `\ '\ _.>/ _ / \ UC Santa Cruz
| | () () pmkeqica__,/ `\ `\ (_) \(_)' goodman@saturn.ucsc.edu
() () xbigh_,-'_/' ,,,,,,,`\/\,\_/`````` \________________/
Re: HELP! Trouble accessing Data Segment in Interrupt Routine
Author: Mycal
Date: Sat, 01 Aug 1992 22:07
Date: Sat, 01 Aug 1992 22:07
13 lines
1025 bytes
1025 bytes
In article <15dqhjINN4ju@darkstar.UCSC.EDU>, marni@cats.ucsc.edu (Marni Allison Fylling) writes... > >Help me. > >I am writing a device driver (as a DLL). Part of the device driver is an >Interrupt routine that needs to access the DLL's Data Segment. > Did you try mov ax,DGROUP at the begining of your int routine? I know the windows books say this is a no,no. but it has worked for me in a regular windows app (non-dll). mycal
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads