;Alto->8086 small-c compiler rev 2.0 C←CODE SEGMENT $INCLUDE(8086LIB.D) $INCLUDE(rpcpktiob.DEC) ASSUME CS:C←CODE, DS:C←DATA ; #include <Context.h> ; extern EnqueueAgain(); ; extern EnqueueBcst(); ; extern ServerMain(); ; extern struct Queue idlerQ; ; extern struct Queue *myCtxQ; ; extern struct Machine myHost; ; extern BindingInitialize(); ; extern SecurityInitialize(); ; struct Port { ; union Machine m; ; struct Socket s; ; }; ; RPCInitializeCtx(hearBroadcasts) ←RPCInitializeCtx: ; int hearBroadcasts; PUSH BP MOV BP,SP PUSH BX ; { ; int i, tmr; ; struct Port port; ; struct Machine m; ADD SP,0FFF4X ; InitPupLevel1 (myCtxQ, 28, 230); /* for 256 byte ether packets */ MOV BX,←myCtxQ PUSH BX MOV BX,0E6X MOV CX,01CX CALL ←InitPupLevel1 POP DX ; for (i = 0; i < 4; i += 1) { MOV WORD PTR [BP-4],0 X3: ; BX ← ←i MOV BX,[BP-4] CMP BX,4 JGE X2 JR X1 X4: INC WORD PTR [BP-4] JR X3 X1: ; RequestRoute(0); /* Initialize Routing tables */ XOR BX,BX CALL ←RequestRoute ; Dismiss(100); /* Wait for multiple response packets to arrive */ MOV BX,064X CALL ←Dismiss ; SetTmr(2000, &tmr); ;&←tmr LEA BX,[BP-6] MOV CX,07D0X CALL ←SetTmr ; while (!TmrExp(&tmr)) { X5: ;&←tmr LEA BX,[BP-6] CALL ←TmrExp OR BX,BX JNZ X6 ; m.w = GetPupHost(); CALL ←GetPupHost ; ←m ← BX POP DX PUSH BX ; if (m.b.net != 0) goto Break2; ; AL ← ←m POP AX PUSH AX OR AL,AL JZ X7 JMP ←Break2 X7: ; Block(); CALL ←Block ; }; JR X5 X6: ; }; JR X4 X2: ←Break2: ; Break2: ; InitCalendar(4); /* Get time of day set up */ MOV BX,4 CALL ←InitCalendar ; port.m.w = myHost.w = GetPupHost(); CALL ←GetPupHost MOV WORD PTR ←myHost,BX ; ←port ← BX MOV [BP-12],BX ; port.s.ms = port.s.midS = 0; MOV BYTE PTR [BP-8],0 MOV WORD PTR [BP-10],0 ; port.s.LS = rpcSocket; MOV BYTE PTR [BP-7],01EX ; OpenLevel1Socket(&port, &EnqueueAgain, 0); ;&←port LEA BX,[BP-12] PUSH BX XOR BX,BX MOV CX,OFFSET ←EnqueueAgain CALL ←OpenLevel1Socket POP DX ; port.s.LS = rpcBcstSocket; MOV BYTE PTR [BP-7],025X ; if (hearBroadcasts) OpenLevel1Socket(&port, &EnqueueBcst, 0); ; BX ← ←hearBroadcasts MOV BX,[BP-2] OR BX,BX JZ X8 ;&←port LEA BX,[BP-12] PUSH BX XOR BX,BX MOV CX,OFFSET ←EnqueueBcst CALL ←OpenLevel1Socket POP DX X8: ; BindingRopes(); CALL ←BindingRopes ; AgentRopes(); CALL ←AgentRopes ; BindingInitialize(); CALL ←BindingInitialize ; SecurityInitialize(); CALL ←SecurityInitialize ; StreamInitialize(); CALL ←StreamInitialize ; InitQueue(&idlerQ); LEA BX,←idlerQ CALL ←InitQueue ; for (i = 1; i < 4; i += 1) MOV WORD PTR [BP-4],1 X11: ; BX ← ←i MOV BX,[BP-4] CMP BX,4 JGE X10 JR X9 X12: INC WORD PTR [BP-4] JR X11 X9: ; StartNProcess("RPCServer", myCtxQ, &ServerMain, 300, 90); MOV BX,"RPCServer" PUSH BX MOV BX,←myCtxQ PUSH BX MOV BX,OFFSET ←ServerMain PUSH BX MOV BX,05AX MOV CX,012CX CALL ←StartNProcess ADD SP,6 JR X12 X10: ; }; MOV SP,BP POP BP RET; ; RPCRestart() ←RPCRestart: PUSH BP MOV BP,SP ; { ; StreamRestart(); /* forget connection counts */ CALL ←StreamRestart ; SecurityRestart(); /* invalidate local conversations */ CALL ←SecurityRestart ; BindingRestart(); /* nothing? */ CALL ←BindingRestart ; }; MOV SP,BP POP BP RET; ; Externals Declared Here PUBLIC ←RPCInitializeCtx PUBLIC ←RPCRestart C←CODE ENDS ; Number of Bytes of Code = 0F7X, (247)