Author Topic: Any one want to help build a community made OS 9.3?  (Read 150133 times)

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #20 on: September 08, 2015, 07:31:56 AM »
While researching/working on this I found some sort of interesting (although not surprising) bits.
So I've been digging through the open source ati drivers and the linux kernel generic video drivers and I got this idea.
Why start there when you can start right at the source, that being Apple.   The core of OS X is open source so I figured I'd look at darwin (well actually the xnu kernel source).  Yes I realize that OS X is not 9, but both are from Apple, so it's pretty safe to assume the driver code in xnu would be a good base. 
So here comes the interesting part. The power management drivers for the version of the xnu kernel that corresponds to OS X 10.3.9 have comments that the code is copied directly from OS 9.
So I am now digging through the xnu code for details of the hardware and drivers that need to be created.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline mrhappy

  • Platinum Member
  • *****
  • Posts: 1152
  • new to the forums
Re: Any one want to help build a community made OS 9.3?
« Reply #21 on: September 08, 2015, 07:41:21 AM »

So here comes the interesting part. The power management drivers for the version of the xnu kernel that corresponds to OS X 10.3.9 have comments that the code is copied directly from OS 9.


You guys are WAY over my head but this DOES seem interesting!!

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4439
  • just a number
Re: Any one want to help build a community made OS 9.3?
« Reply #22 on: September 11, 2015, 01:54:50 AM »
The core of OS X is open source so I figured I'd look at darwin (well actually the xnu kernel source).  Yes I realize that OS X is not 9, but both are from Apple, so it's pretty safe to assume the driver code in xnu would be a good base.

"both are from apple" seems to be quite unintersting, given that we are talking about completly different hardware components and a completly different OS.

can you explain why you would not just write OS9 drivers today the same way they were written 15 years ago?
insert arbitrary signature here

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #23 on: September 11, 2015, 06:22:22 AM »
I will write them the same way the did back in the day, but back in the day the apple engineers likely had full documentation on the chips as to what registers, instructions and memory locations they had.  I do not have access to this documentation so going to xnu as a source means that you can pull the registers, instructions and memory locations from that code to sort of rebuild that documentation to write the driver off of. 

If it ain't broke, don't fix it, or break it so you can fix it!

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4439
  • just a number
Re: Any one want to help build a community made OS 9.3?
« Reply #24 on: September 11, 2015, 04:03:04 PM »
i see. well if that is easier than finding the old documentations, then go on. :)
insert arbitrary signature here

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #25 on: September 11, 2015, 06:13:16 PM »
If you know a good source for the documentation of the various devices then I'm all ears.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4439
  • just a number
Re: Any one want to help build a community made OS 9.3?
« Reply #26 on: September 12, 2015, 05:13:22 AM »
i am more the guy for commercial software. :)

today it is already hard to impossible to find the old SDKs for controlpanels, quicktime, java or perl. not to mention stuff which requires info about 15 years old hardware.

insert arbitrary signature here

Offline Front 424

  • Enthusiast Member
  • ***
  • Posts: 87
  • not exactly new to the forums
Re: Any one want to help build a community made OS 9.3?
« Reply #27 on: November 11, 2015, 05:00:49 AM »
I'm very intrigued by this talk!  ;)
I wish I had some programming skills, but alas, none to be had.  I dabbled in the past but lost interest.  But if I did i would readily lend a hand in this endeavor!

This is my first post here months after joining, and glad to see a community keeping OS 9 alive.  Even better that at least one person is hoping to improve OS 9.

I figured I would bump this post for encouragement.  Any updates would be appreciated.

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #28 on: November 11, 2015, 08:29:06 AM »
I haven't really given an update as I don't have any thing to show at this point.  I don't expect this to be quick and easy by any means.
But I can give you an update on what I have found and know.

I have found through exhaustive searching old documentations on various parts of the mac internals (well as much as apple documented for developer use).

I found several references that stated that the Classic Support extension used for Classic mode in os x does some interesting things such as completely replace all memory management routines to map them to the memory manager of OS X.  This is probably the main reason why you can not access hardware directly from with in classic mode.

