|
|
1.1 ! root 1: ; ! 2: ! 3: ; CPU tricks (we should probably have spl7(), spl() & reboot() in here) ! 4: ! 5: ; ! 6: ! 7: TEXT ! 8: ! 9: ; ! 10: ! 11: ; Cache tricks ! 12: ! 13: ; ! 14: ! 15: XDEF _cpush ! 16: ! 17: XREF _mcpu ; in main.c ! 18: ! 19: ; ! 20: ! 21: ; cpush(void *base, long length): ! 22: ! 23: ; flush both caches from base over a distance of length. If length is -1 ! 24: ! 25: ; then the entire cache is flushed ! 26: ! 27: ; ! 28: ! 29: _cpush: ! 30: ! 31: movem.l 4(a7),d0/a0 ; get parameters ! 32: ! 33: exg a0,d0 ; and in the right order ! 34: ! 35: move.l _mcpu,d1 ; start checking the CPU type ! 36: ! 37: cmp.l #20,d1 ! 38: ! 39: bcs.s noc ! 40: ! 41: cmp.l #40,d1 ! 42: ! 43: bne.s is030 ! 44: ! 45: ! 46: ! 47: addq.l #1,d0 ; if was -1 ! 48: ! 49: beq.s abc040 ; then flush everything ! 50: ! 51: add.l #14,d0 ; round up to line boundary ! 52: ! 53: lsr.l #4,d0 ; convert to number of lines ! 54: ! 55: cmp.l #256,d0 ! 56: ! 57: bcs.s fls040 ; not too many lines, so dump only some ! 58: ! 59: ! 60: ! 61: abc040: dc.w $F4F8 ; this is "cpusha bc" if your asm knows '040 ! 62: ! 63: bra.s noc ! 64: ! 65: ! 66: ! 67: ; run through d0+1 times (since a0 may not be on a line boundary) ! 68: ! 69: fls040: moveq #16,d1 ! 70: ! 71: do040: dc.w $F4E8 ; this is "cpushl bc,(a0)" for the '040 ! 72: ! 73: add.w d1,a0 ! 74: ! 75: dbf d0,do040 ! 76: ! 77: bra.s noc ! 78: ! 79: ! 80: ! 81: is030: ! 82: ! 83: movec cacr,d1 ! 84: ! 85: move.l d1,-(a7) ! 86: ! 87: addq.l #1,d0 ; if was -1 ! 88: ! 89: beq.s abc030 ; then flush everything ! 90: ! 91: addq.l #2,d0 ; round up to long boundary ! 92: ! 93: lsr.l #2,d0 ; convert to number of longs ! 94: ! 95: cmp.l #64,d0 ! 96: ! 97: bcs.s fls030 ; dump selectively ! 98: ! 99: ! 100: ! 101: abc030: or.w #$808,d1 ! 102: ! 103: movec d1,cacr ! 104: ! 105: bra.s rescacr ! 106: ! 107: ! 108: ! 109: fls030: or.w #$404,d1 ; clear DC/IC entries ! 110: ! 111: ; run through d0+1 times (since a0 may not be on a long boundary) ! 112: ! 113: do030: movec a0,caar ! 114: ! 115: movec d1,cacr ! 116: ! 117: addq.w #4,a0 ! 118: ! 119: dbf d0,do030 ! 120: ! 121: rescacr: ! 122: ! 123: move.l (a7)+,d0 ! 124: ! 125: movec d0,cacr ! 126: ! 127: noc: rts ! 128: ! 129: ! 130: ! 131: END ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.