SwitchCheck: movem.l d0/d1/a0/a1,-(a7)
    jsr _LVOForbid(a6)
   lea ExecutivePortName,a1
    jsr _LVOFindPort(a6)             ;test if Executive is installed
   tst.l d0
    bne.w Executivefound
   btst #AFB_68060,AttnFlags+1(a6)  ;check for 68060 CPU
    bne.b ExitSwitchCheck           ; install only for 68040 or 68881/82
   btst #AFB_68881,AttnFlags+1(a6)  ; check for 68881/882, if present
    bne.b FPU
NOFPU: movea.l a6,a1
   move.l MemForPatch,d0
   add.l #SwitchNOFPU-StartPatch,d0
   movea.w #_LVOSwitch,a0
    jsr _LVOSetFunction(a6)
   bra.b ExitSwitchCheck
 cnop 0,4
FPU: movea.l a6,a1
   move.l MemForPatch,d0
   add.l #ContextRestore-StartPatch,d0
   move.l d0,$230(a6)                  ; install the new FPU optimized context restore routine
   move.l MemForPatch,d0
   add.l #SwitchFPU-StartPatch,d0
   movea.w #_LVOSwitch,a0
    jsr _LVOSetFunction(a6)
ExitSwitchCheck: jsr _LVOCacheClearU(a6)
    jsr _LVOPermit(a6)
   movem.l (a7)+,d0/d1/a0/a1
  rts
 cnop 0,4
Executivefound: jsr _LVOPermit(a6)
    tst.l opt0
     bne.b .exit
    movea.l DOSBase,a6
    move.l #ExecutiveMsg,d1
     jsr _LVOPutStr(a6)
    movea.l 4.w,a6
.exit:   movem.l (a7)+,d0/d1/a0/a1
  rts

