;;; -*- Mode:Lisp; Readtable:CL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 123.2
;;; Reason:
;;;  When odd length packet came from Share device, was using (truncate) rather
;;;  than (ceiling).  System 123 now coexists with older systems on backplane.
;;; Written 27-Aug-87 16:18:11 by pld (Peter L. DeWolf) at site LMI Cambridge
;;; while running on Azathoth from band 2
;;; with Experimental System 123.0, Experimental Local-File 73.0, Experimental FILE-Server 22.0, Experimental Unix-Interface 11.0, Experimental Tape 18.0, Experimental KERMIT 34.0, Experimental ZMail 71.0, Experimental Lambda-Diag 15.0, microcode 1754, SDU Boot Tape 3.12, SDU ROM 102.



; From modified file DJ: L.NETWORK.DRIVERS; SHARE.LISP#71 at 27-Aug-87 16:18:12
#10R SYSTEM-INTERNALS#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; DRIVERS; SHARE  "

(defun share-get-next-packet (&aux op int-pkt)
  (declare (values packet type source destination broadcast-p))
  (when (and (setq op (share-packet-ready))
	     (setq int-pkt (net:allocate-packet-for-receive share-interface)))
    (let* ((cs-rcv (op-chaos-rcv-ctl op))
	   (source (op-chaos-rcv-pkt op))
	   (type-and-length (%chaos-share-pkt-length cs-rcv))
	   (type (ldb (byte 16 16) type-and-length))
	   (length (ceiling (ldb (byte 16 0) type-and-length) 2)))
      (setf (fill-pointer int-pkt) length)
      (copy-array-portion source 0 length int-pkt 0 length)
      (setf (ldb %%chaos-share-dev-valid-bit (%chaos-share-csr cs-rcv)) 0)
      (share-chaos-interrupt op)
      ;; Rotate the *other-processors* list so that next time we look
      ;; for a packet, we will look at the other processor first.
      (without-interrupts
	(setq *other-processors* (net:nrotate *other-processors*)))
      (values int-pkt				; the packet
	      type				; the type code
	      op				; the sender
	      nil				; the receiver
	      nil				; not broadcast
	      ))))

))
