ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/AmigaOS/asm_support.asm
(Generate patch)

Comparing BasiliskII/src/AmigaOS/asm_support.asm (file contents):
Revision 1.7 by cebix, 2000-10-17T12:24:58Z vs.
Revision 1.10 by cebix, 2001-06-30T12:58:07Z

# Line 1 | Line 1
1   *
2   * asm_support.asm - AmigaOS utility functions in assembly language
3   *
4 < * Basilisk II (C) 1997-1999 Christian Bauer
4 > * Basilisk II (C) 1997-2001 Christian Bauer
5   *
6   * This program is free software; you can redistribute it and/or modify
7   * it under the terms of the GNU General Public License as published by
# Line 28 | Line 28
28                  XDEF    _AtomicAnd
29                  XDEF    _AtomicOr
30                  XDEF    _MoveVBR
31 +                XDEF    _DisableSuperBypass
32                  XDEF    _Execute68k
33                  XDEF    _Execute68kTrap
34                  XDEF    _TrapHandlerAsm
35                  XDEF    _ExceptionHandlerAsm
35                XDEF    _Scod060Patch1
36                XDEF    _Scod060Patch2
37                XDEF    _ThInitFPUPatch
36                  XDEF    _AsmTriggerNMI
37  
38                  XREF    _OldTrapHandler
# Line 50 | Line 48
48  
49                  SECTION text,CODE
50  
51 +                MACHINE 68020
52 +
53   *
54   * Atomic bit operations (don't trust the compiler)
55   *
# Line 107 | Line 107 | setvbr         movec   d0,vbr
107                  rte
108  
109   *
110 + * Disable 68060 Super Bypass mode
111 + *
112 +
113 + _DisableSuperBypass
114 +                movem.l d0-d1/a0-a1/a5-a6,-(sp)
115 +                move.l  _SysBase,a6
116 +
117 +                lea     dissb,a5
118 +                JSRLIB  Supervisor
119 +
120 +                movem.l (sp)+,d0-d1/a0-a1/a5-a6
121 +                rts
122 +
123 +                MACHINE 68060
124 +
125 + dissb           movec   pcr,d0
126 +                bset    #5,d0
127 +                movec   d0,pcr
128 +                rte
129 +
130 +                MACHINE 68020
131 +
132 + *
133   * Execute 68k subroutine (must be ended with rts)
134   * r->a[7] and r->sr are unused!
135   *
# Line 218 | Line 241 | _ExceptionHandlerAsm
241                  rts
242  
243   *
221 * Process Manager 68060 FPU patches
222 *
223
224 _Scod060Patch1  fsave   -(sp)           ;Save FPU state
225                tst.b   2(sp)           ;Null?
226                beq.s   1$
227                fmovem.x fp0-fp7,-(sp)  ;No, save FPU registers
228                fmove.l fpiar,-(sp)
229                fmove.l fpsr,-(sp)
230                fmove.l fpcr,-(sp)
231                pea     -1              ;Push "FPU state saved" flag
232 1$              move.l  d1,-(sp)
233                move.l  d0,-(sp)
234                bsr.s   3$              ;Switch integer registers and stack
235                addq.l  #8,sp
236                tst.b   2(sp)           ;New FPU state null or "FPU state saved" flag set?
237                beq.s   2$
238                addq.l  #4,sp           ;Flag set, skip it
239                fmove.l (sp)+,fpcr      ;Restore FPU registers and state
240                fmove.l (sp)+,fpsr
241                fmove.l (sp)+,fpiar
242                fmovem.x (sp)+,fp0-fp7
243 2$              frestore (sp)+
244                movem.l (sp)+,d0-d1
245                rts
246
247 3$              move.l  4(sp),a0        ;Switch integer registers and stack
248                move    sr,-(sp)
249                movem.l d2-d7/a2-a6,-(sp)
250                cmp.w   #0,a0
251                beq.s   4$
252                move.l  sp,(a0)
253 4$              move.l  $36(sp),a0
254                movem.l (a0)+,d2-d7/a2-a6
255                move    (a0)+,sr
256                move.l  a0,sp
257                rts
258
259 _Scod060Patch2  move.l  d0,-(sp)        ;Create 68060 null frame on stack
260                move.l  d0,-(sp)
261                move.l  d0,-(sp)
262                frestore (sp)+          ;and load it
263                rts
264
265 *
266 * Thread Manager 68060 FPU patches
267 *
268
269 _ThInitFPUPatch tst.b   $40(a4)
270                bne.s   1$
271                moveq   #0,d0           ;Create 68060 null frame on stack
272                move.l  d0,-(a3)
273                move.l  d0,-(a3)
274                move.l  d0,-(a3)
275 1$              rts
276
277 *
244   * Trap handler of main task
245   *
246  
# Line 669 | Line 635 | movefromsrsp   move.l  a0,-(sp)                ;Save a0
635   fsavepush       move.l  (sp),d0                 ;Restore d0
636                  move.l  a0,(sp)                 ;Save a0
637                  move.l  usp,a0                  ;Get user stack pointer
638 <                fsave   -(a0)                   ;Push FP state
638 >                move.l  #$41000000,-(a0)        ;Push idle frame
639                  move.l  a0,usp                  ;Update USP
640                  move.l  (sp)+,a0                ;Restore a0
641                  addq.l  #2,2(sp)                ;Skip instruction
642                  rte
643  
644 + ; fsave xxx(a5)
645 + fsavea5         move.l  (sp),d0                 ;Restore d0
646 +                move.l  a0,(sp)                 ;Save a0
647 +                move.l  a5,a0                   ;Get base register
648 +                add.w   ([6,sp],2),a0           ;Add offset to base register
649 +                move.l  #$41000000,(a0)         ;Push idle frame
650 +                move.l  (sp)+,a0                ;Restore a0
651 +                addq.l  #4,2(sp)                ;Skip instruction
652 +                rte
653 +
654   ; frestore (sp)+
655   frestorepop     move.l  (sp),d0                 ;Restore d0
656                  move.l  a0,(sp)                 ;Save a0
657                  move.l  usp,a0                  ;Get user stack pointer
658 <                frestore (a0)+                  ;Restore FP state
658 >                addq.l  #4,a0                   ;Nothing to do...
659                  move.l  a0,usp                  ;Update USP
660                  move.l  (sp)+,a0                ;Restore a0
661                  addq.l  #2,2(sp)                ;Skip instruction
662                  rte
663  
664 < ; frestore xxx(a5) +jl+
664 > ; frestore xxx(a5)
665   frestorea5      move.l  (sp),d0                 ;Restore d0
666                  move.l  a0,(sp)                 ;Save a0
691                move.l  a5,a0                   ;Get base register
692                add.w   ([6,sp],2),a0           ;Add offset to base register
693                frestore (a0)                   ;Restore FP state from (a0)
694                move.l  (sp)+,a0                ;Restore a0
695                addq.l  #4,2(sp)                ;Skip instruction
696                rte
697
698 ; fsave xxx(a5) +jl+
699 fsavea5         move.l  (sp),d0                 ;Restore d0
700                move.l  a0,(sp)                 ;Save a0
701                move.l  a5,a0                   ;Get base register
702                add.w   ([6,sp],2),a0           ;Add offset to base register
703                fsave   (a0)                    ;Push FP state to (a0)
667                  move.l  (sp)+,a0                ;Restore a0
668                  addq.l  #4,2(sp)                ;Skip instruction
669                  rte

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines