Mail Archives: djgpp/2005/10/07/17:00:58

X-Authentication-Warning: mail set sender to djgpp-bounces using -f
From: Rod Pemberton <donthave AT noreply DOT bit>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Need to hook INT 21h from a DJGPP TSR
Date: Fri, 7 Oct 2005 20:57:31 +0000 (UTC)
Lines: 89
Message-ID: <di6nfr$8bl$>
References: <cone DOT 1128591471 DOT 368325 DOT 13774 DOT 0 AT digisoft> <di47pc$lfa$1 AT sadr DOT dfn DOT de> <cone DOT 1128678305 DOT 262815 DOT 30667 DOT 0 AT digisoft>
Mime-Version: 1.0
X-Trace: 1128718651 8565 (7 Oct 2005 20:57:31 GMT)
X-Complaints-To: usenet AT sadr DOT dfn DOT de
NNTP-Posting-Date: Fri, 7 Oct 2005 20:57:31 +0000 (UTC)
X-User-Real-E-Mail: nobody AT no DOT where DOT com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> But the problem remains, I don't want a hardware interrupt. I was
> for a replacement wrapper for
> since I suspect my problem lies in the fact those wrappers are non
> reentrant.

Sure, you might look at Chris Jones's old LFNDOS driver.  He uses
some assembly to switch out of an interrupt context allowing full
use of C.  I personally found that this didn't work too well, but
it may serve your needs.  This is the only place I could find the
source, so get it quick...

Also, there were four or five patches posted on
which are no longer available, including the assembly code (below).
LFNDOS.CPP shows how to call intwrap.asm.

Rod Pemberton

; INTWRAP.ASM - (c) 1998 Chris Jones
; This procedure is called in an interrupt context.  It then calls
; cinthandler function out of interrupt context, which enables
system calls
; to be made.  When the C function finishes, it returns to the
; point of execution.
.model large,c

extrn cinthandler,tempstack
public intpointer,asminthandler

segment _DATA word public 'data'
intpointer dd 0


segment _TEXT word public 'code'
assume cs:_text
asminthandler proc
        push ax ; cs
        push ax ; ip
        push ax
        push bx
        push cx
        push dx
        push es
        push ds
        push si
        push di
        push bp
        push ax
        mov ax,DGROUP
        mov ds,ax
        pop ax
        mov word ptr ds:intpointer+2,ss
        mov word ptr ds:intpointer,sp
        mov dx,word ptr ds:tempstack+2
        mov ss,dx
        mov sp,word ptr ds:tempstack
        call far ptr cinthandler
        mov dx,word ptr ds:intpointer+2
        mov ss,dx
        mov sp,word ptr ds:intpointer
        pop bp
        pop di
        pop si
        pop ds
        pop es
        pop dx
        pop cx
        pop bx
        pop ax



Posted via:

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019