Temporary turning FAST memory off
Hi,
is there a way to turn off FAST memory so the system can't allocate it any more apart from this very common technique? Code:
CNOP 0,4 Does anyone know a smarter way in assembler? |
Start with an empty list
If list empty get all memory and store memory pointers to list if list not empty, walk list & free all list memory pointers |
Even easier: store all address/size pairs in first (largest) allocated block.
|
Quote:
Quote:
|
Why not patching AllocMem() and AvailMem() and let them simply return zero to all FastMem requests?
|
Quote:
IMHO LVO patching should be only used if there is no other cleaner solution. |
Ok, it depends on what you want to keep off from getting FastMem. And yes, of course, there are also Allocate(), AllocPooled(), AllocAbs() and AllocVec(). The latter calls AllocMem(). Don't know what the other functions are doing, whether they are based on AllocMem() too or not.
But I just had a short look into the disassembler listing of NoFastMem, which could be easily integrated into other programs. NoFastMem patches AvailMem() and AllocMem(), maybe in a little bit different way, but it's going into the same direction. On the other side, when you are trying to allocate all available FastMem blocks you are never finished with that task, because at any time other programs may set their used blocks of FastMem free again, and then you will get into a race condition with those which want to allocate these new FastMem blocks. |
Why not using NoFastMem itself ?
From within a program it should be easy to call Execute() or a similar function. If it doesn't work on pre 2.0 then it can probably be adapted. |
Quote:
Code:
CNOP 0,4 My idea is to patch the memory-list at the pointer Exec-Base->MemList. Just removing the node of FAST memory out of the memory list with Remove() and inserting it again with Insert(). But this could be dangerous, because it's a private structure and could mess everything up. |
Quote:
Quote:
|
Quote:
Yes, using it via Execute() could be a solution, but then my program would require the pre OS2.0 NoFastMem in a OS 2.0+ environment. |
Quote:
|
I think that some bootblocks can do that. Turn off memory and floppy drives. And some could switch PAL/NTSC.
|
Quote:
(But don't ask me how to do that, i've tried to change priority of the mem nodes and it didn't work :D). Quote:
Then again, it all depends why you want to remove fastmem from the system. What does your program do ? What is the final goal ? Perhaps better solutions exist than just removing the fastmem. |
Quote:
|
Quote:
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. |
Quote:
|
I fail to see any good use for that in a bootblock. :confused
If you're running your own code, it's a magnitude simpler to just pass the correct flags to allocmem calls in order to get chipmem. And if it's not your own code that runs after, patching it shouldn't be that hard either. |
Quote:
Quote:
Sorry, that I didn't mention it. What I intended to do is loading executable files with LoadSeg(). These files should not be loaded into FAST memory, because it is most likely, they were coded on a machine without extra memory and the coder didn't expect there will be such like in old intros/demos. So FAST memory must be turned off before. After some system modifications, the code of the file is executed. But if any error occurs during my modifications or the file can't be loaded, I have to free the allocated FAST memory and exit my program. To my mind, I already have a solution that is not too complicated with the second code I have posted. |
Quote:
Quote:
|
All times are GMT +2. The time now is 02:22. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.