home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,646 of 4,675   
   R.Wieser to R.Wieser   
   Re: Indirect INT calling   
   01 Nov 18 11:00:09   
   
   From: address@nospicedham.not.available   
      
   [quoting myself]   
   > Hmmm...  I'm rather sure that with some stack shennigans I could   
   > change the stackframe of a simple near call of a procedure into a   
   > push-and-far-return, needing only the far jump to the INT procedure ...   
      
   For anyone interrested, the below is the resulting code:   
      
   - - - - - - - - - - - - - - - - - -   
    push ax   ;Save AX   
    pushf    ;Save flags   
    cli   
      
    push bp   ;Save BP   
    mov bp,sp   ;Point to our stack frame   
      
    mov ax,[bp+WORD*1]  ;Swap RET offset and flags   
    xchg ax,[bp+WORD*3]   
    mov [bp+WORD*1],ax  ;/   
      
    mov ax,cs   ;Store RET segment and recover AX   
    xchg ax,[bp+WORD*2]  ;/   
      
    pop bp   ;Restore BP   
      
    db 0EAh   ;Abs Seg:Ofs jump   
   gIntVct dw ?,?   ;Ofs,Seg   
   - - - - - - - - - - - - - - - - - -   
      
   "gIntVct" ofcourse needs to be initialized by copying the apropriate INT   
   vector (from page zero) into it.   
      
   > I'm not sure I would actually want to use it though ... (too hackish)   
      
   And it doesn't even look half bad either.  A single extra stack while   
   building the call, but not while executing it.   
      
   Regards   
   Rudy Wieser   
      
      
   "R.Wieser"  wrote in message   
   news:pr6u6c$t4f$1@gioia.aioe.org...   
   > Terje,   
   >   
   >> Adding 10-100 patch locations in order to save a single word of stack   
   >> space?   
   >>   
   >> "You gotta be kidding!"   
   >> :-)   
   >   
   > I think you misunderstood.  I was expressing my preference for a single   
   > procedure (with a singe to-be-patched byte) which gets called instead of   
   > any   
   > INT 0x60.   
   >   
   > But now you mention it, creating a patching framework just to save a   
   > single   
   > stack save does sound a bit exessive, doesn't it ?   
   >   
   > On the other hand, I *did* ask for possible other solutions, and that it   
   > certainly is. :-)   
   >   
   >> Before calling a driver which switches to a private stack anyway?   
   >   
   > :-)  That is for thr SIS900 packet driver. I cannot say anything about   
   > others.  They might, but they also might not.   
   >   
   > Hmmm...  I'm rather sure that with some stack shennigans I could change   
   > the   
   > stackframe of a simple near call of a procedure into a   
   > push-and-far-return,   
   > needing only the far jump to the INT procedure ...   
   >   
   > I'm not sure I would actually want to use it though ... (too hackish) :-)   
   >   
   > Regards,   
   > Rudy Wieser   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca