1
0
mirror of https://github.com/PDP-10/its.git synced 2026-03-20 08:28:43 +00:00

WIP: Make dynamic memory allocation work.

... by turning off the right PI level.
This commit is contained in:
Adam Sampson
2018-08-17 21:07:22 +01:00
parent 0d4778b04c
commit 6767d33a60
2 changed files with 37 additions and 29 deletions

View File

@@ -42,7 +42,7 @@ $$TEMP==1
DEFSYM %UNVEC==120 ;Interrupt vector
DEFSYM %UNBAS==3,,774510 ;Base of Unibus register address space
DEFSYM %UNR0==%UNBAS ;PCSR0
DEFSYM %UNR0==%UNBAS ;PCSR0 - flags and command
.BEGIN %UN0 ;Bits in PCSR0
SERI==1_15. ;status error
PCEI==1_14. ;port command error
@@ -56,8 +56,9 @@ DEFSYM %UNR0==%UNBAS ;PCSR0
INTR==1_7. ;or of bits 15-8
INTE==1_6. ;interrupt enable
RSET==1_5. ;reset
CMD==<.BP 17,0> ;command field - see %UNCMD
.END %UN0
.BEGIN %UNCMD ;Command field in PCSR0
.BEGIN %UNCMD ;Port commands
NOP==0
GETPCB==1
GETCMD==2
@@ -69,11 +70,22 @@ DEFSYM %UNR0==%UNBAS ;PCSR0
STOP==17
.END %UNCMD
DEFSYM %UNR1==%UNBAS+2 ;PCSR1
DEFSYM %UNR1==%UNBAS+2 ;PCSR1 - status
.BEGIN %UN1
STER==1_15. ;error occurred
ERROR==<.BP 177_8.,0> ;error code, if STER
PCTO==1_7. ;Unibus timeout during port command
ID==<.BP 7_4.,0> ;0 for DEUNA, 1 for DELUA
STATE==<.BP 17,0> ;functional state
.END %UN1
DEFSYM %UNR2==%UNBAS+4 ;PCSR2
DEFSYM %UNR2==%UNBAS+4 ;PCSR2 - 16 low bits of PCB address
DEFSYM %UNR3==%UNBAS+6 ;PCSR3
DEFSYM %UNR3==%UNBAS+6 ;PCSR3 - 16 high bits of PCB address
.BEGIN %UNPCx ;Port Control Block
FUNC==<.BP %NE8,0> ;function - see %UNAF
.END %UNPCx
.BEGIN %UNAF ;Ancillary function codes in PCB
NOP==0

View File

@@ -16,6 +16,10 @@
;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;FIXME The big one - interrupts? Compare with CHAOS...
; search "PI for Tape" in its.* - TTYCHN
;PRM p4-3 - BR6/7 "high" vs BR4/5 "low" level - so that's what's being assigned above
; but which does the DEUNA get?
; and "CH-11 INTERRUPT ROUTINES" in chaos.* - copy at lower PI level
;FIXME Should we use input/output queues like IMP does?
;FIXME Use the style from TCP - this is a bit of a mix at the moment
;FIXME Use Johnny Eriksson's layout workaround for UBA half-write problem
@@ -409,34 +413,24 @@ UNADNI: CPOPJ ;Call this after a DNI interrupt
UNARCB: 0 ;Have we seen an RCBI interrupt?
;FIXME A flags word would make more sense (if we ever need a second flag!)
;FIXME For horrible hack below
BLOCK 2000-<.&1777> ;Align to a page boundary
UNPGHK: BLOCK 2000*%UNNPG
BBLK
;Initialise the DEUNA.
; Configure and start the DEUNA.
;
UNAINI: MOVEI D,%UNNPG-1
UNAIN1:
IFN 0,[
;FIXME This causes the core job to crash later...
PUSHJ P,TCALL ;Allocate a page of unshuffleable low core
JRST IOMQ
BUG HALT,[Couldn't allocate page for DEUNA]
CONI PI,Q ;Save PI status
ANDI Q,177
CONO PI,UTCOFF
PUSHJ P,IOMQ ;Allocate a page of unshuffleable low core
BUG HALT,[Couldn't allocate page for DEUNA]
CONO PI,PICON(Q) ;Restore PI status
MOVEI B,MUETH ;Tag what it's being used for
DPB B,[MUR,,MEMBLT(A)]
LSH A,10. ;Save the pointer
]
IFE 0,[
MOVEI A,2000 ;Use statically-allocated block above
IMUL A,D
ADDI A,UNPGHK
]
MOVEM A,UNPAGS(D)
MOVE B,A
@@ -460,21 +454,24 @@ IFE 0,[
SOJGE D,UNAIN1
;Initialisation sequence from DELUA user guide, page 3-8 (42).
;This needs us to wait for an interrupt in several places, so
;UNACMD has magic interrupt-continuation behaviour.
; Initialisation sequence from DELUA user guide, page 3-8 (42).
; This needs us to wait for an interrupt in several places, so
; UNACMD has magic interrupt-continuation behaviour.
;Enable interrupts.
; Enable interrupts. (This can't be combined with a command.)
MOVEI A,%UN0"INTE
IOWRI A,%UNR0
;Set the PCB address.
; Set the PCB address.
HLRZ A,UNPAGU ;Low bits
IOWRI A,%UNR2
LSH A,-16. ;High bits
IOWRI A,%UNR3
MOVEI A,%UN0"DNI+%UNCMD"GETPCB ;Ack DNI as it's on after reset
PUSHJ P,UNACMD ;We've really returned to the caller here
PUSHJ P,UNACMD
; From now on, we've been called back from UNABRK, so we're operating
; at TTYCHN level.
;FIXME put IP address in too, use in ARP above
;Get the MAC address for ARP to use
@@ -644,7 +641,6 @@ UNARX1: HRRZ A,W ;Wrap index around
HLLZS W
HLRZ J,UNRXRP(W) ;Descriptor
HRRZ I,UNRXRP(W) ;XXX unibus
MOVE Q,1(J) ;Is there a packet in this buffer? (OWN=0)
TLNE Q,%UNTD"OWN