Amiga.org

Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: SpeedGeek on March 22, 2019, 01:35:28 AM

Title: 68060.library update
Post by: SpeedGeek on March 22, 2019, 01:35:28 AM
68060.library update

LICENSE:
Copyright by Carsten Schlote 1990-2016
This release and any subsequent adapted (or non-adapted)
release is subject to all terms and conditions of the original
CC-BY-NC-BA 4.0 license release in 2016. See
http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode

INTRODUCTION:
This 40.35 version of 68060.library is an update of the last
40.343 version by Carsten Schlote. This is a really good
"Generic" 68060.library with a few useful updates.

Updates (by SpeedGeek):
- Disables the Store Load/Bypass for CPU Rev. 0,1 and 5
- Some Global mappings changed to Non-Global
- Enables $E00000 Extended ROM as Cache Writethrough
- Allocates only Fast RAM for moving the VBR
- Library init code now safely exits in a 68040 system

NOTES: It works very well with TurboMMU040+ and
FastCache040+! Please understand a "Generic" library does
NOT offer support for all the features of proprietary 3rd
party accelerator cards.

REQUIREMENTS:
- Amiga with 68060 CPU and FPU

DISCLAIMER (For updates):
Use at your own risk. No warranty expressed or implied, etc.

USAGE:
- Copy to LIBS:
- OS3.1 Setpatch loads the "Dummy" 68040.library first
- OS3.9 Setpatch directly loads the 68060.library

CREDITS: Thanks very much to Carsten Schlote (Danke Schon!)

HISTORY:
v40.35 - Update release of 40.343

Here is the link:

http://eab.abime.net/showthread.php?p=1312476
 
Title: Re: 68060.library update
Post by: giZmo350 on March 22, 2019, 02:56:59 AM
If all I have to do is copy to Libs, I'll give a try! Thanks!   :)
Title: Re: 68060.library update
Post by: 10MARC on April 02, 2019, 04:39:00 PM
I have been using this for a few weeks on my 80 MHz '060 and AmigaOS 3.1.4, and I can say it seems to run more stable. I would guess about half as many system crashes, but I do push my system really hard.
Title: Re: 68060.library update
Post by: SpeedGeek on April 11, 2019, 02:45:37 PM
** NEWS UPDATE **

Changed requirements to 68060 CPU and FPU due to Mathesar's reported problem with LC060 compatibility.
Title: Re: 68060.library update
Post by: Antonis on October 07, 2019, 01:02:16 PM
Sorry for posting in this thread (not sure if there's another more appropriate or should I start a new one instead), but I'm a bit confused at the moment. As I understand by reading in these forums, not all 68060 library builds are equally compatible with all cards, so I thought of asking for your experiences: I'm about to receive from eBay a Blizzard Phase 5 68060 / 75Hz / 64MB (non-PPC) for my A1200 (which now has a 68030 card) and I should prepare my CF card accordingly. So, in order to avoid any screw ups:

Should I be looking to a specific 68060 lib build for this card ?
Do I only have to copy the lib file in LIBS: dir and reboot ? Is that the only installation step in order to take advantage of the card ?
Does Workbench version make any difference ? (the CF has OS 3.9 at the moment)

Thank you in advance.
Best regards,
/A
Title: Re: 68060.library update
Post by: utri007 on October 07, 2019, 01:59:52 PM
Setpatch command loads support libraries, it should be new enough!! OS3.5 or 3.9 or 3.1.4 versions are OK.

Phase 5 libraries

http://phase5.a1k.org/

Thors MUlibraries

http://aminet.net/package/util/libs/MMULib
Title: Re: 68060.library update
Post by: Rotzloeffel on October 07, 2019, 02:02:11 PM
Should I be looking to a specific 68060 lib build for this card ?
Do I only have to copy the lib file in LIBS: dir and reboot ? Is that the only installation step in order to take advantage of the card ?
Does Workbench version make any difference ? (the CF has OS 3.9 at the moment)


You can install the MuTools from Aminet http://aminet.net/package/util/libs/MMULib this is all you Need and up to date...

or the original Libs from Phase 5 http://phase5.a1k.org/ If you have OS 3.9 with BoingBag2 installed, the 68040 dummy library is not necessary anymore...

you should use MMULib...... copying the 68060.library to libs is enough for booting

EDIT Ups... Utri007 was faster :)
Title: Re: 68060.library update
Post by: Antonis on October 07, 2019, 02:18:59 PM
The Amiga community, you got to love it. Thank you all for the lightning fast replies.

MMULib it is, then. Time to revisit good ol' WinUAE and update the CF card according to your instructions.  :)

Cheers.

/A
Title: Re: 68060.library update
Post by: SpeedGeek on February 20, 2020, 11:17:07 PM
** 2ND NEWS UPDATE **
v40.36 released!

