Welcome, Guest. Please login or register.

Author Topic: New CopyMem & CopyMemQuick patch  (Read 4825 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: New CopyMem & CopyMemQuick patch
« Reply #14 from previous page: May 05, 2009, 06:51:04 AM »
It sounds like you are saying your code will fail on any 060 or 040 that does not have an MMU.
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline mattheyTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show only replies by matthey
Re: New CopyMem & CopyMemQuick patch
« Reply #15 on: May 05, 2009, 07:36:58 AM »
Quote

ChaosLord wrote:
It sounds like you are saying your code will fail on any 060 or 040 that does not have an MMU.


Yes! Let me read you a paragraph from Amiga Mail dated Nov/Dec 1992 Titled "The 68030 and 68040 on the Zorro III Bus" by Michael Sinz...

"As the 68040.library requires an MMU to map address space, the fix described above will not work on systems with a MC68EC040. Because burst mode on the 68040 is activated along with the cache, there is no way to prevent a 68EC040-equipped Amiga from doing full line bursts when accessing cachable address space. This means a 68EC040 cannot prevent the excessive reads and writes when reading non-cachable ZorroIII devices that reside in cachable address space. A 68EC040-equipped Amiga will experience a significant decrease in performance when accessing non-cachable Zorro III devices. For this reason we cannot recommend that anyone use a 68EC040 (or any future 68000 series CPU that has no MMU) as the CPU on a Zorro III bus system."

So, CopyMem060 is dangerous to use on the 68040 or 68060 without MMU unless all the caches are left off (default after reset). The MMU needs to map memory so bursts do not occur to certain areas of memory. After that, the CPU is smart enough not to burst into those areas of memory. This is all done by the 68060.library when the setpatch command is run in the S:Startup-Sequence. Using move16 is no more dangerous than turning on the caches in a 68040 or 68060 without the MMU setup properly and nobody in their right mind would run with the caches off. All of this does NOT apply to an emulated 68040 or 68060.
 

Offline mongo

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 964
    • Show only replies by mongo
Re: New CopyMem & CopyMemQuick patch
« Reply #16 on: May 05, 2009, 09:21:58 AM »
Quote

ChaosLord wrote:
After thinking about this in my head for 5 minutes...
I do not see how Move16 could possibly be legal on the Amiga.  In fastram or chipram.  It will corrupt any device that is DMAing into ram.



Uh... No. Why would it?
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: New CopyMem & CopyMemQuick patch
« Reply #17 on: May 05, 2009, 10:03:51 AM »
@mongo

Apparently Move16 is only illegal on Amigas lacking an MMU.

So if you have a 68EC040 or 68EC060 then you are screwed.

Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline mongo

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 964
    • Show only replies by mongo
Re: New CopyMem & CopyMemQuick patch
« Reply #18 on: May 05, 2009, 11:59:51 AM »
Quote

ChaosLord wrote:
@mongo

Apparently Move16 is only illegal on Amigas lacking an MMU.

So if you have a 68EC040 or 68EC060 then you are screwed.



No.
 

Offline mattheyTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show only replies by matthey
Re: New CopyMem & CopyMemQuick patch
« Reply #19 on: May 05, 2009, 01:59:37 PM »
Quote

mongo wrote:
Quote

ChaosLord wrote:
@mongo

Apparently Move16 is only illegal on Amigas lacking an MMU.

So if you have a 68EC040 or 68EC060 then you are screwed.



No.


Your posts are not too helpful mongo. Do you care to spread some of your great intellect with a reason or two or are we just incapable of understanding such superior intelligence? What ChaosLord said here is not worded well but practically correct. A better wording might be...

"Apparently move16 should not be used on Amigas lacking an MMU unless all the caches are off. So if you have a 68EC040 or 68EC060 then you are screwed."
 

Offline psxphill

Re: New CopyMem & CopyMemQuick patch
« Reply #20 on: September 07, 2011, 09:35:22 PM »
Quote from: matthey;452475
"As the 68040.library requires an MMU to map address space, the fix described above will not work on systems with a MC68EC040. Because burst mode on the 68040 is activated along with the cache, there is no way to prevent a 68EC040-equipped Amiga from doing full line bursts when accessing cachable address space. This means a 68EC040 cannot prevent the excessive reads and writes when reading non-cachable ZorroIII devices that reside in cachable address space. A 68EC040-equipped Amiga will experience a significant decrease in performance when accessing non-cachable Zorro III devices. For this reason we cannot recommend that anyone use a 68EC040 (or any future 68000 series CPU that has no MMU) as the CPU on a Zorro III bus system."

All the EC processors have access control registers for controlling the cache. You don't need an MMU, although as you can only use the high 8 bits of the address and you need to make the custom chip registers non cachable as well you would have to be careful with where you put your cachable and non cachable boards to achieve the best performance.
 
The following is also true of a 68ec040
 
"On an Amiga with a 68040, Exec uses one of these registers to map the low
24-bits of the Amiga's address space (the Zorro II range,
$00000000-$00FFFFFFFF) as non-cachable and serialized1 .

The Amiga uses the second register to map the remaining memory
($01000000-$FFFFFFFF) as cachable and non-serialized.  Because of its
mapping, any RAM in this region will yield considerably higher
performance than RAM in Zorro II space.  Unfortunately, this mapping
can cause problems for a Zorro III device that is not RAM."
 
By changing the ranges that are cached/non cached and making expansion.library put boards in the correct place depending on whether they are ram or not you would avoid the problem. I don't know why they didn't do that. Especially at a time when dedicating nearly 4gb of address space to ram was insane.
« Last Edit: September 07, 2011, 09:46:11 PM by psxphill »
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: New CopyMem & CopyMemQuick patch
« Reply #21 on: September 07, 2011, 10:02:42 PM »
Quote from: matthey;452505
Your posts are not too helpful mongo. Do you care to spread some of your great intellect with a reason or two or are we just incapable of understanding such superior intelligence? What ChaosLord said here is not worded well but practically correct. A better wording might be...

"Apparently move16 should not be used on Amigas lacking an MMU unless all the caches are off. So if you have a 68EC040 or 68EC060 then you are screwed."

"For this reason we cannot recommend that anyone use a 68EC040 (or any future 68000 series CPU that has no MMU) as the CPU on a Zorro III bus system."

Anyway, didnt AmigaOS have big issues with 040/060 when DMAing to fast memory? Those pre/postdma calls... Because of caches the CPU could accidentally trash data and DMAing to fast ram would only work if you had an MMU. This is completely unrelated to move16. And it would be only an issue if you had a devices with DMA support.

(Geez, I have lost so much information about Amiga in these years....)
« Last Edit: September 07, 2011, 10:06:26 PM by itix »
My Amigas: A500, Mac Mini and PowerBook
 

Offline mattheyTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show only replies by matthey
Re: New CopyMem & CopyMemQuick patch
« Reply #22 on: September 08, 2011, 01:56:19 AM »
@psxphill
Nice dig up of a 2 year old thread. There must be kludge methods for handling EC processors but they probably aren't fast or well tested. I don't recommend using move16 with an EC processor but probably the most it would do is crash. Non EC processors are not expensive and a worthwhile upgrade in my opinion.

Quote from: itix;658334

Anyway, didnt AmigaOS have big issues with 040/060 when DMAing to fast memory? Those pre/postdma calls... Because of caches the CPU could accidentally trash data and DMAing to fast ram would only work if you had an MMU. This is completely unrelated to move16. And it would be only an issue if you had a devices with DMA support.


Maybe you are thinking of the Buster chips that caused DMA problems on 4000s? I vaguely remember a bug in the AmigaOS cache flushing too. Either way, they should be fixed or worked around and shouldn't affect move16.
 

Offline psxphill

Re: New CopyMem & CopyMemQuick patch
« Reply #23 on: September 12, 2011, 02:55:56 PM »
Quote from: itix;658334
Because of caches the CPU could accidentally trash data and DMAing to fast ram would only work if you had an MMU. This is completely unrelated to move16. And it would be only an issue if you had a devices with DMA support.

You can flush the cache without a MMU. So it really shouldn't be a problem.
 
No idea why I thought this was a current thread :-)
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: New CopyMem & CopyMemQuick patch
« Reply #24 on: September 12, 2011, 04:50:36 PM »
Quote from: psxphill;659056
You can flush the cache without a MMU. So it really shouldn't be a problem.

 
It won't help because caches could get dirty again.

Quote

No idea why I thought this was a current thread :-)


Me neither :)

@matthey
Quote

Maybe you are thinking of the Buster chips that caused DMA problems on 4000s? I vaguely remember a bug in the AmigaOS cache flushing too. Either way, they should be fixed or worked around and shouldn't affect move16.


I dont think it has anything to do with Buster... if you DMA to fast ram CPU wont know about it. It could accidentally trash data crossing cache line boundary.
My Amigas: A500, Mac Mini and PowerBook