m68k-amiga: Cleanup gdbstop, add FlushMem
authorjmcmullan <jmcmullan@fb15a70f-31f2-0310-bbcc-cdcc74a49acc>
Sun, 21 Jul 2013 21:40:40 +0000 (21 21:40 +0000)
committerjmcmullan <jmcmullan@fb15a70f-31f2-0310-bbcc-cdcc74a49acc>
Sun, 21 Jul 2013 21:40:40 +0000 (21 21:40 +0000)
Should FlushMem go to workbench/c/ ?

Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@47749 fb15a70f-31f2-0310-bbcc-cdcc74a49acc

arch/m68k-amiga/c/FlushMem.c [new file with mode: 0644]
arch/m68k-amiga/c/gdbstop.c
arch/m68k-amiga/c/mmakefile.src

diff --git a/arch/m68k-amiga/c/FlushMem.c b/arch/m68k-amiga/c/FlushMem.c
new file mode 100644 (file)
index 0000000..5989624
--- /dev/null
@@ -0,0 +1,28 @@
+#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 eb3b8b7..d1ae96a 100644 (file)
@@ -1,17 +1,15 @@
 #include <proto/dos.h>
 #include <proto/exec.h>
 
+#include <aros/shcommands.h>
 
-int main(int argc, char **argv)
+AROS_SH0H(GdbStop, 1.0, "Issue a debugger breakpoint")
 {
-    APTR DOSBase;
+    AROS_SHCOMMAND_INIT
 
-    if ((DOSBase = OpenLibrary("dos.library", 0))) {
-       asm volatile ("trap #1\n");
-       PutStr("Back from GDB breakpoint\n");
-       CloseLibrary(DOSBase);
-    } else {
-       return RETURN_ERROR;
-    }
+    asm volatile ("trap #1\n");
+    PutStr("Back from trap #1 breakpoint\n");
     return RETURN_OK;
+
+    AROS_SHCOMMAND_EXIT
 }
index 559ac50..774902a 100644 (file)
@@ -14,14 +14,14 @@ USER_AFLAGS := -I$(GENINCDIR) -Os
 #MM                     kernel-kernel-includes \
 #MM                     linklibs \
 #MM                     workbench-c-m68k-gdbstub \
-#MM                     workbench-c-m68k-gdbstop \
+#MM                     workbench-c-m68k-misc \
 #MM                     workbench-c-m68k-setpatcharos \
 #MM                     workbench-c-m68k-arosbootstrap \
 #MM                     workbench-c-m68k-mmudump \
 #MM                     workbench-c-m68k-setpatch
 
 #MM- workbench-c-m68k-quick: workbench-c-m68k-gdbstub-quick \
-#MM                          workbench-c-m68k-gdbstop-quick \
+#MM                          workbench-c-m68k-misc-quick \
 #MM                          workbench-c-m68k-setpatcharos-quick \
 #MM                          workbench-c-m68k-arosbootstrap-quick \
 #MM                          workbench-c-m68k-mmudump-quick \
@@ -29,8 +29,6 @@ USER_AFLAGS := -I$(GENINCDIR) -Os
 
 #MM workbench-c-m68k-gdbstub : linklibs-loadseg
 
-#MM workbench-c-m68k-gdbstop : linklibs-loadseg
-
 #MM workbench-c-m68k-arosbootstrap : linklibs-loadseg
 
 #MM workbench-c-m68k-setpatcharos : linklibs-loadseg
@@ -45,10 +43,11 @@ FILES := gdbstub
     files=$(FILES) targetdir=$(AROS_C) \
     detach=yes
 
-FILES := gdbstop
+FILES := gdbstop FlushMem
 
-%build_progs mmake=workbench-c-m68k-gdbstop \
-    files=$(FILES) targetdir=$(AROS_C)
+%build_progs mmake=workbench-c-m68k-misc \
+    files=$(FILES) targetdir=$(AROS_C) \
+    usestartup=no
 
 CFILES := SetPatchAROS
 AFILES := newstackswap