Many improvements:
- Fixed occasional crash bug in FPU dispatcher (Thanks to
Ralph Schmidt for the minor update)
- Added optimized Mult64u/s ISP patch to utility.library
functions (Much faster than exception trap code)
- Removed library versions of FPSP and ISP (Kernal versions
provide the emulation code)
- Removed lots of useless code (Debug and NOP stuff)
- Merged two library hunks into one
- Replaced Disable/Enable pairs with Forbid/Permit pairs
Title: Re: 68060.library update
Post by: SpeedGeek on February 21, 2020, 07:13:57 PM
** 3RD NEWS UPDATE **

v40.37 - released!

Monor update:
- Added code to skip Library init on EC/LC060 detection
- Added code to enable branch prediction error handler
Title: Re: 68060.library update
Post by: 10MARC on February 23, 2020, 06:09:03 PM
Just installed it on my 68060/80 Mhz A4000 - seems fairly stable so far. Thanks for all your har work keeping this updated!
Title: Re: 68060.library update
Post by: kolla on February 23, 2020, 06:17:25 PM
Just installed it on my 68060/80 Mhz A4000
I thought your choice was MuLibs? Thomas doesn’t approve this 68060.library, you know ... :)
Title: Re: 68060.library update
Post by: 10MARC on February 24, 2020, 07:10:54 PM
I have used a few, Kolla. I was not aware that Thomas dislikes this one. I don't seem to have any additional issues with this version.
Title: Re: 68060.library update
Post by: guest11527 on February 25, 2020, 05:57:56 AM
I have used a few, Kolla. I was not aware that Thomas dislikes this one. I don't seem to have any additional issues with this version.
A common problem is that its CachePre/PostDMA() functions do not work properly - they need to translate logical to physical addresses and not just pass them through. Another typical problem is the exeception generation of floating point exceptions in case its target address is not mapped. In such a case, the 68060.library needs to generate an access error of the right address - namely the address of the EA in the code being emulated. The original mot sources have call-outs ("hooks") to get this work done, but most - if not all (but one) - 68060 "optimizations" simply drop these call-outs and then generate an exception that is coming from the wrong code path, namely within the 68060.library, and not within the user code.

Thus, while I haven't tested, I afraid that we have here a library that falls into the same pitfalls the P5 libs fell into, namely not handling exceptions properly. It is a case that does not typically happen, but in case we would have virtual memory, would fail miserably. The Mu-based libs have been carefully crafted to handle such cases correctly, thus do not generate exceptions by executing code itself, but creating artificial exceptions that (seem to) come from the user code, such that the Os layer can handle them correctly.
Title: Re: 68060.library update
Post by: SpeedGeek on February 25, 2020, 01:47:53 PM
A common problem is that its CachePre/PostDMA() functions do not work properly - they need to translate logical to physical addresses and not just pass them through. Another typical problem is the exeception generation of floating point exceptions in case its target address is not mapped. In such a case, the 68060.library needs to generate an access error of the right address - namely the address of the EA in the code being emulated. The original mot sources have call-outs ("hooks") to get this work done, but most - if not all (but one) - 68060 "optimizations" simply drop these call-outs and then generate an exception that is coming from the wrong code path, namely within the 68060.library, and not within the user code.

Thus, while I haven't tested, I afraid that we have here a library that falls into the same pitfalls the P5 libs fell into, namely not handling exceptions properly. It is a case that does not typically happen, but in case we would have virtual memory, would fail miserably. The Mu-based libs have been carefully crafted to handle such cases correctly, thus do not generate exceptions by executing code itself, but creating artificial exceptions that (seem to) come from the user code, such that the Os layer can handle them correctly.

Here we go again... ::)

This library, the original C= 68040.library (and ALL 3rd party libraries EXCEPT your mmu.library) don't support virtual memory. I assume that's one of the reasons (besides your own EGO) why you trolled against FastCache040+ when it was first released (even though the documentation clearly warned users about this).

What is interesting, is that since you already added the logical to physical address code to the mmu.library you failed to realize this simple test can determine the choice of using the dog slow CachePre/PostDMA() functions or the much faster functions.

So, far I've never received a single request to support virtual memory (Thanks to many smart users!), but I did quote it as one of the reasons why TurboMMU040+ doesn't support the mmu.library.  ;)
     
Title: Re: 68060.library update
Post by: kolla on February 25, 2020, 02:24:22 PM
Why don't you guys just form a committee or something... share the code, peer reviews, ask for votes... (lolz)
Title: Re: 68060.library update
Post by: guest11527 on February 25, 2020, 03:21:33 PM
This library, the original C= 68040.library (and ALL 3rd party libraries EXCEPT your mmu.library) don't support virtual memory.
The original 68040.library does not run into this borderline case because it does not exist on the 68040, that's quite simple. The issue exists on the 68060 since it does not, unlike the 68040, attempt to fetch operands into its stack frame. The mentioned call-outs are only available on the 68060, for reasons.

