Mac OS 9 Lives

Classic Mac OS Software => Hacking the System, Mac OS 9.3, and Beyond ! => Topic started by: nanopico on August 29, 2015, 09:49:23 AM

Title: OS 9 with 2GB of Ram.
Post by: nanopico on August 29, 2015, 09:49:23 AM
So here is one that i find odd, maybe someone else can provide insight to this.
I inherited an G4 400 Gigabit.   The cpu was upgraded with a gigadesigns 800mhz g4 and an Nvidia Gforce MX4 from a dual 876MHZ G4.
So here is where the odd part comes in.  In every other Mac (g3 or g4) I own I can put 2 GB of ram in it and it is recognized in OS X, but OS 9 only sees 1.5 GB.  This I believe is fairly common knowledge and what I expected of this machine, but when I got OS 9 installed it sees and reports all 2GB of ram and appears to be using it.  Has any one else seen this before?
Title: Re: OS 9 with 2GB of Ram.
Post by: MacTron on August 29, 2015, 10:37:39 AM
... but when I got OS 9 installed it sees and reports all 2GB of ram and appears to be using it.  Has any one else seen this before?
Can you please attach a screenshot of "About this Computer" window from this machine?
Title: Re: OS 9 with 2GB of Ram.
Post by: nanopico on August 29, 2015, 12:13:45 PM
Here's the about this mac and the system profiler.
Interestingly mac os takes up 542 mb.
Title: Re: OS 9 with 2GB of Ram.
Post by: DieHard on August 29, 2015, 12:24:37 PM
You have totally normal behavior... you are still limited to 1.5/1.6 GB

This is taken from:
Mac OS 9.2.2 Maximum RAM and Real world observations

Quote
Finder shows Memory used per application and the System itself using 564.9 MB (What the F%$k), Also the largest unused Block (of available memory) is 1.42 GB.... wait a minute we add 512MB and we only get .01 GB more in available memory (from 1.41 to 1.42) and the OS itself is now bloated from 68.1MB to 564.9 MB (496.8 MB increase) ??!!

We can theorize that the ceiling is actually 1.5 GB (or maybe 1.6 GB since we now have 1.42 GB unused) and we can assume that it does not know what to do with the extra 512MB so it adds it to the Mac OS category as used by the system itself and it like a dead fish or more like a wasted layer of resources that we cannot get to :(

To read all the details...
http://macos9lives.com/smforum/index.php?topic=2101.msg10905#msg10905
Title: Re: OS 9 with 2GB of Ram.
Post by: nanopico on August 29, 2015, 12:31:33 PM
Good to know.  I've just not seen this behavior before with 2gb installed.
Title: Re: OS 9 with 2GB of Ram.
Post by: MacTron on August 29, 2015, 12:49:08 PM
Yes, it is as usual.
I always ask myself, what's doing the system with this 512Mb that "eat" by itself. ie: is it addressed as ROM? or mapped to other things ...
Maybe some day we'll find the way to make this 512Mb useful somehow...
Title: Re: OS 9 with 2GB of Ram.
Post by: darthnVader on April 29, 2018, 05:41:20 AM
The highest priority to OS 9 FOREVER, would be to fix the fact that OS 9 can't address virtual memory beyond to 2 GB limit.

We can put the virtual Memory on a SSD controller on a 64bit PCI card. That would give us a throughtput of 266Mb/s with some CPU overhead. It wouldn't be that hard to design a 64bit PCI SSD controller.


Even given OS 9's partition limit of 128Gb, that's a lot of virtual memory.

Likely this would have to be addressed in the NanoKernel.

CPU's are good enough, tho one day we may want to look at what NXP chips are pin compatible with 74xx, I don't think we'd ever get 64bit mode working in OS 9, unless there is a source code leak. :P

We could offload most things to the GPU if we had drivers, and that really comes down to porting a modern C compiler to OS 9.

But, one thing at a time, lets get virtual memory fixed. ;D
Title: Re: OS 9 with 2GB of Ram.
Post by: IIO on April 29, 2018, 06:40:32 AM
Even given OS 9's partition limit of 128Gb, that's a lot of virtual memory.

hm, i use some 30+ partitions with OS9 which are bigger than that.

from the standpoint of inside an audio guy´s filter bubble (pun intended) i wonder who would neeed so much virtual memory.

for video and audio work using virtual memory to "preload" streams is technically an option which is worse than a proper, intelligent disk streaming such as DAWs, after effects, quicktime, or sampler plug-ins are coming with.

i remember that i once tried to use it with photoshop and somehow it did not make the workflow faster than controlling the number of documents open at the same time manually.

what application will benefit from unlimited virtual memory?
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on April 29, 2018, 06:55:04 AM
Even given OS 9's partition limit of 128Gb, that's a lot of virtual memory.

hm, i use some 30+ partitions with OS9 which are bigger than that.

from the standpoint of inside an audio guy´s filter bubble (pun intended) i wonder who would neeed so much virtual memory.

for video and audio work using virtual memory to "preload" streams is technically an option which is worse than a proper, intelligent disk streaming such as DAWs, after effects, quicktime, or sampler plug-ins are coming with.

i remember that i once tried to use it with photoshop and somehow it did not make the workflow faster than controlling the number of documents open at the same time manually.

what application will benefit from unlimited virtual memory?
None. Mac OS 9 does not have the capabilities to do that on a pretty fundamental level. Even if you create a process in its own address space and fill it entirely with virtual memory (which, while not impossible, is very very hard and would require a ton of code changes all over the place), you only get 4GB to play with. That is a limit of the processor itself. You could work out some sort of API to do this (where you call a function to access an enourmous pretend memory space), but you would probably be better off just having the API just use normal file access routines.

I suppose that if we ever got protected memory working, we could give each individual process 4GB of memory. We would still not be able to give a process more than 4GB.
Title: Re: OS 9 with 2GB of Ram.
Post by: IIO on April 29, 2018, 07:01:51 AM

None. Mac OS 9 does not have the capabilities to do that on a pretty fundamental level. Even if you create a process in its own address space and fill it entirely with virtual memory (which, while not impossible, is very very hard and would require a ton of code changes all over the place), you only get 4GB to play with.

okay, but they still have the valid argument on their side that 1,5 + 4,0 is still a bit more than only 1,5. :)

