Changeset 4f508e6 in buchla-68k for iolib/setipl.s
- Timestamp:
- 07/01/2017 02:34:46 PM (7 years ago)
- Branches:
- master
- Children:
- 08e1da1
- Parents:
- f40a309
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
iolib/setipl.s
rf40a309 r4f508e6 1 * 2 *setipl.s -- Set internal processor interrupt level3 *-------- --------------------------------------4 *Version 2 -- 1988-06-29 -- D.N. Lynx Crowe5 * 6 *short7 *setipl(arg);8 *short arg;9 * 10 *Sets processor interrupt level to arg.11 *Returns old interrupt level, or -1 if arg < 0 or > 712 * 13 *Assumes you are in supervisor mode.14 *You get a Privelege Violation TRAP if you aren't.15 * 1 2 | setipl.s -- Set internal processor interrupt level 3 | -------- -------------------------------------- 4 | Version 2 -- 1988-06-29 -- D.N. Lynx Crowe 5 6 | short 7 | setipl(arg); 8 | short arg; 9 10 | Sets processor interrupt level to arg. 11 | Returns old interrupt level, or -1 if arg < 0 or > 7 12 13 | Assumes you are in supervisor mode. 14 | You get a Privelege Violation TRAP if you aren't. 15 16 16 .text 17 * 17 18 18 .xdef _setipl 19 * 20 _setipl: link a6,#0 *Link up stack frames21 move.w 8(a6),d0 *Get argument22 tst.w d0 *Check lower limit23 bmi setipler *Jump if < 0 (error)24 * 25 cmpi.w #7,d0 *Check upper limit26 bgt setipler *Jump if > 7 (error)27 * 28 move.w sr,d1 *Get current level29 move.w d1,d2 *... save for later30 lsl.w #8,d0 *Shift argument into position31 andi.w # $F8FF,d1 *Mask out old level32 or.w d0,d1 *OR in new level33 move.w d2,d0 *Setup return of old level34 lsr.w #8,d0 *...35 andi.l # $7,d0 *...36 move.w d1,sr *Set the new interrupt level37 unlk a6 *Unlink stack frames38 rts *Return to caller39 * 40 setipler: moveq.l #-1,d0 *Setup to return error code41 unlk a6 *Unlink stack frames42 rts *Return to caller43 * 19 20 _setipl: link a6,#0 | Link up stack frames 21 move.w 8(a6),d0 | Get argument 22 tst.w d0 | Check lower limit 23 bmi setipler | Jump if < 0 (error) 24 25 cmpi.w #7,d0 | Check upper limit 26 bgt setipler | Jump if > 7 (error) 27 28 move.w sr,d1 | Get current level 29 move.w d1,d2 | ... save for later 30 lsl.w #8,d0 | Shift argument into position 31 andi.w #0xF8FF,d1 | Mask out old level 32 or.w d0,d1 | OR in new level 33 move.w d2,d0 | Setup return of old level 34 lsr.w #8,d0 | ... 35 andi.l #0x7,d0 | ... 36 move.w d1,sr | Set the new interrupt level 37 unlk a6 | Unlink stack frames 38 rts | Return to caller 39 40 setipler: moveq.l #-1,d0 | Setup to return error code 41 unlk a6 | Unlink stack frames 42 rts | Return to caller 43 44 44 .end
Note:
See TracChangeset
for help on using the changeset viewer.