C:Avail - FLUSH should now handle systems with >2G of memory
authorjmcmullan <jmcmullan@fb15a70f-31f2-0310-bbcc-cdcc74a49acc>
Mon, 22 Jul 2013 14:21:03 +0000 (22 14:21 +0000)
committerjmcmullan <jmcmullan@fb15a70f-31f2-0310-bbcc-cdcc74a49acc>
Mon, 22 Jul 2013 14:21:03 +0000 (22 14:21 +0000)
Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@47750 fb15a70f-31f2-0310-bbcc-cdcc74a49acc

arch/m68k-amiga/c/FlushMem.c [deleted file]
arch/m68k-amiga/c/mmakefile.src
workbench/c/Avail.c

diff --git a/arch/m68k-amiga/c/FlushMem.c b/arch/m68k-amiga/c/FlushMem.c
deleted file mode 100644 (file)
index 5989624..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <proto/dos.h>
-#include <proto/exec.h>
-
-#include <aros/shcommands.h>
-
-#define BUG(x) do { const char *cp = x; while (*cp) { RawPutChar(*cp); cp++; } } while (0)
-
-void flushall(struct ExecBase *SysBase)
-{
-    APTR ptr;
-    ptr = AllocMem(0x7fffffff, MEMF_ANY);
-    if (ptr) {
-        flushall(SysBase);
-        FreeMem(ptr, 0x7fffffff);
-    }
-}
-
-AROS_SH0H(FlushMem, 1.0, "Flush all expungable memory")
-{
-    AROS_SHCOMMAND_INIT
-
-    BUG("---- FlushMem: Begin\n");
-    flushall(SysBase);
-    BUG("---- FlushMem: End\n");
-    return RETURN_OK;
-
-    AROS_SHCOMMAND_EXIT
-}
index 774902a..3bbad5a 100644 (file)
@@ -43,7 +43,7 @@ FILES := gdbstub
     files=$(FILES) targetdir=$(AROS_C) \
     detach=yes
 
-FILES := gdbstop FlushMem
+FILES := gdbstop
 
 %build_progs mmake=workbench-c-m68k-misc \
     files=$(FILES) targetdir=$(AROS_C) \
index 924fa6c..f2e4e98 100644 (file)
@@ -85,6 +85,20 @@ int __nocommandline = 1;
 
 BOOL aHuman;
 
+/* Allocate all memory (even for >2G systems), then free it.
+ * This will force all expungable items out of memory
+ */
+static void FlushMem(struct ExecBase *SysBase)
+{
+    APTR Mem;
+
+    Mem = AllocMem(0x7ffffff0, MEMF_PUBLIC);
+    if (Mem) {
+        FlushMem(SysBase);
+        FreeMem(Mem, 0x7ffffff0);
+    }
+}
+
 int main(void)
 {
     IPTR           args[NOOFARGS] = { (IPTR)FALSE,
@@ -133,11 +147,7 @@ int main(void)
        {
            if (aFlush)
            {
-                    APTR Mem;
-
-                    Mem = AllocMem(0x7ffffff0, MEMF_PUBLIC);
-                    if (Mem)
-                        FreeMem(Mem, 0x7ffffff0);
+               FlushMem(SysBase);
            }
            
            if(aChip)