so besidee the fact that it probably will never work, i still wonder what applications can make good use of VM.

(yeah, i know, you can open two 300 mb files on a machine with only 512 physical memory, but else?)
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on April 29, 2018, 07:06:41 AM

None. Mac OS 9 does not have the capabilities to do that on a pretty fundamental level. Even if you create a process in its own address space and fill it entirely with virtual memory (which, while not impossible, is very very hard and would require a ton of code changes all over the place), you only get 4GB to play with.

okay, but they still have the valid argument on their side that 1,5 + 4,0 is still a bit more than only 1,5. :)

so besidee the fact that it probably will never work, i still wonder what applications can make good use of VM.

(yeah, i know, you can open two 300 mb files on a machine with only 512 physical memory, but else?)
Probably just apps that have inefficient memory usage. VM makes it not matter that much. VM essentially is just a tool to make things much easier for the programmers. For pretty much every program that can use VM, you could get a better result if you optimized it so it doesn't need to. VM just happens to be ok at most things and be easy to do.
Title: Re: OS 9 with 2GB of Ram.
Post by: IIO on April 29, 2018, 07:21:22 AM
like i guessed. but if we needed to, how would you toggle VM to be active on a G4 with max RAM installed? the controlpanel does not allow it :)
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on April 29, 2018, 07:29:36 AM
Way back in the 68k days, it was documented that VM only supports up to 1GB of memory. I guess they never changed it. The system doesn't let you turn on VM if ram is that big.
Title: Re: OS 9 with 2GB of Ram.
Post by: MacTron on April 29, 2018, 08:11:29 AM
Even given OS 9's partition limit of 128Gb, that's a lot of virtual memory.

hm, i use some 30+ partitions with OS9 which are bigger than that.


The 128Gb limit (actually 190Gb) is only for the startup partition.
Title: Re: OS 9 with 2GB of Ram.
Post by: ELN on April 29, 2018, 08:27:34 AM
I reckon that the 9.2.2 legacy VM Manager owes a lot to 68k implementation in System 7, just with shims added to get page fault notifications from the NanoKernel. After all, it really hammers the FE0A trap!