The earliest part of the boot process that open firmware hands off to is an elf executable.  OS 9 uses PEF executable format, but Open Firmware knows about ELF formats.  The elf file is actually responsible for loading, decompressing/decoding either an LZSS file embedded in the ROM (used on versions lower than 9.0) or parcels embedded in the rom file.  These parts are in the data fork of Mac OS ROM.
The ELF file is a valid ELF file but most decompilers/disassemblers do not recognize it as they expect a record size for sections.  The standard states that if no sections are defined then the record size can be zero.  This is the case in this ELF file so the decompilers out there think it's an invalid file.  The second problem with the disassemblers that are available is that they only speak the simplified PPC instruction set.  After extracing the program headers from the elf file and running it through several disassemblers as raw code I figured this out as the output had a lot of long jumps which are not part of the PPS ISA.
So I set forth and wrote a small utility program that loads the ROM into ram in a known place.  The reason for this is that after everything is loaded and booted, parts are moved around and removed from memory so you can't view the data in the ram locations these parts are where loaded in.  Once I loaded the ROM into ram the program analizes all the parts to find the entry point that open firmware essentially jumps to.  So once I have that address for my loaded ROM, I dropped into macsbug and used that disassembler and told it to start dissasembling from the entry address.  This produced much different output than other disassemblers and I was able to figure out that the PPC processor apple uses (at least starting with the g3's and forward) are using the ISA For PowerPC Book E  (Which is an enhanced instruction set).  The other thing that indicates that the ISA for the g3 and newer is Book E is that the instructoins 2-4 from the entry point are all Book E instructions.  If a cpu doesn't support Book E the unsupported instructions can be emulated in code, but you need to load a trap/interrupt, a function to handle it and then a look up table to decide what actual procedure to run.  These things would not be loaded with in the first 4 instructions.

The other thing I've figured out is the PVR (cpu_version) is checked early on in the elf file to even determine if it should move forward.
On New World machines the elf file is loaded and one of the first things it does is pull some data out of the device tree then issues the DO-QUIESCES which basicly suspends open firmware.

I haven't fully decifered everything in that elf boot loader code, but my suspicions at the moment lead me to believe that it does the following. 

Checks the CPU Version to ensure it is a version supported (updating this will get OS 9 booting on the G4's that require the cpu-version property  change in the open firmware device tree with out having to do the update)

Decodes the toolbox rom from either the LZSS file or the Parcels

Jumps to the kernel to finish booting.

It's at the point once the nano-kernel is started that you will see the Happy Mac.

I haven't figured out if the nano-kernel is part of the elf file or int the LZSS or Parcels.

And some very early notes on the possibility of booting on the G5.
The 64 Bit version of the Book E ISA is backwards compatible with the 32 bit version.  This is actually why all the OS X versions suppored on the G5 where 32 bit.  They could write it in 32 bit and it would run on the G4, G3 and G5 with no real issue.
So the cpu will not be a limiting factor on the G5.
The error seen booting on the G5
MacOS: cascade interrupt, but no cascading bridge
Is an issue early on with in the ELF file mentioned.  In both the G4 and G5's the cascading bridge is implemented in the north bridge.
The north bridge is completely different (as noted elsewhere in this thread) on these two systems. The drivers for the Uni North are in a resource in the Mac OS ROM file.  I haven't figured out though if there is some basic initialization code that runs prior to that driver (to enable full functionality) in the boot loader because I haven't figured out if it has access to the items in the resource fork by that time in the boot process.  I think it might so if a U3 driver can be written and dropped in that resource that would solve that problem. Of course this would still not allow the G5 to fully boot OS 9.  Other things that would have to be added to get the G5 working is support for AGP 8x and pci-e.  These are implemented also in the U3 controller.  The AGP 8x ports on the G5 are not backwards compatible at all according to Apple documentation.
I have not given up hope of booting on the G5, it will just take a lot more time than getting full support on unsupported G4's and doing a couple more memory enhancements as well.

On the subject of memory here's an interesting tidbit.
The Toolbox kernel and system resources (including the finder) are loaded into the lowest part of memory.
Applications are loaded into the top part of memory.
So when you have 2 GB of ram in OS9 and the finder takes 512 MB.  This is the first 512 MB (well starting from the kernel, toolbox)
This means that applications can run when their memory addresses are up in the top 2GB of ram.
So I am fairly confident that the memory management routines can be updated to get access to that part the finder is taking up.

That's it for my rambles.  Again nothing to show other than some understanding about early boot process.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline mrhappy

  • Platinum Member
  • *****
  • Posts: 1152
  • new to the forums
Re: Any one want to help build a community made OS 9.3?
« Reply #29 on: November 11, 2015, 09:04:26 AM »
Great detective work nanopico!! Some very interesting stuff there.

Don't know anything about the ELF file but I've seen the ELF movie numerous times!! ;D ;D ;D


Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #30 on: November 11, 2015, 09:09:47 AM »
Yes that is a great movie.
Elf is the default executable format for Linux, which is why I was fairly surprised to find that in the ROM file.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline mrhappy

  • Platinum Member
  • *****
  • Posts: 1152
  • new to the forums
Re: Any one want to help build a community made OS 9.3?
« Reply #31 on: November 11, 2015, 09:30:51 AM »
of coarse!!! ;D

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #32 on: November 11, 2015, 10:13:26 AM »
I forgot to mention I did create some templates for ResEdit that would allow a few resources types to be updated much more easily (such as the gtbl).  I can post them here if any one is interested.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline devils_advisor

  • Platinum Member
  • *****
  • Posts: 752
Re: Any one want to help build a community made OS 9.3?
« Reply #33 on: November 11, 2015, 10:20:42 AM »
Might need a one on one when it comes to programming.

Offline MacTron

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2116
  • keep it simple
Re: Any one want to help build a community made OS 9.3?
« Reply #34 on: November 11, 2015, 11:54:08 AM »
I found several references that stated that the Classic Support extension used for Classic mode in os x does some interesting things such as completely replace all memory management routines to map them to the memory manager of OS X.  This is probably the main reason why you can not access hardware directly from with in classic mode.

In Classic mode we can't access to hardware because there is no hardware to access.  ;D it's a virtual mac.

Quote
The other thing I've figured out is the PVR (cpu_version) is checked early on in the elf file to even determine if it should move forward.
On New World machines the elf file is loaded and one of the first things it does is pull some data out of the device tree then issues the DO-QUIESCES which basicly suspends open firmware.

I haven't fully decifered everything in that elf boot loader code, but my suspicions at the moment lead me to believe that it does the following. 

Checks the CPU Version to ensure it is a version supported (updating this will get OS 9 booting on the G4's that require the cpu-version property  change in the open firmware device tree with out having to do the update)

Decodes the toolbox rom from either the LZSS file or the Parcels

Jumps to the kernel to finish booting.

That's one of the main task of the Sonnet/Newertech OF scripts that enable Mac Os 9 to boot with a 7447 and a 7448 installed.

Quote
It's at the point once the nano-kernel is started that you will see the Happy Mac.

I haven't figured out if the nano-kernel is part of the elf file or int the LZSS or Parcels.

And some very early notes on the possibility of booting on the G5.
The 64 Bit version of the Book E ISA is backwards compatible with the 32 bit version.  This is actually why all the OS X versions suppored on the G5 where 32 bit.  They could write it in 32 bit and it would run on the G4, G3 and G5 with no real issue.
So the cpu will not be a limiting factor on the G5.
The error seen booting on the G5
MacOS: cascade interrupt, but no cascading bridge
Is an issue early on with in the ELF file mentioned.  In both the G4 and G5's the cascading bridge is implemented in the north bridge.
The north bridge is completely different (as noted elsewhere in this thread) on these two systems. The drivers for the Uni North are in a resource in the Mac OS ROM file.  I haven't figured out though if there is some basic initialization code that runs prior to that driver (to enable full functionality) in the boot loader because I haven't figured out if it has access to the items in the resource fork by that time in the boot process.  I think it might so if a U3 driver can be written and dropped in that resource that would solve that problem. Of course this would still not allow the G5 to fully boot OS 9.  Other things that would have to be added to get the G5 working is support for AGP 8x and pci-e.  These are implemented also in the U3 controller.  The AGP 8x ports on the G5 are not backwards compatible at all according to Apple documentation.
I have not given up hope of booting on the G5, it will just take a lot more time than getting full support on unsupported G4's and doing a couple more memory enhancements as well.

I have pointed out many times that lack of drivers for the U3 will be the first obstacle to boot a G5 with Mac Os 9.

Quote
On the subject of memory here's an interesting tidbit.
The Toolbox kernel and system resources (including the finder) are loaded into the lowest part of memory.
Applications are loaded into the top part of memory.
So when you have 2 GB of ram in OS9 and the finder takes 512 MB.  This is the first 512 MB (well starting from the kernel, toolbox)
This means that applications can run when their memory addresses are up in the top 2GB of ram.
So I am fairly confident that the memory management routines can be updated to get access to that part the finder is taking up.

That's it for my rambles.  Again nothing to show other than some understanding about early boot process.

Wow! this is really interesting. I have thought about this in several occasions but I never have found a so good idea !
The problem may be that this extra memory address may be used already (by ROM by example).
Another possibility is to use this memory as a RAM disk. This was already done with some old macs.


Please don't PM about things that are not private.

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #35 on: November 11, 2015, 02:35:06 PM »
Yes the Sonnet/Neweretech OF scripts over ride the cpu-version to boot the 7447 and 7448/  I'm hopping to update the code that checks that actually in the rom so that those scripts don't need to be run.

I'm not entirely sure what is using the lower 512 MB address space.  I can't really imagine it being ROM or Toolbox. It's entirely possible though.

Yes the lack of U3 drivers is the first obstacle for G5, and I'm 100% sure it's not the only one.  The key largo 2 will also be an issue.
the cascading interrupt bridge error is proof that that is the first issue to overcome.
If it ain't broke, don't fix it, or break it so you can fix it!

Online DieHard

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2367
Re: Any one want to help build a community made OS 9.3?
« Reply #36 on: November 11, 2015, 07:56:26 PM »
Quote
On the subject of memory here's an interesting tidbit.
The Toolbox kernel and system resources (including the finder) are loaded into the lowest part of memory.
Applications are loaded into the top part of memory.
So when you have 2 GB of ram in OS9 and the finder takes 512 MB.  This is the first 512 MB (well starting from the kernel, toolbox)
This means that applications can run when their memory addresses are up in the top 2GB of ram.
So I am fairly confident that the memory management routines can be updated to get access to that part the finder is taking up.

As Mactron mentioned, and I alluded to here:
http://macos9lives.com/smforum/index.php?topic=2101.msg10763#msg10763

There would be a tremendous advantage to utilize the first 512MB (or most of it) for a RAM drive when the unit has a 2 GB Memory configuration. So even if the memory management routines are not re-written, perhaps we can cheat and leave the current implementation alone and just re-write some RAM drive code; I am guessing they implemented the this standard somewhat arbitrarily since at the time of Classic Mac OS, they never dreamed that users would want, need, or even be able to afford more than a 1GB of RAM. So they probably picked a really high starting point (512MB) just in case they needed more room for juggling the low level assembly stuff later on... which again, does not make sense, since the finder does not eat up the first 512MB when the memory configuration is 1.5GB or less)... Is it possible that the RAM above 1.5GB is remapped to the first 512MB  and that 1.5GB is the real ceiling ?  If not, way does the lower memory only get effected when the physical memory is above 1.5 GB ?

At any rate, to Simplify, if we could steal, say 80% on the first 512 MB for a RAM drive (in a 2GB configuration), that would be mint !

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #37 on: November 11, 2015, 09:10:05 PM »
It sounds like there is desire to put focus in to memory usage and attempt to reclaim the memory the finder takes when 2 gb is installed, possibly given to a ram disk.
I accept this challenge and will put forth the efforts there.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Any one want to help build a community made OS 9.3?
« Reply #38 on: November 11, 2015, 09:12:19 PM »
Just a little side note.  I'd like to thank everyone for contributing to this.  The input has been very helpful in giving me some direction.  Also to those who have questioned some ideas or poked holes in my plans, thank you very much.  This feedback is very useful as it does make me think and rethink and examine things in ways I may not have seen.  Oh the joys of a community that can have an actual discussion.!!! :)
If it ain't broke, don't fix it, or break it so you can fix it!

Offline Protools5LEGuy

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2750
Re: Any one want to help build a community made OS 9.3?
« Reply #39 on: November 11, 2015, 11:16:00 PM »
It sounds like there is desire to put focus in to memory usage and attempt to reclaim the memory the finder takes when 2 gb is installed, possibly given to a ram disk.
I accept this challenge and will put forth the efforts there.

Thanks for taking your time weighting to develop 9.3.

True Multitasking in OS9 is noted?
 
Please don't forget to put light on developing drivers/extensions for any coreimage cards. I guess ALU PowerBooks/iBookG4/iMacG4 owners would like some support on their models too.

But most of us are PM G4 QS/MDD daw users. Take this page on JapaMac as a list. There are 15 candidates to test.  :o http://www.jcsenterprises.com/Japamacs_Page/Blog/4B4B7BA2-7ABB-47F1-87AC-B03D37942BEE.html I only have a GeForce 5200 128 Mg still not flashed for Mac. Since I digout OS9 experience would be bad with that I forget about it. If you are really interested I could flash it to make some tests but I can be a better tester in the MDD 2 Gigs area.

In fact I have a MDD 866 dual with 2 gigs of ram. For any test just PM. It has an ASUS Geforce2 with 64 Megs.

I also suggest nanopico to use the DieHard DAW http://macos9lives.com/smforum/index.php?topic=2716.0 as the "MacOS 9.2.2" to improve and to be the bed of all tests. It is sorted out clean enought to be a test field. And to be fair, it is 2015 and 8 gig footprint for an OS is "normal".  I have it on my 4 PM, from a G3 450 to the GHz Dual to the 800QS to the MDD.

Any light over the files missing on the wayback machine? You said you had something not covered yet. My sources are here http://macos9lives.com/smforum/index.php?topic=1931.0

Looking for MacOS 9.2.4