[net.micro.mac] Finding the Blessed System Folder

ephraim@wang.UUCP (pri=8 Ephraim Vishniac x76659 ms1459) (03/04/86)

In a previous posting, I mentioned that PTCH 105 in the new System
file contains some useful tips on various HFS topics.  One thing it
reveals is how to find the system folder of an HFS disk.  Since 
gcc-sun!brad asked, and I imagine other people might wonder, the answer
is:

	Do a _HGetVInfo on the HFS volume in question.  The first
	two long words in the ioVFndrInfo field are directory IDs.
	The first one is the ID of the directory containing the System
	file (and likely the other system stuff as well).  PTCH
	105 sets this one as BootDrive and also does a _SetVol with
	it before transferring control to the HFS disk.  If the second
	long word is non-zero, PTCH 105 just does a _SetVol to that
	directory.  My guess would be that that's the Finder's (startup
	application's) directory, but I haven't checked on that.

Another thing clarified by PTCH 105 is the PTCH/INIT-time environment.
The boot blocks from the real boot disk are in memory at $10000 and up.
The temporary stack grows down from the same location (or close, anyway).
This means that the space available for the stack above the system heap
is *very small*.  The stack sniffer isn't running yet, so boot-time
stack/heap collisions can have bizarre results.

For example, _MountVol consumes stack space proportional to the directory
size on flat (MFS) volumes.  To successfully mount a large flat volume
from an INIT, I had to save SP, substitute BUFPTR, mount the volume, then
restore the stack pointer.

Ephraim Vishniac
decvax!wanginst!wang!ephraim