sys7.1-doc-wip/OS/NetBoot/NetBootUtil.a
2019-07-27 22:37:48 +08:00

94 lines
2.9 KiB
Plaintext

;__________________________________________________________________________________________________
;
; File: NetBootUtil.a
;
; Contains: Network booting utility routines.
;
; Written by: Patrick Dyson
;
; Copyright © 1989 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <3> 12/28/89 SWC Fixed header and set tabs to 4.
; <2> 12/19/89 PD Adding to bbs
; <1.1> 12/12/89 PWD Added support for self-authenticating images
; <1.0> 10/30/89 PWD Adding to EASE
;__________________________________________________________________________________________________
CASE OBJ ; save case for C linker
myExtFSFilter
PROC EXPORT ; imported by netBoot.c
MOVEM.L A0-A4/D1-D2, -(SP) ; savem
CMP.B #$0F,ioTrap+1(A0) ; is this a MountVol call?
BNE @NotOurs
MOVE.W IODrvNum(A0), D0 ; pick up drive
CMP.W #4, D0 ; is this for us?
BNE @NotOurs
;
; go find the drive queue entry
;
LEA DrvQHdr,A2 ; get the drive queue header
MOVE.L qHead(A2),A1 ; start with first drive
CheckDrv
CMP.W dqDrive(A1),D0 ; our drive?
BEQ.S GotDrvNum ; yep, cruise
CMP.L qTail(A2),A1 ; no, are we at the end of the queue?
BEQ.S @NotOurs ; yes, we're hosed
MOVE.L qLink(A1),A1 ; point to next queue element
BRA.S CheckDrv ; go check it.
GotDrvNum ; in A1
CMP.W #dFSID, dQFSID(A1) ; ours?
BNE @NotOurs
MOVE.L dStorage(A1), D0 ; pick up driver globals (on end of entry)
MOVE.L A1, A4 ; save drive entry pointer
BEQ @Error
MOVE.L D0, A2 ; get globals pointer
SUB #ioQElSize,SP ; make a queue element
MOVE.L SP,A0 ; A0 -> queue element
MOVE #mountSysVol,csCode(A0) ; set control code
MOVE dProtoRefNum(A2),ioRefNum(A0) ; set driver refNum
_Control
BEQ.S @Good ; branch if no error
ADD #ioQElSize, SP ; restore stack
BRA @ControlError ; punt if error
@Good MOVE.L ioBuffer(A0), A1 ; pick up VCB pointer
MOVE.L A1, DefVCBPtr ; set as default volume
MOVE.L WDCBsPtr, A3
MOVE.L A1, WDVCBPtr+2(A3) ;
MOVEQ #2, D0 ; FSRtDirID
MOVE.L D0, WDDirID+2(A3) ;
CLR.L WDCatHint+2(A3)
CLR.L WDProcID+2(A3)
MOVE.L ioMisc(A0), A1 ; pick up drive queue pointer
MOVE dQFSID(A1), dQFSID(A4) ; set drive queue entry fsid
MOVE dQRefNum(A1), dQRefNum(A4) ; set driver refnum to handle calls
MOVE.B -3(A1), -3(A4) ; set flags
SUBQ #4, A1 ; point to buffer start
EXG A0, A1 ; set up for _Dispos
_DisposPtr ; nuke it
CLR.L dStorage(A4) ; wipe out reference to our storage
MOVE.L doldToExtFS(A2), ToExtFS ; restore ToExtFS (unhook ourselves)
MOVEQ #0, D0 ; set no error
ADD #ioQElSize, SP ; restore stack
BRA.S @Leave ; outta' here
@ControlError
@Leave
@NotOurs
MOVEM.L (SP)+, A0-A4/D1-D2 ; restorem
RTS
ENDP
END