www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/22/05:11:18

Xref: news-dnh.mv.net comp.os.msdos.djgpp:1070
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!cs.utexas.edu!swrinde!howland.reston.ans.net!news-e1a.megaweb.com!newstf01.news.aol.com!uunet!in2.uu.net!psinntp!psinntp!psinntp!psinntp!netrixgw.netrix.com!jasmine!ld
From: ld AT jasmine DOT netrix DOT com (Long Doan)
Subject: Re: [Q] Inline functions -- trying to do far call
To: kenfoo AT techm DOT pl DOT my (Kenneth Foo)
Sender: ld AT jasmine (Long Doan)
Reply-To: ld AT netrix DOT com
Organization: Netrix Corporation
References: <806316619 DOT 115snx AT techm DOT pl DOT my>
Date: Fri, 21 Jul 1995 21:11:03 GMT
Lines: 84
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

  There are a few things that you should do:
  1. If the function that you jumps to is written for protected mode
  (i.e. It uses 32 bits push/ret, etc.), then it should be easiest
  to jump to that code. Ex:

void FarCallJump (int sel, int off)    /* This is *MUCH* easier than to
                                        * worry about the struct        */
{
  asm ("movl  $L_f_cal1l, %ecx \n\
        movb  $0xea, (%ecx)    \n\
        movl  8(%ebp), %edx    \n\
        movw  %dx, 5(%ecx)     \n\
        movl  12(%ebp), %edx   \n\
        movl  %edx, 1(%ecx)    \n\
        movl  %ebp, %esp       \n\  /* Trash our stack frame */
        popl  %ebp             \n\
        popl  %eax             \n\  /* Return address   */
        pushl %eflag           \n\  /* Make it looks like */
        pushl %eax             \n\  /* an interrupt   */
L_f_call1:                     \n\  /* Jump instruction */
        nop                    \n\
        nop \n\
        nop \n\
        nop \n\
        nop \n\
        nop \n\
        nop \n\
       ");
}

void FarCall (__dpmi_paddr *SelectorOffset32)
{ FarCallJump (SelectorOffset32->sel, SelectorOffset32->off);
}

  2. If the code is real-mode code, use the simulate_int functions.
  3. Is it really necessary to call a function to simulate an
interrupt? Maybe you can get away from it be using 'int' istructions.

Hope that helps,
Long.

In article <806316619 DOT 115snx AT techm DOT pl DOT my>, kenfoo AT techm DOT pl DOT my (Kenneth Foo) writes:
|> Concerning DJGPP 2...
|> 
|> I need something like this..
|> 
|>         __dpmi_paddr SelectorOffset32;
|> 
|>         DoINT(SelectorOffset32);
|>         //Simulate an interrupt by calling SelectorOffset32 (contains
|>         //a selector:offset32 pair).
|> 
|> However, I can't seem to do it (through inline assembly).
|> 
|> The assembly code is 'roughly' like this (not exact, because I really don't
|> fully understand writing inline assembly code).
|> 
|> inline void FarCall(__dpmi_paddr *SelectorOffset32) {
|>         asm("
|>         pushf
|>         lcall (_SelectorOffset32)       //I'm not sure how to put this.
|>         )
|>         :
|>         : "m" SelectorOffset32          //Or this. :)
|>         :"
|>         }
|> 
|> 
|> I'm really very unsure about that inline assembly code there. DJGPP 2
|> probably gave some big errors. (ugh!).
|> 
|> Thanks for any help!
|> 
|> 
|> PS: The reason for this is because I need to chain an original interrupt
|>     after hooking to it. I can't use _go32_chain_protected_mode_interrupt
|>     for some internal reasons. (I'm hooking to int 8h, and changing
|>     its speed).
|> --
|> []----------------------------------------------------------[]
|> | Kenneth Foo           Here's the question of the year:     |
|> | kenfoo AT techm DOT pl DOT my    Why do brains look like intestines?  |
|> []----------------------------------------------------------[]
|> 

- Raw text -


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