1 |
|
* |
2 |
|
* asm_support.asm - AmigaOS utility functions in assembly language |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2002 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 |
25 |
|
INCLUDE "dos/dos.i" |
26 |
|
INCLUDE "devices/timer.i" |
27 |
|
|
28 |
+ |
INCLUDE "asmsupp.i" |
29 |
+ |
|
30 |
|
XDEF _AtomicAnd |
31 |
|
XDEF _AtomicOr |
32 |
|
XDEF _MoveVBR |
48 |
|
XREF _SysBase |
49 |
|
XREF _quit_emulator |
50 |
|
|
51 |
+ |
INFO_LEVEL equ 0 |
52 |
+ |
|
53 |
|
SECTION text,CODE |
54 |
|
|
55 |
|
MACHINE 68020 |
56 |
|
|
57 |
+ |
IFGE INFO_LEVEL |
58 |
+ |
subSysName: dc.b '+',0 |
59 |
+ |
ENDIF |
60 |
+ |
|
61 |
|
* |
62 |
|
* Atomic bit operations (don't trust the compiler) |
63 |
|
* |
253 |
|
* |
254 |
|
|
255 |
|
_TrapHandlerAsm: |
256 |
+ |
IFEQ INFO_LEVEL-1002 |
257 |
+ |
move.w ([6,a0]),-(sp) |
258 |
+ |
move.w #0,-(sp) |
259 |
+ |
move.l (4+6,a0),-(sp) |
260 |
+ |
PUTMSG 0,'%s/TrapHandlerAsm: addr=%08lx opcode=%04lx' |
261 |
+ |
lea (2*4,sp),sp |
262 |
+ |
ENDC |
263 |
+ |
|
264 |
|
cmp.l #4,(sp) ;Illegal instruction? |
265 |
|
beq.s doillinstr |
266 |
|
cmp.l #10,(sp) ;A-Line exception? |
267 |
|
beq.s doaline |
268 |
|
cmp.l #8,(sp) ;Privilege violation? |
269 |
|
beq.s doprivviol |
270 |
+ |
|
271 |
|
cmp.l #9,(sp) ;Trace? |
272 |
|
beq dotrace |
273 |
|
cmp.l #3,(sp) ;Illegal Address? |
274 |
|
beq.s doilladdr |
275 |
+ |
cmp.l #11,(sp) ;F-Line exception |
276 |
+ |
beq.s dofline |
277 |
|
|
278 |
|
cmp.l #32,(sp) |
279 |
|
blt 1$ |
280 |
|
cmp.l #47,(sp) |
281 |
|
ble doTrapXX ; Vector 32-47 : TRAP #0 - 15 Instruction Vectors |
282 |
|
|
283 |
< |
1$ move.l _OldTrapHandler,-(sp) ;No, jump to old trap handler |
283 |
> |
1$: |
284 |
> |
cmp.l #48,(sp) |
285 |
> |
blt 2$ |
286 |
> |
cmp.l #55,(sp) |
287 |
> |
ble doTrapFPU |
288 |
> |
2$: |
289 |
> |
IFEQ INFO_LEVEL-1009 |
290 |
> |
PUTMSG 0,'%s/TrapHandlerAsm: stack=%08lx %08lx %08lx %08lx' |
291 |
> |
ENDC |
292 |
> |
|
293 |
> |
move.l _OldTrapHandler,-(sp) ;No, jump to old trap handler |
294 |
|
rts |
295 |
|
|
296 |
|
* |
297 |
|
* TRAP #0 - 15 Instruction Vectors |
298 |
|
* |
299 |
|
|
300 |
< |
doTrapXX move.l a0,(sp) ;Save a0 |
300 |
> |
doTrapXX: |
301 |
> |
IFEQ INFO_LEVEL-1009 |
302 |
> |
PUTMSG 0,'%s/doTrapXX: stack=%08lx %08lx %08lx %08lx' |
303 |
> |
ENDC |
304 |
> |
|
305 |
> |
movem.l a0/d0,-(sp) ;Save a0,d0 |
306 |
> |
move.l (2*4,sp),d0 ;vector number 32-47 |
307 |
> |
|
308 |
|
move.l usp,a0 ;Get user stack pointer |
309 |
< |
move.l 2*4(sp),-(a0) ;Copy 4-word stack frame to user stack |
310 |
< |
move.l 1*4(sp),-(a0) |
309 |
> |
move.l (4*4,sp),-(a0) ;Copy 4-word stack frame to user stack |
310 |
> |
move.l (3*4,sp),-(a0) |
311 |
|
move.l a0,usp ;Update USP |
312 |
< |
move.l (sp)+,a0 ;Restore a0 |
312 |
> |
or.w #$2000,(a0) ;set Supervisor bit in SR |
313 |
|
|
314 |
+ |
lsl.l #2,d0 ;convert vector number to vector offset |
315 |
+ |
move.l d0,a0 |
316 |
+ |
move.l (a0),d0 ;get mac trap vector |
317 |
+ |
|
318 |
+ |
move.l usp,a0 ;Get user stack pointer |
319 |
+ |
move.l d0,-(a0) ;store vector offset as return address |
320 |
+ |
move.l a0,usp ;Update USP |
321 |
+ |
|
322 |
+ |
movem.l (sp)+,a0/d0 ;Restore a0,d0 |
323 |
|
addq.l #4*2,sp ;Remove exception frame from supervisor stack |
279 |
– |
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
324 |
|
|
325 |
< |
move.l $2d*4.w,-(sp) ;Jump to MacOS exception handler |
325 |
> |
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
326 |
|
rts |
327 |
|
|
328 |
|
|
329 |
|
* |
330 |
+ |
* FPU Exception Instruction Vectors |
331 |
+ |
* |
332 |
+ |
|
333 |
+ |
doTrapFPU: |
334 |
+ |
move.l d0,(sp) |
335 |
+ |
fmove.l fpcr,d0 |
336 |
+ |
and.w #$00ff,d0 ;disable FPU exceptions |
337 |
+ |
fmove.l d0,fpcr |
338 |
+ |
move.l (sp)+,d0 ;Restore d0 |
339 |
+ |
rte |
340 |
+ |
|
341 |
+ |
|
342 |
+ |
* |
343 |
|
* trace Vector |
344 |
|
* |
345 |
|
|
346 |
< |
dotrace move.l a0,(sp) ;Save a0 |
346 |
> |
dotrace |
347 |
> |
IFEQ INFO_LEVEL-1009 |
348 |
> |
PUTMSG 0,'%s/dotrace: stack=%08lx %08lx %08lx %08lx' |
349 |
> |
ENDC |
350 |
|
|
351 |
+ |
move.l a0,(sp) ;Save a0 |
352 |
|
move.l usp,a0 ;Get user stack pointer |
353 |
+ |
|
354 |
+ |
IFEQ INFO_LEVEL-1009 |
355 |
+ |
move.l (12,a0),-(sp) |
356 |
+ |
move.l (8,a0),-(sp) |
357 |
+ |
move.l (4,a0),-(sp) |
358 |
+ |
move.l (0,a0),-(sp) |
359 |
+ |
move.l a0,-(sp) |
360 |
+ |
move.l a7,-(sp) |
361 |
+ |
PUTMSG 0,'%s/dotrace: sp=%08lx usp=%08lx (%08lx %08lx %08lx %08lx)' |
362 |
+ |
lea (6*4,sp),sp |
363 |
+ |
ENDC |
364 |
+ |
|
365 |
|
move.l 3*4(sp),-(a0) ;Copy 6-word stack frame to user stack |
366 |
|
move.l 2*4(sp),-(a0) |
367 |
|
move.l 1*4(sp),-(a0) |
368 |
|
move.l a0,usp ;Update USP |
369 |
+ |
or.w #$2000,(a0) ;set Supervisor bit in SR |
370 |
|
move.l (sp)+,a0 ;Restore a0 |
371 |
|
|
372 |
|
lea 6*2(sp),sp ;Remove exception frame from supervisor stack |
385 |
|
move.l 8(sp),-(a0) ;Copy stack frame to user stack |
386 |
|
move.l 4(sp),-(a0) |
387 |
|
move.l a0,usp ;Update USP |
388 |
+ |
|
389 |
+ |
or.w #$2000,(a0) ;set Supervisor bit in SR |
390 |
|
move.l (sp)+,a0 ;Restore a0 |
391 |
|
|
392 |
|
addq.l #8,sp ;Remove exception frame from supervisor stack |
393 |
|
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
394 |
|
|
395 |
< |
and.w #$d8ff,_EmulatedSR ;enable interrupts in EmulatedSR |
395 |
> |
and.w #$f8ff,_EmulatedSR ;enable interrupts in EmulatedSR |
396 |
|
|
397 |
|
move.l $28.w,-(sp) ;Jump to MacOS exception handler |
398 |
|
rts |
399 |
|
|
400 |
|
* |
401 |
+ |
* F-Line handler: call F-Line exception handler |
402 |
+ |
* |
403 |
+ |
|
404 |
+ |
dofline move.l a0,(sp) ;Save a0 |
405 |
+ |
move.l usp,a0 ;Get user stack pointer |
406 |
+ |
move.l 8(sp),-(a0) ;Copy stack frame to user stack |
407 |
+ |
move.l 4(sp),-(a0) |
408 |
+ |
move.l a0,usp ;Update USP |
409 |
+ |
or.w #$2000,(a0) ;set Supervisor bit in SR |
410 |
+ |
move.l (sp)+,a0 ;Restore a0 |
411 |
+ |
|
412 |
+ |
addq.l #8,sp ;Remove exception frame from supervisor stack |
413 |
+ |
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
414 |
+ |
|
415 |
+ |
and.w #$f8ff,_EmulatedSR ;enable interrupts in EmulatedSR |
416 |
+ |
|
417 |
+ |
move.l $2c.w,-(sp) ;Jump to MacOS exception handler |
418 |
+ |
rts |
419 |
+ |
|
420 |
+ |
* |
421 |
|
* Illegal address handler |
422 |
|
* |
423 |
|
|
424 |
< |
doilladdr move.l a0,(sp) ;Save a0 |
424 |
> |
doilladdr: |
425 |
> |
IFEQ INFO_LEVEL-1009 |
426 |
> |
PUTMSG 0,'%s/doilladdr: stack=%08lx %08lx %08lx %08lx' |
427 |
> |
ENDC |
428 |
> |
|
429 |
> |
move.l a0,(sp) ;Save a0 |
430 |
|
|
431 |
|
move.l usp,a0 ;Get user stack pointer |
432 |
|
move.l 3*4(sp),-(a0) ;Copy 6-word stack frame to user stack |
433 |
|
move.l 2*4(sp),-(a0) |
434 |
|
move.l 1*4(sp),-(a0) |
435 |
|
move.l a0,usp ;Update USP |
436 |
+ |
or.w #$2000,(a0) ;set Supervisor bit in SR |
437 |
|
move.l (sp)+,a0 ;Restore a0 |
438 |
|
|
439 |
|
lea 6*2(sp),sp ;Remove exception frame from supervisor stack |
452 |
|
move.w ([6+2*4,sp]),d0 |
453 |
|
and.w #$ff00,d0 |
454 |
|
cmp.w #$7100,d0 |
455 |
+ |
|
456 |
+ |
IFEQ INFO_LEVEL-1009 |
457 |
+ |
move.l d0,-(sp) |
458 |
+ |
PUTMSG 0,'%s/doillinst: d0=%08lx stack=%08lx %08lx %08lx %08lx' |
459 |
+ |
lea (1*4,sp),sp |
460 |
+ |
ENDC |
461 |
|
movem.l (sp)+,a0/d0 |
462 |
|
beq 1$ |
463 |
|
|
466 |
|
move.l 8(sp),-(a0) ;Copy stack frame to user stack |
467 |
|
move.l 4(sp),-(a0) |
468 |
|
move.l a0,usp ;Update USP |
469 |
+ |
or.w #$2000,(a0) ;set Supervisor bit in SR |
470 |
|
move.l (sp)+,a0 ;Restore a0 |
471 |
|
|
472 |
|
add.w #3*4,sp ;Remove exception frame from supervisor stack |
475 |
|
move.l $10.w,-(sp) ;Jump to MacOS exception handler |
476 |
|
rts |
477 |
|
|
478 |
< |
1$ move.l a6,(sp) ;Save a6 |
478 |
> |
1$: |
479 |
> |
move.l a6,(sp) ;Save a6 |
480 |
|
move.l usp,a6 ;Get user stack pointer |
481 |
|
|
482 |
|
move.l a6,-10(a6) ;Push USP (a7) |
506 |
|
doprivviol move.l d0,(sp) ;Save d0 |
507 |
|
move.w ([6,sp]),d0 ;Get instruction word |
508 |
|
|
509 |
+ |
IFEQ INFO_LEVEL-1001 |
510 |
+ |
move.w ([6,a0]),-(sp) |
511 |
+ |
move.w #0,-(sp) |
512 |
+ |
PUTMSG 0,'%s/doprivviol: opcode=%04lx' |
513 |
+ |
lea (1*4,sp),sp |
514 |
+ |
ENDC |
515 |
+ |
|
516 |
|
cmp.w #$40e7,d0 ;move sr,-(sp)? |
517 |
|
beq pushsr |
518 |
|
cmp.w #$46df,d0 ;move (sp)+,sr? |
637 |
|
move.l (sp)+,a0 ;Restore a0 |
638 |
|
move.l (sp)+,d0 ;Restore d0 |
639 |
|
addq.l #2,2(sp) ;Skip instruction |
640 |
+ |
|
641 |
+ |
IFEQ INFO_LEVEL-1001 |
642 |
+ |
move.l (4),-(sp) |
643 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
644 |
+ |
lea (1*4,sp),sp |
645 |
+ |
ENDC |
646 |
|
rte |
647 |
|
|
648 |
|
; move (sp)+,sr |
669 |
|
move.l (sp)+,a0 ;Restore a0 |
670 |
|
move.l (sp)+,d0 ;Restore d0 |
671 |
|
addq.l #2,2(sp) ;Skip instruction |
672 |
+ |
|
673 |
+ |
IFEQ INFO_LEVEL-1001 |
674 |
+ |
move.l (4),-(sp) |
675 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
676 |
+ |
lea (1*4,sp),sp |
677 |
+ |
ENDC |
678 |
|
rte |
679 |
|
|
680 |
|
; ori #xxxx,sr |
687 |
|
move.w d0,_EmulatedSR ;And save them |
688 |
|
move.l (sp)+,d0 ;Restore d0 |
689 |
|
addq.l #4,2(sp) ;Skip instruction |
690 |
+ |
|
691 |
+ |
IFEQ INFO_LEVEL-1001 |
692 |
+ |
move.l (4),-(sp) |
693 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
694 |
+ |
lea (1*4,sp),sp |
695 |
+ |
ENDC |
696 |
|
rte |
697 |
|
|
698 |
|
; andi #xxxx,sr |
716 |
|
movem.l (sp)+,d0-d1/a0-a1/a6 |
717 |
|
1$ move.l (sp)+,d0 ;Restore d0 |
718 |
|
addq.l #4,2(sp) ;Skip instruction |
719 |
+ |
|
720 |
+ |
IFEQ INFO_LEVEL-1001 |
721 |
+ |
move.l (4),-(sp) |
722 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
723 |
+ |
lea (1*4,sp),sp |
724 |
+ |
ENDC |
725 |
|
rte |
726 |
|
|
727 |
|
; move #xxxx,sr |
753 |
|
move.l (sp)+,a0 ;Restore a0 |
754 |
|
move.l (sp)+,d0 ;Restore d0 |
755 |
|
addq.l #4,2(sp) ;Skip instruction |
756 |
+ |
|
757 |
+ |
IFEQ INFO_LEVEL-1001 |
758 |
+ |
move.l (4),-(sp) |
759 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
760 |
+ |
lea (1*4,sp),sp |
761 |
+ |
ENDC |
762 |
|
rte |
763 |
|
|
764 |
|
; move sr,(a0) |
767 |
|
move.w d0,(a0) ;Store SR |
768 |
|
move.l (sp)+,d0 ;Restore d0 |
769 |
|
addq.l #2,2(sp) ;Skip instruction |
770 |
+ |
|
771 |
+ |
IFEQ INFO_LEVEL-1001 |
772 |
+ |
move.l (4),-(sp) |
773 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
774 |
+ |
lea (1*4,sp),sp |
775 |
+ |
ENDC |
776 |
|
rte |
777 |
|
|
778 |
|
; move sr,(sp) |
784 |
|
move.l (sp)+,a0 ;Restore a0 |
785 |
|
move.l (sp)+,d0 ;Restore d0 |
786 |
|
addq.l #2,2(sp) ;Skip instruction |
787 |
+ |
|
788 |
+ |
IFEQ INFO_LEVEL-1001 |
789 |
+ |
move.l (4),-(sp) |
790 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
791 |
+ |
lea (1*4,sp),sp |
792 |
+ |
ENDC |
793 |
|
rte |
794 |
|
|
795 |
|
; fsave -(sp) |
800 |
|
move.l a0,usp ;Update USP |
801 |
|
move.l (sp)+,a0 ;Restore a0 |
802 |
|
addq.l #2,2(sp) ;Skip instruction |
803 |
+ |
|
804 |
+ |
IFEQ INFO_LEVEL-1001 |
805 |
+ |
move.l (4),-(sp) |
806 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
807 |
+ |
lea (1*4,sp),sp |
808 |
+ |
ENDC |
809 |
|
rte |
810 |
|
|
811 |
|
; fsave xxx(a5) |
816 |
|
move.l #$41000000,(a0) ;Push idle frame |
817 |
|
move.l (sp)+,a0 ;Restore a0 |
818 |
|
addq.l #4,2(sp) ;Skip instruction |
819 |
+ |
|
820 |
+ |
IFEQ INFO_LEVEL-1001 |
821 |
+ |
move.l (4),-(sp) |
822 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
823 |
+ |
lea (1*4,sp),sp |
824 |
+ |
ENDC |
825 |
|
rte |
826 |
|
|
827 |
|
; frestore (sp)+ |
832 |
|
move.l a0,usp ;Update USP |
833 |
|
move.l (sp)+,a0 ;Restore a0 |
834 |
|
addq.l #2,2(sp) ;Skip instruction |
835 |
+ |
|
836 |
+ |
IFEQ INFO_LEVEL-1001 |
837 |
+ |
move.l (4),-(sp) |
838 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
839 |
+ |
lea (1*4,sp),sp |
840 |
+ |
ENDC |
841 |
|
rte |
842 |
|
|
843 |
|
; frestore xxx(a5) |
845 |
|
move.l a0,(sp) ;Save a0 |
846 |
|
move.l (sp)+,a0 ;Restore a0 |
847 |
|
addq.l #4,2(sp) ;Skip instruction |
848 |
+ |
|
849 |
+ |
IFEQ INFO_LEVEL-1001 |
850 |
+ |
move.l (4),-(sp) |
851 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
852 |
+ |
lea (1*4,sp),sp |
853 |
+ |
ENDC |
854 |
|
rte |
855 |
|
|
856 |
|
; rte |
879 |
|
move.l a0,usp ;Update USP |
880 |
|
movem.l (sp)+,a0/a1 ;Restore a0 and a1 |
881 |
|
move.l (sp)+,d0 ;Restore d0 |
882 |
+ |
|
883 |
+ |
IFEQ INFO_LEVEL-1001 |
884 |
+ |
move.l (4),-(sp) |
885 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
886 |
+ |
lea (1*4,sp),sp |
887 |
+ |
ENDC |
888 |
|
rte |
889 |
|
|
890 |
|
; sizes of exceptions stack frames |
912 |
|
move.w (sp),d0 ;Get CCR |
913 |
|
or.w _EmulatedSR,d0 ;Add emulated supervisor bits |
914 |
|
addq.l #2,2(sp) ;Skip instruction |
915 |
+ |
|
916 |
+ |
IFEQ INFO_LEVEL-1001 |
917 |
+ |
move.l (4),-(sp) |
918 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
919 |
+ |
lea (1*4,sp),sp |
920 |
+ |
ENDC |
921 |
|
rte |
922 |
|
|
923 |
|
movefromsrd1 move.l (sp)+,d0 |
925 |
|
move.w (sp),d1 |
926 |
|
or.w _EmulatedSR,d1 |
927 |
|
addq.l #2,2(sp) |
928 |
+ |
|
929 |
+ |
IFEQ INFO_LEVEL-1001 |
930 |
+ |
move.l (4),-(sp) |
931 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
932 |
+ |
lea (1*4,sp),sp |
933 |
+ |
ENDC |
934 |
|
rte |
935 |
|
|
936 |
|
movefromsrd2 move.l (sp)+,d0 |
938 |
|
move.w (sp),d2 |
939 |
|
or.w _EmulatedSR,d2 |
940 |
|
addq.l #2,2(sp) |
941 |
+ |
|
942 |
+ |
IFEQ INFO_LEVEL-1001 |
943 |
+ |
move.l (4),-(sp) |
944 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
945 |
+ |
lea (1*4,sp),sp |
946 |
+ |
ENDC |
947 |
|
rte |
948 |
|
|
949 |
|
movefromsrd3 move.l (sp)+,d0 |
951 |
|
move.w (sp),d3 |
952 |
|
or.w _EmulatedSR,d3 |
953 |
|
addq.l #2,2(sp) |
954 |
+ |
|
955 |
+ |
IFEQ INFO_LEVEL-1001 |
956 |
+ |
move.l (4),-(sp) |
957 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
958 |
+ |
lea (1*4,sp),sp |
959 |
+ |
ENDC |
960 |
|
rte |
961 |
|
|
962 |
|
movefromsrd4 move.l (sp)+,d0 |
964 |
|
move.w (sp),d4 |
965 |
|
or.w _EmulatedSR,d4 |
966 |
|
addq.l #2,2(sp) |
967 |
+ |
|
968 |
+ |
IFEQ INFO_LEVEL-1001 |
969 |
+ |
move.l (4),-(sp) |
970 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
971 |
+ |
lea (1*4,sp),sp |
972 |
+ |
ENDC |
973 |
|
rte |
974 |
|
|
975 |
|
movefromsrd5 move.l (sp)+,d0 |
977 |
|
move.w (sp),d5 |
978 |
|
or.w _EmulatedSR,d5 |
979 |
|
addq.l #2,2(sp) |
980 |
+ |
|
981 |
+ |
IFEQ INFO_LEVEL-1001 |
982 |
+ |
move.l (4),-(sp) |
983 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
984 |
+ |
lea (1*4,sp),sp |
985 |
+ |
ENDC |
986 |
|
rte |
987 |
|
|
988 |
|
movefromsrd6 move.l (sp)+,d0 |
990 |
|
move.w (sp),d6 |
991 |
|
or.w _EmulatedSR,d6 |
992 |
|
addq.l #2,2(sp) |
993 |
+ |
|
994 |
+ |
IFEQ INFO_LEVEL-1001 |
995 |
+ |
move.l (4),-(sp) |
996 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
997 |
+ |
lea (1*4,sp),sp |
998 |
+ |
ENDC |
999 |
|
rte |
1000 |
|
|
1001 |
|
movefromsrd7 move.l (sp)+,d0 |
1003 |
|
move.w (sp),d7 |
1004 |
|
or.w _EmulatedSR,d7 |
1005 |
|
addq.l #2,2(sp) |
1006 |
+ |
|
1007 |
+ |
IFEQ INFO_LEVEL-1001 |
1008 |
+ |
move.l (4),-(sp) |
1009 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1010 |
+ |
lea (1*4,sp),sp |
1011 |
+ |
ENDC |
1012 |
|
rte |
1013 |
|
|
1014 |
|
; move dx,sr |
1030 |
|
movem.l (sp)+,d0-d1/a0-a1/a6 |
1031 |
|
1$ move.l (sp)+,d0 |
1032 |
|
addq.l #2,2(sp) |
1033 |
+ |
|
1034 |
+ |
IFEQ INFO_LEVEL-1001 |
1035 |
+ |
move.l (4),-(sp) |
1036 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1037 |
+ |
lea (1*4,sp),sp |
1038 |
+ |
ENDC |
1039 |
|
rte |
1040 |
|
|
1041 |
|
movetosrd1 move.l d1,d0 |
1066 |
|
beq.s movecvbra0 |
1067 |
|
cmp.w #$9801,d0 ;movec vbr,a1? |
1068 |
|
beq.s movecvbra1 |
1069 |
+ |
cmp.w #$A801,d0 ;movec vbr,a2? |
1070 |
+ |
beq.s movecvbra2 |
1071 |
|
cmp.w #$1801,d0 ;movec vbr,d1? |
1072 |
|
beq movecvbrd1 |
1073 |
|
cmp.w #$0002,d0 ;movec cacr,d0? |
1101 |
|
moveccacrd0 move.l (sp)+,d0 |
1102 |
|
move.l #$3111,d0 ;All caches and bursts on |
1103 |
|
addq.l #4,2(sp) |
1104 |
+ |
|
1105 |
+ |
IFEQ INFO_LEVEL-1001 |
1106 |
+ |
move.l (4),-(sp) |
1107 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1108 |
+ |
lea (1*4,sp),sp |
1109 |
+ |
ENDC |
1110 |
|
rte |
1111 |
|
|
1112 |
|
; movec cacr,d1 |
1113 |
|
moveccacrd1 move.l (sp)+,d0 |
1114 |
|
move.l #$3111,d1 ;All caches and bursts on |
1115 |
|
addq.l #4,2(sp) |
1116 |
+ |
|
1117 |
+ |
IFEQ INFO_LEVEL-1001 |
1118 |
+ |
move.l (4),-(sp) |
1119 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1120 |
+ |
lea (1*4,sp),sp |
1121 |
+ |
ENDC |
1122 |
|
rte |
1123 |
|
|
1124 |
|
; movec vbr,a0 |
1125 |
|
movecvbra0 move.l (sp)+,d0 |
1126 |
|
sub.l a0,a0 ;VBR always appears to be at 0 |
1127 |
|
addq.l #4,2(sp) |
1128 |
+ |
|
1129 |
+ |
IFEQ INFO_LEVEL-1001 |
1130 |
+ |
move.l (4),-(sp) |
1131 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1132 |
+ |
lea (1*4,sp),sp |
1133 |
+ |
ENDC |
1134 |
|
rte |
1135 |
|
|
1136 |
|
; movec vbr,a1 |
1137 |
|
movecvbra1 move.l (sp)+,d0 |
1138 |
|
sub.l a1,a1 ;VBR always appears to be at 0 |
1139 |
|
addq.l #4,2(sp) |
1140 |
+ |
|
1141 |
+ |
IFEQ INFO_LEVEL-1001 |
1142 |
+ |
move.l (4),-(sp) |
1143 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1144 |
+ |
lea (1*4,sp),sp |
1145 |
+ |
ENDC |
1146 |
+ |
rte |
1147 |
+ |
|
1148 |
+ |
; movec vbr,a2 |
1149 |
+ |
movecvbra2 move.l (sp)+,d0 |
1150 |
+ |
sub.l a2,a2 ;VBR always appears to be at 0 |
1151 |
+ |
addq.l #4,2(sp) |
1152 |
+ |
|
1153 |
+ |
IFEQ INFO_LEVEL-1001 |
1154 |
+ |
move.l (4),-(sp) |
1155 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1156 |
+ |
lea (1*4,sp),sp |
1157 |
+ |
ENDC |
1158 |
|
rte |
1159 |
|
|
1160 |
|
; movec vbr,d1 |
1161 |
|
movecvbrd1 move.l (sp)+,d0 |
1162 |
|
moveq.l #0,d1 ;VBR always appears to be at 0 |
1163 |
|
addq.l #4,2(sp) |
1164 |
+ |
|
1165 |
+ |
IFEQ INFO_LEVEL-1001 |
1166 |
+ |
move.l (4),-(sp) |
1167 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1168 |
+ |
lea (1*4,sp),sp |
1169 |
+ |
ENDC |
1170 |
|
rte |
1171 |
|
|
1172 |
|
; movec tc,d0 |
1173 |
|
movectcd0 addq.l #4,sp |
1174 |
|
moveq #0,d0 ;MMU is always off |
1175 |
|
addq.l #4,2(sp) |
1176 |
+ |
|
1177 |
+ |
IFEQ INFO_LEVEL-1001 |
1178 |
+ |
move.l (4),-(sp) |
1179 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1180 |
+ |
lea (1*4,sp),sp |
1181 |
+ |
ENDC |
1182 |
|
rte |
1183 |
|
|
1184 |
|
; movec tc,d1 +jl+ |
1185 |
|
movectcd1 move.l (sp)+,d0 ;Restore d0 |
1186 |
|
moveq #0,d1 ;MMU is always off |
1187 |
|
addq.l #4,2(sp) |
1188 |
+ |
|
1189 |
+ |
IFEQ INFO_LEVEL-1001 |
1190 |
+ |
move.l (4),-(sp) |
1191 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1192 |
+ |
lea (1*4,sp),sp |
1193 |
+ |
ENDC |
1194 |
|
rte |
1195 |
|
|
1196 |
|
; movec sfc,d1 +jl+ |
1197 |
|
movecsfcd1 move.l (sp)+,d0 ;Restore d0 |
1198 |
|
moveq #0,d1 |
1199 |
|
addq.l #4,2(sp) |
1200 |
+ |
|
1201 |
+ |
IFEQ INFO_LEVEL-1001 |
1202 |
+ |
move.l (4),-(sp) |
1203 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1204 |
+ |
lea (1*4,sp),sp |
1205 |
+ |
ENDC |
1206 |
|
rte |
1207 |
|
|
1208 |
|
; movec dfc,d1 +jl+ |
1209 |
|
movecdfcd1 move.l (sp)+,d0 ;Restore d0 |
1210 |
|
moveq #0,d1 |
1211 |
|
addq.l #4,2(sp) |
1212 |
+ |
|
1213 |
+ |
IFEQ INFO_LEVEL-1001 |
1214 |
+ |
move.l (4),-(sp) |
1215 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1216 |
+ |
lea (1*4,sp),sp |
1217 |
+ |
ENDC |
1218 |
|
rte |
1219 |
|
|
1220 |
|
movecurpd0 ; movec urp,d0 +jl+ |
1226 |
|
addq.l #4,sp |
1227 |
|
moveq.l #0,d0 ;MMU is always off |
1228 |
|
addq.l #4,2(sp) ;skip instruction |
1229 |
+ |
|
1230 |
+ |
IFEQ INFO_LEVEL-1001 |
1231 |
+ |
move.l (4),-(sp) |
1232 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1233 |
+ |
lea (1*4,sp),sp |
1234 |
+ |
ENDC |
1235 |
|
rte |
1236 |
|
|
1237 |
|
; movec x,cr |
1241 |
|
beq.s movectovbr |
1242 |
|
cmp.w #$1801,d0 ;movec d1,vbr? |
1243 |
|
beq.s movectovbr |
1244 |
+ |
cmp.w #$A801,d0 ;movec a2,vbr? |
1245 |
+ |
beq.s movectovbr |
1246 |
|
cmp.w #$0002,d0 ;movec d0,cacr? |
1247 |
|
beq.s movectocacr |
1248 |
|
cmp.w #$1002,d0 ;movec d1,cacr? |
1257 |
|
; movec x,vbr |
1258 |
|
movectovbr move.l (sp)+,d0 ;Ignore moves to VBR |
1259 |
|
addq.l #4,2(sp) |
1260 |
+ |
|
1261 |
+ |
IFEQ INFO_LEVEL-1001 |
1262 |
+ |
move.l (4),-(sp) |
1263 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1264 |
+ |
lea (1*4,sp),sp |
1265 |
+ |
ENDC |
1266 |
|
rte |
1267 |
|
|
1268 |
|
; movec dx,cacr |
1272 |
|
movem.l (sp)+,d1/a0-a1/a6 |
1273 |
|
move.l (sp)+,d0 |
1274 |
|
addq.l #4,2(sp) |
1275 |
+ |
|
1276 |
+ |
IFEQ INFO_LEVEL-1001 |
1277 |
+ |
move.l (4),-(sp) |
1278 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1279 |
+ |
lea (1*4,sp),sp |
1280 |
+ |
ENDC |
1281 |
|
rte |
1282 |
|
|
1283 |
|
; movec x,sfc |
1284 |
|
; movec x,dfc |
1285 |
|
movectoxfc move.l (sp)+,d0 ;Ignore moves to SFC, DFC |
1286 |
|
addq.l #4,2(sp) |
1287 |
+ |
|
1288 |
+ |
IFEQ INFO_LEVEL-1001 |
1289 |
+ |
move.l (4),-(sp) |
1290 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1291 |
+ |
lea (1*4,sp),sp |
1292 |
+ |
ENDC |
1293 |
|
rte |
1294 |
|
|
1295 |
|
; cpusha |
1296 |
|
cpushadc |
1297 |
< |
cpushadcic movem.l d1/a0-a1/a6,-(sp) ;Clear caches |
1297 |
> |
cpushadcic |
1298 |
> |
IFEQ INFO_LEVEL-1003 |
1299 |
> |
move.l (4),-(sp) |
1300 |
> |
move.l d0,-(sp) |
1301 |
> |
PUTMSG 0,'%s/cpushadc: opcode=%04lx Execbase=%08lx' |
1302 |
> |
lea (2*4,sp),sp |
1303 |
> |
ENDC |
1304 |
> |
movem.l d1/a0-a1/a6,-(sp) ;Clear caches |
1305 |
|
move.l _SysBase,a6 |
1306 |
|
JSRLIB CacheClearU |
1307 |
|
movem.l (sp)+,d1/a0-a1/a6 |
1313 |
|
moveuspa1 move.l (sp)+,d0 |
1314 |
|
move usp,a1 |
1315 |
|
addq.l #2,2(sp) |
1316 |
+ |
|
1317 |
+ |
IFEQ INFO_LEVEL-1009 |
1318 |
+ |
move.l a1,-(sp) |
1319 |
+ |
move.l a7,-(sp) |
1320 |
+ |
PUTMSG 0,'%s/moveuspa1: a7=%08lx a1=%08lx' |
1321 |
+ |
lea (2*4,sp),sp |
1322 |
+ |
ENDC |
1323 |
+ |
|
1324 |
|
rte |
1325 |
|
|
1326 |
|
; move usp,a0 +jl+ |
1327 |
|
moveuspa0 move.l (sp)+,d0 |
1328 |
|
move usp,a0 |
1329 |
|
addq.l #2,2(sp) |
1330 |
+ |
|
1331 |
+ |
IFEQ INFO_LEVEL-1009 |
1332 |
+ |
move.l a0,-(sp) |
1333 |
+ |
move.l a7,-(sp) |
1334 |
+ |
PUTMSG 0,'%s/moveuspa0: a7=%08lx a0=%08lx' |
1335 |
+ |
lea (2*4,sp),sp |
1336 |
+ |
ENDC |
1337 |
+ |
|
1338 |
|
rte |
1339 |
|
|
1340 |
|
; move a1,usp +jl+ |
1341 |
|
moved1usp move.l (sp)+,d0 |
1342 |
|
move a1,usp |
1343 |
|
addq.l #2,2(sp) |
1344 |
+ |
|
1345 |
+ |
IFEQ INFO_LEVEL-1001 |
1346 |
+ |
move.l (4),-(sp) |
1347 |
+ |
PUTMSG 0,'%s/doprivviol END: Execbase=%08lx' |
1348 |
+ |
lea (1*4,sp),sp |
1349 |
+ |
ENDC |
1350 |
|
rte |
1351 |
|
|
1352 |
|
; |
1368 |
|
rts |
1369 |
|
|
1370 |
|
|
1371 |
+ |
CopyTrapStack: |
1372 |
+ |
movem.l d0/a0/a1,-(sp) |
1373 |
+ |
|
1374 |
+ |
move.w (5*4+6,sp),d0 ;get format word |
1375 |
+ |
lsr.w #7,d0 ;get stack frame Id |
1376 |
+ |
lsr.w #4,d0 |
1377 |
+ |
and.w #$001e,d0 |
1378 |
+ |
move.w (StackFormatTable,pc,d0.w),d0 ; get total stack frame length |
1379 |
+ |
|
1380 |
+ |
lea (5*4,sp),a0 ;get start of exception stack frame |
1381 |
+ |
move.l usp,a1 ;Get user stack pointer |
1382 |
+ |
bra 1$ |
1383 |
+ |
|
1384 |
+ |
2$ move.w (a0)+,(a1)+ ; copy additional stack words back to supervisor stack |
1385 |
+ |
1$ dbf d0,2$ |
1386 |
+ |
|
1387 |
+ |
move.l (3*4,sp),-(a0) ;copy return address to new top of stack |
1388 |
+ |
move.l a0,sp |
1389 |
+ |
rts |
1390 |
+ |
|
1391 |
|
END |