@sq7bti, post #1
@Don_Adan, post #2
; Check if we have a 68881 numeric coprocessor, and if so, fix up ; some more vectors. This needs to be done since we also need to ; save the 68881's context when we switch tasks. FC0408 btst #4,D0 Do we have a 68881? If so, FC040C beq.s FC041E FC040E move.l #$FC108A,-$34(A6) Use a different Switch() function. FC0416 move.l #$FC10E8,-$3A(A6) Use a different Dispatch() funciton.
--------------------------------------------------------------------------- Dispatch() [Version for machines with a 68881 FPP] --------------------------------------------------------------------------- FC10E8 lea FC10F0(PC),A4 Point to 68881 context-restore. ; The regular Dispatch() can be used for the rest. FC10EC bra FC0F2E ; Special 68881 FPP compatible context restore ; -------------------------------------------- ; 68020/68881 specific material. Without documentation for those ; processors, I can't comment this. FC10F0 move.b (A5),D0 FC10F2 beq.s FC1110 FC10F4 addq.l #2,A5 [...]
--------------------------------------------------------------------------- Dispatch() [Version for machines without a numeric coprocessor] --------------------------------------------------------------------------- ; This routine dispatches the next runnable task, if there is one. ; If the TaskReady queue is empty, the routine waits, stopping ; the processor and checking the queue again each time it resumes ; running (after an interrupt). ; When a runnable task is found, it is dispatched. Its context ; and interrupt disable level are restored, and the TB_LAUNCH ; and TB_EXCEPT flags are checked. If either is set, they are ; handled. FC0F2A lea FC0FA6(PC),A4 Address of context-restore routine for machines without an FPP. FC0F2E move.w #$FFFF,$0126(A6) Initialize interrupt disable level FC0F34 move.w #$C000,DFF09A at -1, and enable interrupts. FC0F3C lea $0196(A6),A0 Point at the TaskReady queue. FC0F40 move #$2700,SR Mask all maskable interrupts. FC0F44 move.l (A0),A3 Check for a task descriptor at FC0F46 move.l (A3),D0 the front of the queue. FC0F48 bne.s FC0F5A ; TaskReady queue is empty. Halt the processor until the next ; interrupt, then check for runnable tasks again. FC0F4A addq.l #1,$0118(A6) Increment the idle counter. FC0F4E bset #7,$0124(A6) Set the rescheduling attention flag. [b]FC0F54 stop #$2000 Enable all interrupts and stop.[/b] FC0F56 move.l D0,D0 FC0F58 bra.s FC0F40 Go back and check for runnable tasks. ; We have a runnable task. FC0F5A move.l D0,(A0) Unlink the task descriptor from FC0F5C move.l D0,A1 the TaskReady queue. FC0F5E move.l A0,4(A1) [...]
@sq7bti, post #3
@Don_Adan, post #4
**************************************************************************** * * * Comments copyright (c) 1989 Markus Wandel * * * * Release date: February 3, 1989. * * * * The following is a complete disassembly of the Amiga 1.2 "exec", as * * found on a kickstart disk for an Amiga 1000. Everything is shown, * * right down to the padding introduced by the linker, and unused code * * fragments which probably made it in by accident. * * * * Thorough familiarity with the Rom Kernel Manual: Exec, with suitable * * updates to version 1.2, and the exec subdirectory of the include files, * * is assumed in all comments. Where existing documentation appears to * * be inadequate, or a particular section of code is judged to be more * * interesting than most, comments are more extensive. * * *
@sq7bti, post #5
@Don_Adan, post #6
$ romtool query kick.a1200.46.143 rom @f80000 +080000 sum=39dd0dd3@0007ffe8 Kickstart 46.143 Hyperion(A1200_R2) @000000 +004160 =004160 (r: 169,f: 2,p: 0) sum=69c7aca8 exec_46.45(A1200_R2) @004160 +000b0c =004c6c (r: 12,f: 2,p: 0) sum=7656612c expansion_45.4(A1200) [...]
1584: 286e 0230 movea.l 560(a6),a4 ?? 1588: 266e 0114 movea.l 276(a6),a3 158c: 3740 0010 move.w d0,16(a3) 1590: 274d 0036 move.l a5,54(a3) 1594: 082b 0006 000e btst #6,14(a3) 159a: 671a beq.s 0x15b6 159c: 2a6b 0042 movea.l 66(a3),a5 15a0: 4e95 jsr (a5) 15a2: 6012 bra.s 0x15b6 15a4: 286e 0230 movea.l 560(a6),a4 15a8: 3d7c ffff 0126 move.w #-1,294(a6) Initialize interrupt disable level 15ae: 33fc c000 00df move.w #-16384,0xdff09a at -1, and enable interrupts. 15b4: f09a 15b6: 41ee 0196 lea 406(a6),a0 Point at the TaskReady queue. 15ba: 46fc 2700 move.w #9984,sr Mask all maskable interrupts. 15be: 2650 movea.l (a0),a3 Check for a task descriptor at 15c0: 2013 move.l (a3),d0 the front of the queue. 15c2: 6610 bne.s 0x15d4 ; TaskReady queue is empty. Halt the processor until the next ; interrupt, then check for runnable tasks again. 15c4: 52ae 0118 addq.l #1,280(a6) Increment the idle counter. 15c8: 08ee 0007 0124 bset #7,292(a6) Set the rescheduling attention flag. 15ce: 4e72 2000 stop #8192 Enable all interrupts and stop. 15d2: 60e6 bra.s 0x15ba Go back and check for runnable tasks. ; We have a runnable task. 15d4: 2080 move.l d0,(a0) Unlink the task descriptor from 15d6: 2240 movea.l d0,a1 the TaskReady queue. 15d8: 2348 0004 move.l a0,4(a1) 15dc: 2d4b 0114 move.l a3,276(a6) Set the current task pointer. 15e0: 3d6e 0120 0122 move.w 288(a6),290(a6) Initialize the time-slice counter. 15e6: 08ae 0006 0124 bclr #6,292(a6) Reset the time slice expired flag. 15ec: 177c 0002 000f move.b #2,15(a3) Set the task's state to TS_RUN. 15f2: 3d6b 0010 0126 move.w 16(a3),294(a6) Restore the interrupt disable level. 15f8: 4a2e 0126 tst.b 294(a6) 15fc: 6b08 bmi.s 0x1606 Disable interrupts if interrupt 15fe: 33fc 4000 00df move.w #16384,0xdff09a disable level >= 0. 1604: f09a 1606: 46fc 2000 move.w #8192,sr Enable all interrupts. 160a: 52ae 011c addq.l #1,284(a6) ?? Increment the dispatch counter. ?? 160e: 102b 000e move.b 14(a3),d0 Get the task's flags. 1612: c03c 00a0 and.b #-96,d0 Check for TB_EXCEPT or TB_LAUNCH. 1616: 6702 beq.s 0x161a 1618: 6118 bsr.s 0x1632 Process the flags if either was set. 161a: 2a6b 0036 movea.l 54(a3),a5 Get the user stack pointer. 161e: 4ed4 jmp (a4) Restore the CPU context. 1620: 4e75 rts ??
@sq7bti, post #9
@Don_Adan, post #8
--- orig/exec_46.asm 2023-02-08 21:10:00.575231080 +0100 +++ LP/exec_46.asm 2023-02-08 21:10:10.867159681 +0100 [....] @@ -2026,55 +2026,53 @@ MOVE #$2700,SR ;000015ba: 46fc2700 MOVEA.L (A0),A3 ;000015be: 2650 MOVE.L (A3),D0 ;000015c0: 2013 - BNE.S LAB_00F1 ;000015c2: 6610 + BNE.S LAB_00F1 ;000015c2: 6612 ADDQ.L #1,(280,A6) ;000015c4: 52ae0118 BSET #7,(292,A6) ;000015c8: 08ee00070124 - STOP #$2000 ;000015ce: 4e722000 - BRA.S LAB_00F0 ;000015d2: 60e6 + LPSTOP #$2000 ;000015ce: f80001c02000 + BRA.S LAB_00F0 ;000015d4: 60e4 LAB_00F1: - MOVE.L D0,(A0) ;000015d4: 2080 - MOVEA.L D0,A1 ;000015d6: 2240 - MOVE.L A0,(4,A1) ;000015d8: 23480004 - MOVE.L A3,(276,A6) ;000015dc: 2d4b0114 - MOVE.W (288,A6),(290,A6) ;000015e0: 3d6e01200122 - BCLR #6,(292,A6) ;000015e6: 08ae00060124 - MOVE.B #$02,(15,A3) ;000015ec: 177c0002000f - MOVE.W (16,A3),(294,A6) ;000015f2: 3d6b00100126 - TST.B (294,A6) ;000015f8: 4a2e0126 - BMI.S LAB_00F2 ;000015fc: 6b08 - MOVE.W #$4000,INTENA ;000015fe: 33fc400000dff09a + MOVE.L D0,(A0) ;000015d6: 2080 + MOVEA.L D0,A1 ;000015d8: 2240 + MOVE.L A0,(4,A1) ;000015da: 23480004 + MOVE.L A3,(276,A6) ;000015de: 2d4b0114 + MOVE.W (288,A6),(290,A6) ;000015e2: 3d6e01200122 + BCLR #6,(292,A6) ;000015e8: 08ae00060124 + MOVE.B #$02,(15,A3) ;000015ee: 177c0002000f + MOVE.W (16,A3),(294,A6) ;000015f4: 3d6b00100126 + TST.B (294,A6) ;000015fa: 4a2e0126 + BMI.S LAB_00F2 ;000015fe: 6b08 + MOVE.W #$4000,INTENA ;00001600: 33fc400000dff09a LAB_00F2: - MOVE #$2000,SR ;00001606: 46fc2000 - ADDQ.L #1,(284,A6) ;0000160a: 52ae011c - MOVE.B (14,A3),D0 ;0000160e: 102b000e - AND.B #$a0,D0 ;00001612: c03c00a0 - BEQ.S LAB_00F3 ;00001616: 6702 - BSR.S LAB_00F6 ;00001618: 6118 + MOVE #$2000,SR ;00001608: 46fc2000 + ADDQ.L #1,(284,A6) ;0000160c: 52ae011c + MOVE.B (14,A3),D0 ;00001610: 102b000e + AND.B #$a0,D0 ;00001614: c03c00a0 + BEQ.S LAB_00F3 ;00001618: 6702 + BSR.S LAB_00F5 ;0000161a: 6116 LAB_00F3: - MOVEA.L (54,A3),A5 ;0000161a: 2a6b0036 - JMP (A4) ;0000161e: 4ed4 + MOVEA.L (54,A3),A5 ;0000161c: 2a6b0036 + JMP (A4) ;00001620: 4ed4 LAB_00F4: - RTS ;00001620: 4e75 -LAB_00F5: LEA (66,A5),A2 ;00001622: 45ed0042 MOVE.L A2,USP ;00001626: 4e62 MOVE.L (A5)+,-(A7) ;00001628: 2f1d MOVE.W (A5)+,-(A7) ;0000162a: 3f1d MOVEM.L (A5),D0-D7/A0-A6 ;0000162c: 4cd57fff RTE ;00001630: 4e73 -LAB_00F6: +LAB_00F5: BTST #7,D0 ;00001632: 08000007 - BEQ.S LAB_00F7 ;00001636: 670a + BEQ.S LAB_00F6 ;00001636: 670a MOVE.B D0,D2 ;00001638: 1400 MOVEA.L (70,A3),A5 ;0000163a: 2a6b0046 JSR (A5) ;0000163e: 4e95 MOVE.B D2,D0 ;00001640: 1002 -LAB_00F7: +LAB_00F6: BTST #5,D0 ;00001642: 08000005 - BEQ.S LAB_00F4 ;00001646: 67d8 + BEQ.S LAB_00FB ;00001646: 677c BCLR #5,(14,A3) ;00001648: 08ab0005000e MOVE.L (42,A3),D1 ;0000164e: 222b002a - BEQ.S LAB_00F4 ;00001652: 67cc + BEQ.S LAB_00FB ;00001652: 6770 MOVE.W #$4000,INTENA ;00001654: 33fc400000dff09a ADDQ.B #1,(294,A6) ;0000165c: 522e0126 MOVE.L (26,A3),D0 ;00001660: 202b001a @@ -2082,50 +2080,50 @@ EOR.L D0,(30,A3) ;00001668: b1ab001e EOR.L D0,(26,A3) ;0000166c: b1ab001a SUBQ.B #1,(294,A6) ;00001670: 532e0126 - BGE.S LAB_00F8 ;00001674: 6c08 + BGE.S LAB_00F7 ;00001674: 6c08 MOVE.W #$c000,INTENA ;00001676: 33fcc00000dff09a -LAB_00F8: +LAB_00F7: MOVEA.L (54,A3),A1 ;0000167e: 226b0036 MOVE.L (14,A3),-(A1) ;00001682: 232b000e TST.B (294,A6) ;00001686: 4a2e0126 - BNE.S LAB_00F9 ;0000168a: 660e + BNE.S LAB_00F8 ;0000168a: 660e SUBQ.B #1,(294,A6) ;0000168c: 532e0126 - BGE.S LAB_00F9 ;00001690: 6c08 + BGE.S LAB_00F8 ;00001690: 6c08 MOVE.W #$c000,INTENA ;00001692: 33fcc00000dff09a -LAB_00F9: - MOVE.L #LAB_00FB,-(A1) ;0000169a: 233c000016b8 +LAB_00F8: + MOVE.L #LAB_00FA,-(A1) ;0000169a: 233c000016b8 MOVE.L A1,USP ;000016a0: 4e61 BTST #0,(297,A6) ;000016a2: 082e00000129 - BEQ.S LAB_00FA ;000016a8: 6704 + BEQ.S LAB_00F9 ;000016a8: 6704 MOVE.W #$0020,-(A7) ;000016aa: 3f3c0020 -LAB_00FA: +LAB_00F9: MOVE.L D1,-(A7) ;000016ae: 2f01 CLR.W -(A7) ;000016b0: 4267 MOVEA.L (38,A3),A1 ;000016b2: 226b0026 RTE ;000016b6: 4e73 -LAB_00FB: +LAB_00FA: MOVEA.L ABSEXECBASE.W,A6 ;000016b8: 2c780004 - LEA (LAB_00FC,PC),A5 ;000016bc: 4bfa0006 + LEA (LAB_00FC,PC),A5 ;000016bc: 4bfa0008 JMP (-30,A6) ;000016c0: 4eeeffe2 +LAB_00FB: + RTS ;000016c4: 4e75 LAB_00FC: - MOVEA.L (560,A6),A4 ;000016c4: 286e0230 - BTST #0,(297,A6) ;000016c8: 082e00000129 - BEQ.S LAB_00FD ;000016ce: 6702 - ADDQ.L #2,A7 ;000016d0: 548f + MOVEA.L (560,A6),A4 ;000016c6: 286e0230 + BTST #0,(297,A6) ;000016ca: 082e00000129 + BEQ.S LAB_00FD ;000016d0: 6702 + ADDQ.L #2,A7 ;000016d2: 548f LAB_00FD: - ADDQ.L #6,A7 ;000016d2: 5c8f - MOVEA.L (276,A6),A3 ;000016d4: 266e0114 - OR.L D0,(30,A3) ;000016d8: 81ab001e - MOVE.L USP,A1 ;000016dc: 4e69 - MOVE.L (A1)+,(14,A3) ;000016de: 2759000e - MOVE.L A1,(54,A3) ;000016e2: 27490036 - MOVE.W (16,A3),(294,A6) ;000016e6: 3d6b00100126 - TST.B (294,A6) ;000016ec: 4a2e0126 - BMI.S LAB_00FE ;000016f0: 6b08 - MOVE.W #$4000,INTENA ;000016f2: 33fc400000dff09a + ADDQ.L #6,A7 ;000016d4: 5c8f + MOVEA.L (276,A6),A3 ;000016d6: 266e0114 + OR.L D0,(30,A3) ;000016da: 81ab001e + MOVE.L USP,A1 ;000016de: 4e69 + MOVE.L (A1)+,(14,A3) ;000016e0: 2759000e + MOVE.L A1,(54,A3) ;000016e4: 27490036 + MOVE.W (16,A3),(294,A6) ;000016e8: 3d6b00100126 + TST.B (294,A6) ;000016ee: 4a2e0126 + BMI.S LAB_00FB ;000016f2: 6bd0 + MOVE.W #$4000,INTENA ;000016f4: 33fc400000dff09a LAB_00FE: - RTS ;000016fa: 4e75 -LAB_00FF: MOVE #$2000,SR ;000016fc: 46fc2000 MOVE.L A5,-(A7) ;00001700: 2f0d MOVE.L USP,A5 ;00001702: 4e6d [....]
@Don_Adan, post #14
$ romtool diff kick.a1200.46.143 kick.a1200.46.143.NOP 000015c0: -- -- -- 10 -- -- -- -- . | -- -- -- 12 -- -- -- -- . 000015d0: -- -- 60 e6 20 80 22 40 `. ."@ | -- -- 4e 71 60 e4 20 80 Nq`. . 000015d8: 23 48 00 04 2d 4b 01 14 #H..-K.. | 22 40 23 48 00 04 2d 4b "@#H..-K 000015e0: 3d 6e 01 20 -- 22 08 ae =n. ".. | 01 14 3d 6e -- 20 01 22 ..=n ." 000015e8: 00 06 01 24 17 7c 00 02 ...$.|.. | 08 ae 00 06 01 24 17 7c .....$.| 000015f0: -- 0f 3d 6b 00 10 01 26 .=k...& | -- 02 00 0f 3d 6b 00 10 ...=k.. 000015f8: 4a 2e 01 26 6b 08 33 fc J..&k.3. | 01 26 4a 2e 01 26 6b 08 .&J..&k. 00001600: 40 00 00 df f0 9a 46 fc @.....F. | 33 fc 40 00 00 df f0 9a 3.@..... 00001608: 20 00 52 ae 01 1c 10 2b .R....+ | 46 fc 20 00 52 ae 01 1c F. .R... 00001610: 00 0e c0 3c 00 a0 67 02 ...<..g. | 10 2b 00 0e c0 3c 00 a0 .+...<.. 00001618: 61 18 2a 6b 00 36 4e d4 a.*k.6N. | 67 02 61 16 2a 6b 00 36 g.a.*k.6 00001620: -- 75 -- -- -- -- -- -- u | -- d4 -- -- -- -- -- -- . 00001640: -- -- -- -- -- -- -- d8 . | -- -- -- -- -- -- -- 7c | 00001650: -- -- -- cc -- -- -- -- . | -- -- -- 70 -- -- -- -- p 000016b8: -- -- -- -- -- -- -- 06 . | -- -- -- -- -- -- -- 08 . 000016c0: -- -- -- -- 28 6e 02 30 (n.0 | -- -- -- -- 4e 75 28 6e Nu(n 000016c8: 08 2e 00 00 01 29 67 02 .....)g. | 02 30 08 2e 00 00 01 29 .0.....) 000016d0: 54 8f 5c -- 26 6e 01 14 T.\ &n.. | 67 02 54 -- 5c 8f 26 6e g.T \.&n 000016d8: 81 ab 00 1e 4e 69 27 59 ....Ni'Y | 01 14 81 ab 00 1e 4e 69 ......Ni 000016e0: 00 0e 27 49 00 36 3d 6b ..'I.6=k | 27 59 00 0e 27 49 00 36 'Y..'I.6 000016e8: 00 10 01 26 4a 2e 01 26 ...&J..& | 3d 6b 00 10 01 26 4a 2e =k...&J. 000016f0: 6b 08 33 fc 40 00 00 df k.3.@... | 01 26 6b d0 33 fc 40 00 .&k.3.@. 000016f8: f0 9a 4e 75 -- -- -- -- ..Nu | 00 df f0 9a -- -- -- -- .... 0007ffe8: 39 dd 0d d3 -- -- -- -- 9... | f4 c6 52 dd -- -- -- -- ..R.
$ romtool diff kick.a1200.46.143 kick.a1200.46.143.LP 000015c0: -- -- -- 10 -- -- -- -- . | -- -- -- 12 -- -- -- -- . 000015c8: -- -- -- -- -- -- 4e 72 Nr | -- -- -- -- -- -- f8 00 .. 000015d0: 20 00 60 e6 20 80 22 40 .`. ."@ | 01 c0 20 00 60 e4 20 80 .. .`. . 000015d8: 23 48 00 04 2d 4b 01 14 #H..-K.. | 22 40 23 48 00 04 2d 4b "@#H..-K 000015e0: 3d 6e 01 20 -- 22 08 ae =n. ".. | 01 14 3d 6e -- 20 01 22 ..=n ." 000015e8: 00 06 01 24 17 7c 00 02 ...$.|.. | 08 ae 00 06 01 24 17 7c .....$.| 000015f0: -- 0f 3d 6b 00 10 01 26 .=k...& | -- 02 00 0f 3d 6b 00 10 ...=k.. 000015f8: 4a 2e 01 26 6b 08 33 fc J..&k.3. | 01 26 4a 2e 01 26 6b 08 .&J..&k. 00001600: 40 00 00 df f0 9a 46 fc @.....F. | 33 fc 40 00 00 df f0 9a 3.@..... 00001608: 20 00 52 ae 01 1c 10 2b .R....+ | 46 fc 20 00 52 ae 01 1c F. .R... 00001610: 00 0e c0 3c 00 a0 67 02 ...<..g. | 10 2b 00 0e c0 3c 00 a0 .+...<.. 00001618: 61 18 2a 6b 00 36 4e d4 a.*k.6N. | 67 02 61 16 2a 6b 00 36 g.a.*k.6 00001620: -- 75 -- -- -- -- -- -- u | -- d4 -- -- -- -- -- -- . 00001640: -- -- -- -- -- -- -- d8 . | -- -- -- -- -- -- -- 7c | 00001650: -- -- -- cc -- -- -- -- . | -- -- -- 70 -- -- -- -- p 000016b8: -- -- -- -- -- -- -- 06 . | -- -- -- -- -- -- -- 08 . 000016c0: -- -- -- -- 28 6e 02 30 (n.0 | -- -- -- -- 4e 75 28 6e Nu(n 000016c8: 08 2e 00 00 01 29 67 02 .....)g. | 02 30 08 2e 00 00 01 29 .0.....) 000016d0: 54 8f 5c -- 26 6e 01 14 T.\ &n.. | 67 02 54 -- 5c 8f 26 6e g.T \.&n 000016d8: 81 ab 00 1e 4e 69 27 59 ....Ni'Y | 01 14 81 ab 00 1e 4e 69 ......Ni 000016e0: 00 0e 27 49 00 36 3d 6b ..'I.6=k | 27 59 00 0e 27 49 00 36 'Y..'I.6 000016e8: 00 10 01 26 4a 2e 01 26 ...&J..& | 3d 6b 00 10 01 26 4a 2e =k...&J. 000016f0: 6b 08 33 fc 40 00 00 df k.3.@... | 01 26 6b d0 33 fc 40 00 .&k.3.@. 000016f8: f0 9a 4e 75 -- -- -- -- ..Nu | 00 df f0 9a -- -- -- -- .... 0007ffe8: 39 dd 0d d3 -- -- -- -- 9... | 13 05 d7 c1 -- -- -- -- ....
$ romtool diff kick.a1200.46.143.NOP kick.a1200.46.143.LP 000015c8: -- -- -- -- -- -- 4e 72 Nr | -- -- -- -- -- -- f8 00 .. 000015d0: 20 00 4e 71 -- -- -- -- .Nq | 01 c0 20 00 -- -- -- -- .. . 0007ffe8: f4 c6 52 dd -- -- -- -- ..R. | 13 05 d7 c1 -- -- -- -- ....
@Don_Adan, post #16
@sq7bti, post #17
@RomanWorkshop, post #20
@RomanWorkshop, post #23
@sq7bti, post #24