Mail Archives: djgpp/1996/10/17/03:40:44
I've been using a dynamic stack instead of a static stack in my
interrupt routines. Is it SAFE to call DPMI functions (501 and 502)
while servicing an interupt. My program used to lock up when I used a
static stack.
Thanks, Dan.
Here's the source
.globl _S_snd_dig_int
_S_snd_dig_int:
pushal // Save registers
pushl %ds
pushl %es
pushl %fs
pushl %gs
movb $0x20, %al // Enable interupts
outb %al, $0x20
movb $0x20, %al
outb %al, $0xa0
sti
cld // Load selectors
movl %cs: _DataSel, %eax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
movl $0x0501, %eax // Allocate a 64k stack
movl $0x0001, %ebx
movl $0x0000, %ecx
intb $0x31
movl %ebx, %eax
shll $16, %eax
movw %cx, %ax
subl _AbsoluteAddr, %eax
addl $0x10000, %eax
movl %esp, %ecx // Save %ss:%esp
movl %ss, %dx
pushl _DataSel // Load new stack
pushl %eax
lss (%esp), %esp
pushl %edx // Save old stack
pushl %ecx
pushl %esi // Save handle
pushl %edi
call _snd_dig_Int__Fv // Call Interrupt Handler
popl %edi // Restore handle
popl %esi
lss (%esp), %esp // Load old stack
movl $0x0502, %eax // Free old stack
intb $0x31
popl %gs // Restore old registers
popl %fs
popl %es
popl %ds
popal
iretl // Return
--
***** *** ** ** Dan M. Hedlund
** ** ***** *** ** <markiv AT rangenet DOT com>
** ** ** ** **** ** http://www.rangenet.com/markiv
** ** ** ** ** ** **
** ** ******* ** ****
** ** ** ** ** ***
** ** ** ** ** **
***** ** ** ** **
- Raw text -