Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2001-10-31 22:19:08 +0300
committerJeff Johnston <jjohnstn@redhat.com>2001-10-31 22:19:08 +0300
commit75241b15dbe979163b1cc95df6a5c16e30ddde7b (patch)
tree0b3d11e5730816f974785eb6ff133500620cac8f /libgloss/mn10300/cygmon.c
parent747e5773319f36839927dd67005ceab836ede48d (diff)
2001-10-31 David Howells <dhowells@redhat.com>
* syscall.h: Added SYS_times, SYS_gettimeofday, SYS_link values. * mn10300/times.c: Renamed "times" to "_times" so that it can be referenced by newlib. * mn10300/cygmon.c: New file. * mn10300/crt0_redboot.S: Ditto. * mn10300/crt0_cygmon.S: Ditto. * mn10300/Makefile.in: Added RedBoot and Cygmon support. * mn10300/configure.in: Changed to allow for future evaluation boards to be added. * mn10300/configure: Regenerated.
Diffstat (limited to 'libgloss/mn10300/cygmon.c')
-rw-r--r--libgloss/mn10300/cygmon.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/libgloss/mn10300/cygmon.c b/libgloss/mn10300/cygmon.c
new file mode 100644
index 000000000..513115cd6
--- /dev/null
+++ b/libgloss/mn10300/cygmon.c
@@ -0,0 +1,73 @@
+/* cygmon.c -- Glue code for linking apps to run on top of Cygmon.
+ *
+ * Copyright (c) 1998, 1999, 2000, 2001 Red Hat, Inc.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+#include <errno.h>
+
+// These need to be kept in sync with the definitions in Cygmon.
+#define SYS_meminfo 1001
+#include "syscall.h"
+
+/* Structure filled in by get_mem_info. Only the size field is
+ actually used (by sbrk), so the others aren't even filled in. */
+struct s_mem
+{
+ unsigned int size;
+ unsigned int icsize;
+ unsigned int dcsize;
+};
+
+// Perform a system call.
+// Unused parameters should be set to 0.
+int __trap0(unsigned long func, unsigned long p1, unsigned long p2, unsigned long p3)
+{
+ int ret = 0;
+#ifdef __AM33__
+ {
+ register unsigned long d0 asm ("d0") = func;
+ register unsigned long d1 asm ("d1") = p1;
+ register unsigned long d2 asm ("d2") = p2;
+ register unsigned long d3 asm ("d3") = p3;
+ asm volatile (" syscall 0\n"
+ " nop"
+ : "+d" (d0) : "d" (d1), "d" (d2), "d" (d3) : "memory");
+ ret = d0;
+ }
+#endif
+
+ if (func == SYS_exit)
+ {
+ while (1)
+ {
+ asm volatile (" .byte 0xff "); // trigger a breakpoint to drop back into Cygmon
+ }
+ }
+
+ if (ret != 0)
+ errno = ret;
+
+ return ret;
+}
+
+void *
+get_mem_info (mem)
+ struct s_mem *mem;
+{
+ unsigned long totmem = 0, topmem = 0;
+ register int numbanks;
+
+ numbanks = __trap0(SYS_meminfo, (unsigned long)&totmem, (unsigned long)&topmem, 0);
+ mem->size = totmem;
+ return (void*)topmem;
+}