VMInit always instructs the NK to resize the Area underlying the Primary Address Range to just shy of 1 GB. Then MemTop gets pointed to whatever you set in the Memory control panel. Below it, you have a file-mapped Primary Address Range containing all the usual Mac stuff, not least the Process Manager heap containing application partitions. Above it are more memory-mapped files, mostly Code Fragments (I think 9.1 introduced an API to map your own files).
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on April 29, 2018, 09:43:51 AM
The 'vm  ' 42 resource I am looking at uses FE06 a whole lot, but there is no use of FE0A. Any clue what FE06 means?
Title: Re: OS 9 with 2GB of Ram.
Post by: darthnVader on April 29, 2018, 03:56:31 PM
280    Safari   jam   21.0   22   494.08 MB   1.35 GB   PowerPC   
Title: Re: OS 9 with 2GB of Ram.
Post by: ELN on April 29, 2018, 06:33:15 PM
My mistake! I just looked into it, and FE06 maps to PowerPC trap 3, just like FE0A does. Odd, that!

Daniel, remind me what your thoughts are about the "alternate" VMDispatch table? I'm seeing these VMMaxVirtualPages == 0 conditionals everywhere I look. Are they there to support some never-released rewrite of the VM Manager?
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on April 29, 2018, 06:52:18 PM
I think so.

A lot of the VMCalls use major_0x08d88 instead of GetPARPageInfo when VMMaxVirtualPages is 0.

I know that MPCall_95 will set VMMaxVirtualPages to 0 when it is called with r3 and r4 both 0. It logs "Areas capability probe detected" as it does so. Maybe they were partly done with this stuff, and wanted a mechanism to test how close they were?

I do remember building a NK with that value hardcoded to 0. Things crash and burn very early in the boot process. I am not sure if the NK is ready for this stuff, but userspace certainly isn't.

Now that I know what FE06 does, I can reverse the VM code more. We might want to try writing a new VM version eventually.
Title: Re: OS 9 with 2GB of Ram.
Post by: ELN on April 30, 2018, 04:08:06 AM
In my latest commit to powermac-rom (cleverly titled "Lots of work on Address Spaces") I gave names to all the MPCalls in NKAddressSpaces.s (which I renamed, by the way). MPCall 95 is now "MPFindVictimPage".
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on May 01, 2018, 05:16:00 PM
The 'vm  ' 42 makes use of FE0D and FE0B in one function, and I have no clue what those ones do

It also uses FE05 in another function, which is _MoveToECR. It writes to emulator control registers 6, 7, 8, and 14, in that order.
Title: Re: OS 9 with 2GB of Ram.
Post by: ELN on May 01, 2018, 07:15:19 PM
Neither FE0D nor FE0B result in a PowerPC trap, at least when run from the first few bytes of ROM. Maybe they also set Emulator state?

What do they seem to be taking arguments?
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on May 01, 2018, 07:25:24 PM
They take a page number in A0, and 0xFFF in D0. The same page# is put in both. This function's pointer is placed at offset 0x24 of VMVectors (global variable at address 0xCF0), but only if the cpu is better than a 601 (the 601 version of this routine is just a RTS). I have no what calls this function or what its argument is.
Title: Re: OS 9 with 2GB of Ram.
Post by: ELN on May 02, 2018, 12:36:29 AM
Possibly some simple function that the Emulator accelerates using clever post-601 PPC instructions? Zero a page using DCBZs?
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on May 02, 2018, 03:04:13 PM
Not sure.

I have mostly finished looking through the 'vm  ' 42 resource. It looks like it is essentially a wrapper for NK VMCalls. It puts a lot of function pointers in VMVectors, and it initializes its globals, but I am not sure it does a lot of stuff itself. I don't even think that it takes over the bus error trap. It definitely doesn't read and write pages to disk. Somewhere in the vast assortment of Mac OS 9 code there is something which actually uses this API to provide VM services. My best guess for its location would be the Process Manager, Mixed Mode Manager, or the Memory control panel.