I assume that's one of the reasons (besides your own EGO) why you trolled against FastCache040+ when it was first released (even though the documentation clearly warned users about this).
If it doesn't work correctly because it does not satisfy specs, it does not work correctly. That's as simple as it goes.

What is interesting, is that since you already added the logical to physical address code to the mmu.library you failed to realize this simple test can determine the choice of using the dog slow CachePre/PostDMA() functions or the much faster functions.
"But these functions are wrong - but look how fast they are!". Hey, everyone can write "fast functions" violating the specs. That's not an art. The issue does not only exist for virtual memory. It also exists for any type of MMU remapping, such as MuFastZero or MuMapROM. In both cases, DMA will be run from the wrong addresses.

Title: Re: 68060.library update
Post by: kolla on February 25, 2020, 03:32:54 PM
Justified and Ancient, oh the irony....
Title: Re: 68060.library update
Post by: SpeedGeek on February 25, 2020, 04:19:00 PM
The original 68040.library does not run into this borderline case because it does not exist on the 68040, that's quite simple. The issue exists on the 68060 since it does not, unlike the 68040, attempt to fetch operands into its stack frame. The mentioned call-outs are only available on the 68060, for reasons.
This mentioned 68060 call-outs again assume virtual memory is enabled, if the CachePre/PostDma() functions don't support it then there is no practical need for the call-outs to support it either.

If it doesn't work correctly because it does not satisfy specs, it does not work correctly. That's as simple as it goes.

"But these functions are wrong - but look how fast they are!". Hey, everyone can write "fast functions" violating the specs. That's not an art. The issue does not only exist for virtual memory. It also exists for any type of MMU remapping, such as MuFastZero or MuMapROM. In both cases, DMA will be run from the wrong addresses.

The specs are conditional for virtual memory support, so most CPU library developers wisely exercised the option not to support it. The Zero page is not a valid memory location for DMA but the ROM could support read only DMA. Now, if the remap is a mirror image of the physical ROM then there is no problem for a DMA read (without translation).

So, now we come to the extremely uncommon case of the unreliable MMU hacks for loading Kickstart image files... and of course a DMA read will fail here (without translation) but your giving up some really impressive performance improvements to maintain such an uncommon case.  ::)     
Title: Re: 68060.library update
Post by: guest11527 on February 25, 2020, 04:44:06 PM
It's a bit more complicated than that. CachePreDMA() and frieds and access error issues are related, but not identical. Consider for example debugging. For a completely harmless instruction like
Code: [Select]
fmove.d fp0,(a0)
the fpsp may be run if the operand may require denormalization. If a0 is invalid, for example NULL, a debugging tool should show the instruction as the source of the trouble. Unfortunately, if the CPU library does not play well, it will instead show an instruction in the fpsp as fetching the invalid address. As this is run in the supervisor, the task context is lost, and the stack trace is also lost.

Concerning MuFastZero: Depending on its application, it may remap quite a bit more than the zero page, depending on where exec and expansion are placed.

Why it is "wise" not to properly support MMU remapping remains rather opaque to me, really.
Title: Re: 68060.library update
Post by: klx300r on March 06, 2020, 07:37:28 AM
well after finally figuring out my instability issues were a defective ram card in my 060 I installed SpeedGeek’s 68060 lib along with TurboMMU040+ & FastCache040+ and I was surprised when quite a few WHDLoad games that I could never get working before all of a sudden worked just fine :-) Had my 1200 playing demos all night long happily too so very happy so far  ;D
Title: Re: 68060.library update
Post by: klx300r on March 07, 2020, 07:24:07 AM
 my results: A1200, Viper 060@50, AmigaOS3.1.4Update1
 
 
 TurboMMUbench 1.1
 512KB Public memory reads: 5000
 Elapsed time Mictroseconds: 338247
 
 
 CacheDMABench 1.1
 Public memory CacheDMA FCs: 9500
 Chip memory CachDMA FCs: 500
 Total CDMA Function calls: 10000
 Elapsed Time Microseconds: 471939 
Title: Re: 68060.library update
Post by: SpeedGeek on December 04, 2022, 07:52:07 PM
** 4TH NEWS UPDATE **

v40.38 released!

Minor changes:
- Added code to skip Mult64u/s patch for v45+ utility.library
- Changed JSR branches to BSR.L branches (more PC relative code
means less reloc32 code)
- Removed FPUpatchport and Allocpatchport code (since it was
never used)