English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 31 August 2018, 10:05   #21
dissident
Registered User

 
Join Date: Sep 2015
Location: Germany
Posts: 170
Quote:
Originally Posted by alkis View Post
This.

It patches AvailMem to never report the fast mem (which stays unallocated), and patches AllocMem to clear the bit of FAST_MEMORY and always return CHIP_MEMORY.
Good work, alkis. So the patching could have done with SetFunction(). Just a short own header-routine to change the memory request passed over in D1 and then run the original AllocMem() function. This patch could be removed easily by resetting the LVO to the original routine.
dissident is offline  
Old 31 August 2018, 10:08   #22
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,321
Quote:
Originally Posted by dissident View Post
Yes, modifying the hunks could be a solution, but fails, if the exe file itself allocates memory not correctly and doesn't request CHIP memory in particular. To be honest, modifying hunks is not something I've done yet.
If the exe file itself allocates memory not correctly, then it's a matter of patching it - something you already do for other reasons. Find calls to exec allocation functions and add the flag.

For altering the executable's header with a chipmem flag, it's not as complicated as it looks.
Get number of hunks at +8. Each one has a size longword, they start at +$14. Replace first byte (which is $00) with $40 and you're done.

Usually old intros will be single hunk and don't perform allocmems so that's a single byte to change. Don't use a tank to go shopping .
meynaf is offline  
Old 31 August 2018, 10:14   #23
dissident
Registered User

 
Join Date: Sep 2015
Location: Germany
Posts: 170
So, I guess, I've got a solution for my case. I tend to use the second code I posted. If it isn't enough, I will patch AllocMem(). Modifying hunks is too complex for me at the moment, but I will keep this in mind.

Thanks everyone for your good ideas and hints. As usual, I've learned something.
dissident is offline  
Old 31 August 2018, 10:20   #24
dissident
Registered User

 
Join Date: Sep 2015
Location: Germany
Posts: 170
Quote:
Originally Posted by meynaf View Post
If the exe file itself allocates memory not correctly, then it's a matter of patching it - something you already do for other reasons. Find calls to exec allocation functions and add the flag.

For altering the executable's header with a chipmem flag, it's not as complicated as it looks.
Get number of hunks at +8. Each one has a size longword, they start at +$14. Replace first byte (which is $00) with $40 and you're done.

Usually old intros will be single hunk and don't perform allocmems so that's a single byte to change. Don't use a tank to go shopping .
Hmm, modifying the hunks seems not so complex as I thought. It will try this. Thanks for the hints, meynaf.
dissident is offline  
Old 31 August 2018, 10:42   #25
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,108
If you use LoadSeg() and want to make this more complex and more interesting: use InternalLoadSeg(), it uses caller defined alloc/free functions..

Quote:
Originally Posted by meynaf View Post
Less dangerous than removing the entry, would be to set priority so that chipmem is allocated first. Then, no fast mem unless the system runs out of chip.
(But don't ask me how to do that, i've tried to change priority of the mem nodes and it didn't work ).
You need to re-insert the entry (node) in correct position. Forbid() + Remove() + Enqueue() + Permit().

Memory allocator scans nodes one by one until it finds entry that succeeds in memory allocation. It does not care about priority field.

Last edited by Toni Wilen; 31 August 2018 at 10:53. Reason: Enqueue, not Insert
Toni Wilen is online now  
Old 31 August 2018, 10:49   #26
Hedeon
Sonnet Hacker

 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 838
Quote:
Originally Posted by Toni Wilen View Post

Memory allocator scans nodes one by one until it finds entry that succeeds in memory allocation. It does not care about priority field.
That is why normally you would Enqueue() the memory node so it gets inserted based on priority. The list indeed gets searched from top to bottom.

So why not just Remove() memory with FASTRAM attributes from the MemList?
Hedeon is offline  
Old 31 August 2018, 10:54   #27
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,108
Quote:
Originally Posted by Hedeon View Post
That is why normally you would Enqueue() the memory node so it gets inserted based on priority. The list indeed gets searched from top to bottom.
Oops, I meant Enqueue().

Quote:
So why not just Remove() memory with FASTRAM attributes from the MemList?
It was already mentioned: if something (some other process, or OS internal allocation) decides to free memory that was originally allocated from fast ram: crash..
Toni Wilen is online now  
Old 31 August 2018, 11:21   #28
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,157
Quote:
Originally Posted by meynaf View Post
I fail to see any good use for that in a bootblock.

Such bootblocks were often used for game/demo compilations and allowed to run stuff which didn't work with fast memory.
StingRay is offline  
Old 31 August 2018, 11:24   #29
Hedeon
Sonnet Hacker

 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 838
Quote:
Originally Posted by Toni Wilen View Post
It was already mentioned: if something (some other process, or OS internal allocation) decides to free memory that was originally allocated from fast ram: crash..
Meh, me and my lame quick thread scan skills. And you're right of course about the crash. Mem header not found.
Hedeon is offline  
Old 31 August 2018, 11:57   #30
sigma63
Registered User

 
Join Date: Oct 2014
Location: Berlin
Posts: 128
Quote:
Originally Posted by meynaf View Post
For altering the executable's header with a chipmem flag, it's not as complicated as it looks.
Get number of hunks at +8. Each one has a size longword, they start at +$14. Replace first byte (which is $00) with $40 and you're done.
There was already a CLI-Command for that purpose called ATOM.
It was part of assemblers/compilers in these good old days .

If you need, i can look for it.

Cheers
sigma63 is offline  
Old 31 August 2018, 20:40   #31
dissident
Registered User

 
Join Date: Sep 2015
Location: Germany
Posts: 170
Quote:
Originally Posted by Toni Wilen View Post
If you use LoadSeg() and want to make this more complex and more interesting: use InternalLoadSeg(), it uses caller defined alloc/free functions..
I will keep this in mind. A good hint.

Quote:
Originally Posted by Toni Wilen View Post
You need to re-insert the entry (node) in correct position. Forbid() + Remove() + Enqueue() + Permit().

Memory allocator scans nodes one by one until it finds entry that succeeds in memory allocation. It does not care about priority field.
This is really interesting and confirms the system's list handling. Every node points to its predecessor and successor. So to insert a node at the head of the list, AddHead() could be used. Or AddTail() to append a note to the tail of the list I guess.
dissident is offline  
Old 31 August 2018, 20:44   #32
dissident
Registered User

 
Join Date: Sep 2015
Location: Germany
Posts: 170
Quote:
Originally Posted by sigma63 View Post
There was already a CLI-Command for that purpose called ATOM.
It was part of assemblers/compilers in these good old days .

If you need, i can look for it.

Cheers
I would be interested in that tool.
dissident is offline  
Old 31 August 2018, 21:48   #33
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 50
Posts: 1,083
Quote:
Originally Posted by dissident View Post
Yes, modifying the hunks could be a solution, but fails, if the exe file itself allocates memory not correctly and doesn't request CHIP memory in particular. To be honest, modifying hunks is not something I've done yet.



Yes, you got it. That's exactly what I will do.
For LoadSeg this is very easy job to do. I used hunks modification for one player, i dont remember exactly if i forced this exe player to load to chip ram ($00 to $40) or to load to fast/any ram ($40 to $00) for save some chip ram memory.

Ok. perhaps it was Amplifier version for EaglePlayer 2. For save chip ram. If FastLoading in EP2 was enabled.

Last edited by Don_Adan; 31 August 2018 at 21:55. Reason: Update
Don_Adan is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
WinUAE 3.2.1. memory dump for fake fast memory areas broken StingRay support.WinUAE 1 14 December 2015 21:39
A1200 Loses Fast Memory Amicol Amiga scene 24 23 February 2014 18:49
Adding more then 8 MB of Fast Memory in WINUAE? Kenan support.WinUAE 3 16 June 2013 20:20
Use of 4MB PCMCIA Fast Flash Memory as Fast RAM in A1200 nkarytia support.Hardware 10 16 September 2011 14:37
Max Fast Memory In WinUAE CodyJarrett support.WinUAE 11 19 April 2002 22:18

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.11012 seconds with 15 queries