-
+ E55DA0353DA36AFDBE061D4AE3AAAF02C58D2CA7189786C7D13684AAF4BF39D428EE4787C6B858F467513B35F14272FAC53AF48CB5864AF19A03DEF98A0D4622m/irq.asm(0 . 0)(1 . 70)
1451 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1452 ;; ;;
1453 ;; This file is part of 'M', a MIPS system emulator. ;;
1454 ;; ;;
1455 ;; (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) ;;
1456 ;; http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html ;;
1457 ;; ;;
1458 ;; You do not have, nor can you ever acquire the right to use, copy or ;;
1459 ;; distribute this software ; Should you use this software for any purpose, ;;
1460 ;; or copy and distribute it to anyone or in any manner, you are breaking ;;
1461 ;; the laws of whatever soi-disant jurisdiction, and you promise to ;;
1462 ;; continue doing so for the indefinite future. In any case, please ;;
1463 ;; always : read and understand any software ; verify any PGP signatures ;;
1464 ;; that you use - for any purpose. ;;
1465 ;; ;;
1466 ;; See also http://trilema.com/2015/a-new-software-licensing-paradigm . ;;
1467 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1468
1469 ;-----------------------------------------------------------------------------
1470 ;; State
1471 ;-----------------------------------------------------------------------------
1472 section .bss
1473 SlaveIRQ resd 1 ; External Interrupt from Slaves
1474 ;-----------------------------------------------------------------------------
1475
1476 section .text
1477
1478 ;-----------------------------------------------------------------------------
1479 ; SetIRQ : Trigger External Interrupt ( Parameter: constant IRQ # )
1480 ;-----------------------------------------------------------------------------
1481 %macro SetIRQ 1 ; param is the IRQ #
1482 bts CP0_Cause, (CP0Cau_IRQ_Bottom + %1)
1483 %endmacro
1484 ;-----------------------------------------------------------------------------
1485
1486 ;-----------------------------------------------------------------------------
1487 ; ClrIRQ : Clear External Interrupt ( Parameter: constant IRQ # )
1488 ;-----------------------------------------------------------------------------
1489 %macro ClrIRQ 1 ; param is the IRQ #
1490 btr CP0_Cause, (CP0Cau_IRQ_Bottom + %1)
1491 %endmacro
1492 ;-----------------------------------------------------------------------------
1493
1494 ;-----------------------------------------------------------------------------
1495 ; Built-In Iron IRQs:
1496 ;-----------------------------------------------------------------------------
1497 %define TIMER_IRQ 7 ; MIPS Timer (trigger when CP0_Count==CP0_Compare)
1498 ;-----------------------------------------------------------------------------
1499
1500 ;-----------------------------------------------------------------------------
1501 ; IRQ from Slave:
1502 ;; TODO: locking and wait/sleep
1503 ;-----------------------------------------------------------------------------
1504 %macro SetSlaveIRQ 1
1505 bts dword [SlaveIRQ], (CP0Cau_IRQ_Bottom + %1)
1506 %endmacro
1507 ;-----------------------------------------------------------------------------
1508
1509 ;-----------------------------------------------------------------------------
1510 ; Poll for any Slave IRQ:
1511 ;-----------------------------------------------------------------------------
1512 %macro GetSlaveIRQ 0
1513 mov eax, [SlaveIRQ] ; Get the Slave IRQ shadow register
1514 test eax, eax ; Is it zero?
1515 jz %%skip ; If was zero, skip;
1516 mov dword [SlaveIRQ], 0 ; Else, 1) Zero shadow register
1517 or CP0_Cause, eax ; 2) OR it into CP0_Cause.
1518 %%skip:
1519 %endmacro
1520 ;-----------------------------------------------------------------------------