home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / lisp / mcl / 1308 < prev    next >
Encoding:
Text File  |  1992-08-25  |  4.6 KB  |  102 lines

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!bill@cambridge.apple.com
  2. From: bill@cambridge.apple.com (Bill St. Clair)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: Sys 7.0 compatability for v1.3.2
  5. Message-ID: <9208251850.AA24768@cambridge.apple.com>
  6. Date: 25 Aug 92 19:54:35 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 88
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Full-Name: Bill St. Clair
  11. Original-To: molinari%executioner@ee.pitt.edu (Bert Molinari)
  12. Original-Cc: wilcox@cmns.think.com, info-mcl
  13.  
  14. >Sorry if this is a FAQ, but is there any generalized means of making an
  15. >application created with mcl 1.3.2 compatable with sys7?  Unfortunately I
  16. >don't know what the exact problems are, but i've been told that after opening
  17. >the application, the intro-window appears (that contains the name of the 
  18. >app), and the machine goes into gc and just crashes.
  19.  
  20. Gary Byers sent out a patch quite a while ago that fixes one of the
  21. problems and explains why MCL 1.3.2 is generally not compatible with
  22. system 7. Others who have had problems have discovered that you need
  23. to wrap WITHOUT-INTERRUPTS around calls to CHOOSE-FILE-DIALOG and
  24. CHOOSE-NEW-FILE-DIALOG.
  25.  
  26. I know that Greg Wilcox <wilcox@cmns.think.com> played with running
  27. 1.3.2 under System 7 for a while. He may have a few more pointers.
  28.  
  29. Here's Gary's explanation and patch:
  30.  
  31. -------------------------------------------------------------------------
  32.  
  33.  
  34. 1.3.2 is generally -not- compatible with System 7:
  35.  
  36.   1) It won't work at all in 32-bit mode; it assumes a 24-bit memory manager.
  37.  
  38.   2) The entire Multifinder partition has to reside in the first 8MB of
  39.      memory.  With VM enabled, Multifinder may try to load the lisp into
  40.      higher addresses; one may have to launch other applications first and/or
  41.      adjust the lisp's suggested memory size in order to ensure that the lisp
  42.      loads into the low 8MB.
  43.  
  44.   3) Most seriously, the lisp's "growzone" function - the function which the
  45.      Mac Memory Manager calls when it can't otherwise satisfy a memory
  46.      allocation request - erroneously assumes that it doesn't need to
  47.      preserve the registers that it modifies.  (Prior to System 7.0, the
  48.      Memory Manager code that called an application's "growzone" function
  49.      saved and restored all registers around the call, but that doesn't seem
  50.      to have been its documented behavior.)
  51.  
  52.      The enclosed patch seems to fix this problem, which would seem to
  53.      be responsible for the "crashes sometimes during GC" behavior you 
  54.      reported.  The patch assumes version 1.3.2; I'm not sure whether
  55.      it would work in older versions, and it has nothing to do with 2.0.
  56.  
  57.   4) There are almost certainly other bugs; those that I'm aware of are more
  58.      cosmetic than fatal (e.g., drawing into the wrong grafport when windoids
  59.      are active.)
  60.  
  61. It's unfortunate that whatever claims of 1.3.2's 7.0 compatibility have been
  62. made were based on misinformation.
  63.  
  64.  
  65. -------------------------------------------------------------------------------
  66. (in-package :ccl)
  67. (eval-when (compile eval)
  68.   (require "TRAPS"))
  69.  
  70. (defun fix-sys7-growzone ()
  71.   (let* ((code '(#x202F #x4             ; move.l 4(sp),d0
  72.                  #x48E7 #x1F3E          ; movem.l d3-d7/a2-a6,-(sp)
  73.                  #x2F38 #x904           ; move.l currentA5,-(sp)
  74.                  #x42A7                 ; clr.l -(sp)
  75.                  #x2F00                 ; move.l d0,-(sp)
  76.                  #x2A7C #x123 #x4567    ; move.l #$01234567,a5 (fixed below)
  77.                  #x21CD #x904           ; move.l a5,currentA5
  78.                  #x4EAD #x1112          ; jsr lispgrowzone(a5)
  79.                  #x201F                 ; move.l (sp)+,d0
  80.                  #x21df #x904           ; move.l (sp)+,currentA5
  81.                  #x4CDF #x7CF8          ; movem.l (sp)+,d3-d7/a2-a6
  82.                  #x205F                 ; move.l (sp)+,a0
  83.                  #x584F                 ; addq #4,sp
  84.                  #x2E80                 ; move.l d0,(sp)
  85.                  #x4ED0))               ; jmp (a0)
  86.          (code-length (length code))
  87.          (ptr (_NewPtr :errchk :d0 (* 2 code-length) :a0))
  88.          (a5Now (%get-ptr (%int-to-ptr #x904))))
  89.     (dotimes (i code-length)
  90.       (%put-word ptr (pop code) (+ i i)))
  91. ; Fix the reference to A5
  92.     (%put-ptr ptr a5now 18)        ; replace #x01234567 with "real" A5
  93.     (_SetGrowZone :a0 ptr)))
  94.  
  95. ; Install the growzone patch, unless it's already there.  Make sure it's run 
  96. ; whenever a saved image is restored.
  97.  
  98. (unless (member 'fix-sys7-growzone *restore-lisp-functions* 
  99.                 :key #'ccl::function-name)
  100.   (push #'fix-sys7-growzone *restore-lisp-functions*)
  101.   (fix-sys7-growzone))
  102.