From 6767d33a60cf0237ccfa2049a10657741993b121 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Fri, 17 Aug 2018 21:07:22 +0100 Subject: [PATCH] WIP: Make dynamic memory allocation work. ... by turning off the right PI level. --- src/system/deuna.defs1 | 22 ++++++++++++++++----- src/system/ether.1 | 44 +++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/system/deuna.defs1 b/src/system/deuna.defs1 index cd4fc419..c60d7e71 100644 --- a/src/system/deuna.defs1 +++ b/src/system/deuna.defs1 @@ -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 diff --git a/src/system/ether.1 b/src/system/ether.1 index 9dcca77f..a1eff941 100644 --- a/src/system/ether.1 +++ b/src/system/ether.1 @@ -16,6 +16,10 @@ ;;; along with this program. If not, see . ;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