1 ; ***********************************************************
  2 ; *                                                         *
  3 ; * Copyright, (C) Honeywell Bull Inc., 1987                *
  4 ; *                                                         *
  5 ; * Copyright, (C) Honeywell Information Systems Inc., 1986 *
  6 ; *                                                         *
  7 ; ***********************************************************
  8 
  9 ; HISTORY COMMENTS:
 10 ;  1) change(86-06-16,Westcott), approve(87-07-13,MCR7580),
 11 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 12 ;     Created
 13 ;                                                      END HISTORY COMMENTS
 14 
 15 ;/* : PROCEDURE FUNCTION (wsexecap)
 16 ;
 17 ;Pass a message received from a remote MOWSE, to an application by calling
 18 ;it's entry point stored in the local CAT. The calling sequence for the
 19 ;application is:
 20 ;
 21 ;        p_event(mcb_ptr,minor_cap,bufseg,bufoff,buflen)
 22 ;
 23 ;        where  mcb_ptr = pointer to application's mcb
 24 ;               minor_cap = minor capability number in the message
 25 ;               bufseg = segment address of the message
 26 ;               bufoff = offset address of the message
 27 ;               buflen = length of the message
 28 ;*/
 29 
 30 ;/* : NOTES
 31 ;
 32 ;Syntax: wsexecap(catptr,capmsgp,capmsgl)
 33 ;        struct local_cat *catptr;
 34 ;        struct execap_msg *capmsgp;
 35 ;        int capmsgl;
 36 ;
 37 ;Arguments:
 38 ;        *catptr  - pointer to cat entry for application
 39 ;        *capmsgp - pointer to the structure that contains the message
 40 ;        capmsgl  - length of the message
 41 ;*/
 42 
 43 include dos.mac
 44 include ws.mac
 45 include ws_msg.mac
 46 include cat.mac
 47 
 48 ;------------- DATA
 49 
 50 dseg
 51 
 52 capstr  struc
 53 oldbp   dw      ?
 54 retn    dw      ?
 55 catptr  dw      ?
 56 catmsgp dw      ?
 57 catmsgl dw      ?
 58 capstr  ends
 59 endds
 60 
 61 ;*******************************************************************
 62 ;                           MAIN
 63 ;*******************************************************************
 64 pseg
 65 
 66        public wsexecap
 67 wsexecap proc near
 68 
 69         push    bp
 70         mov     bp,sp
 71         mov     bx,[bp].catptr
 72 
 73 ;/* : load relevant information into registers since we must switch
 74 ;     to user's address space in order to set up a call to p_event */
 75 
 76         mov     si,[bp].catmsgp
 77         mov     cx,[bp].catmsgl
 78         mov     al,[si].ep_minor
 79         xor     ah,ah
 80         mov     di,[bx].mcb_ptr
 81 
 82 ;/* : Switch to the user's stack. */
 83 
 84         mov     dx,ss
 85         mov     bp,sp
 86         cli
 87         mov     ss,ssreg[bx]
 88         mov     sp,spreg[bx]
 89         sti
 90 
 91 ;/* : The call to the user's application is accomplished by pushing a small
 92 ;     program into the user's stack that, when called, will do a far call
 93 ;     to the application. */
 94 
 95         push    dx
 96         push    bp
 97         push    es
 98         push    ds
 99         sub     sp,0ch
100         mov     bp,sp
101         lea     dx,[bp+4]
102         mov     [bp],dx
103         mov     [bp+2],ss
104         mov     byte ptr [bp+05h],09ah
105         mov     byte ptr [bp+0ah],0cbh
106         mov     byte ptr [bp+04h],090h
107         mov     dx,csreg[bx]
108         mov     [bp+08h],dx
109         mov     dx,ws_entry[bx]
110         mov     [bp+06h],dx
111 
112 ;/* : Set user's DS and ES registers. */
113 
114         mov     dx,ds
115         push    esreg[bx]
116         push    dsreg[bx]
117         pop     ds
118         pop     es
119         mov     bp,sp
120         push    cx              ; push message length
121         push    si              ; push message offset
122         push    dx              ; push message segment
123         push    ax              ; push minor capability number
124         push    di              ; push mcb pointer
125 
126 ;/* : Call the user application */
127 
128         call    dword ptr [bp]     ; call user application
129         mov     sp,bp
130         add     sp,0ch
131         pop     ds
132         pop     es
133         pop     bx
134         pop     dx
135 
136 ;/* : restore mowse's segment registers and stack */
137 
138         cli
139         mov     ss,dx
140         mov     sp,bx
141         sti
142         pop     bp
143         ret
144 
145 wsexecap endp
146 endps
147         end
148 ^Z