MPLibrary has a lot of functions related to the Area VM system. It might do MPTask VM itself, or it might offload it to something else. The 'ager' MPTask might be interesting to look at, because it apparently does page aging stuff.
Title: Re: OS 9 with 2GB of Ram.
Post by: MacTron on May 03, 2018, 08:13:38 AM
We can put the virtual Memory on a SSD controller on a 64bit PCI card. That would give us a throughtput of 266Mb/s with some CPU overhead. It wouldn't be that hard to design a 64bit PCI SSD controller.
I have done this before: connecting two SSD's to a Seritek 1eVE2+2, ( a full length 64 bits SATA PCI card) in RAID mode. The maximum throughput was 190 Mb/s IIRC, I'll will seach for the post where I wrote the data.
Title: Re: OS 9 with 2GB of Ram.
Post by: IIO on May 03, 2018, 01:37:40 PM
isnt that what you would get with only one SSD, too? ;)
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on May 03, 2018, 05:25:42 PM
By setting breakpoints in MPLibrary APIs, I believe that the 'ager' task is inside MPLibrary itself. This means that MPLibrary contains code which actively manipulates Area VM stuff.
Title: Re: OS 9 with 2GB of Ram.
Post by: Daniel on May 06, 2018, 06:52:49 PM
I just realized I completely missed the 'ptch' 420 resource.  :(
It sets up the 'vm  ' 42 resource and uses its vectors a lot.

I guess I should start reversing that...
Title: Re: OS 9 with 2GB of Ram.
Post by: ELN on May 06, 2018, 06:56:51 PM
#blazeit
Title: Re: OS 9 with 2GB of Ram.
Post by: darthnVader on June 03, 2018, 03:35:39 AM
(http://farm2.staticflickr.com/1740/41810097944_a2af226cf7_b.jpg)
Title: Re: OS 9 with 2GB of Ram.
Post by: ELN on June 03, 2018, 06:12:44 AM
:o

Please explain.
Title: Re: OS 9 with 2GB of Ram.
Post by: Protools5LEGuy on June 03, 2018, 09:02:20 AM
I think it should be explained by someone who understands.
https://forums.macrumors.com/threads/whats-wrong-with-this-picture.2120551/#post-26111977
Title: Re: OS 9 with 2GB of Ram.
Post by: Protools5LEGuy on June 03, 2018, 09:16:24 AM
I am sorry Darthnvader, bit I couldnt let Elliot with the question.
Title: Re: OS 9 with 2GB of Ram.
Post by: darthnVader on June 03, 2018, 05:17:19 PM
:o

Please explain.

Yes, it's Qemu-system-ppc, seems they did a little trickery with Book-E and some older commits from a few months ago can boot OS X with very near 4GB of Ram. For OS 9 the Mac OS ROM fails to load, but I'm sure that could be addressed if we can get around the 1.5GB limit for the OS itself.
Title: Re: OS 9 with 2GB of Ram.
Post by: macStuff on June 04, 2018, 07:26:38 AM
i never put more than 1gb of ram into an os9 machine
no need for anymore ram than 1gb
the os simply does not use it effectively in my opinion

so theres absolutely no point in trying to get more
MY opinion
Title: Re: OS 9 with 2GB of Ram.
Post by: darthnVader on June 04, 2018, 02:05:22 PM
i never put more than 1gb of ram into an os9 machine
no need for anymore ram than 1gb
the os simply does not use it effectively in my opinion

so theres absolutely no point in trying to get more
MY opinion

We do it because it's there, and, hello pirate:-)
Title: Re: OS 9 with 2GB of Ram.
Post by: ancient on October 09, 2018, 08:27:11 PM
Even given OS 9's partition limit of 128Gb, that's a lot of virtual memory.

hm, i use some 30+ partitions with OS9 which are bigger than that.


The 128Gb limit (actually 190Gb) is only for the startup partition.
Very useful to know , the limitations are not that bad then so with a seritek Sata card I can have 2tb secondary non booting drive single partition? does formatting larger drives in OS9 become an issue software wise to format them?
Title: Re: OS 9 with 2GB of Ram.
Post by: IIO on October 11, 2018, 08:43:51 AM

Quote
Very useful to know , the limitations are not that bad then so with a seritek Sata card I can have 2tb secondary non booting drive single partition? does formatting larger drives in OS9 become an issue software wise to format them?

you can with some controllers, but it is better to make 4x500 IMO.

i use x500 partitions inside (PCI) and 1.5 tera single partitions via firewire - and only for data which do not need to be maintained by norton disk destroyer or data recovery programs (or at least not under OS9 and 10.4 PPC).
Title: Re: OS 9 with 2GB of Ram.
Post by: darthnVader on January 04, 2019, 02:38:42 PM
Got around to running memtest on Qemu, segmentation fault if you exceed 2 GB.
Title: Re: OS 9 with 2GB of Ram.
Post by: IIO on June 24, 2020, 05:12:17 PM
i am in a sorting process releated to my living room internet, and there is a file in a 2018 folder called "memtest_4.2.2"

a google search ended up here. :)

who made that, what is it, and what is the dmg´s password?
Title: Re: OS 9 with 2GB of Ram.
Post by: IIO on June 24, 2020, 05:25:18 PM
oh, never mind. the password is in the filename.