1 /* cygmon.c -- Glue code for linking apps to run on top of Cygmon.
3 * Copyright (c) 1998, 1999, 2000, 2001 Red Hat, Inc.
5 * The authors hereby grant permission to use, copy, modify, distribute,
6 * and license this software and its documentation for any purpose, provided
7 * that existing copyright notices are retained in all copies and that this
8 * notice is included verbatim in any distributions. No written agreement,
9 * license, or royalty fee is required for any of the authorized uses.
10 * Modifications to this software may be copyrighted by their authors
11 * and need not follow the licensing terms described here, provided that
12 * the new terms are clearly indicated on the first page of each file where
18 // These need to be kept in sync with the definitions in Cygmon.
19 #define SYS_meminfo 1001
22 /* Structure filled in by get_mem_info. Only the size field is
23 actually used (by sbrk), so the others aren't even filled in. */
31 // Perform a system call.
32 // Unused parameters should be set to 0.
33 int __trap0(unsigned long func
, unsigned long p1
, unsigned long p2
, unsigned long p3
)
38 register unsigned long d0
asm ("d0") = func
;
39 register unsigned long d1
asm ("d1") = p1
;
40 register unsigned long d2
asm ("d2") = p2
;
41 register unsigned long d3
asm ("d3") = p3
;
42 asm volatile (" syscall 0\n"
44 : "+d" (d0
) : "d" (d1
), "d" (d2
), "d" (d3
) : "memory");
53 asm volatile (" .byte 0xff "); // trigger a breakpoint to drop back into Cygmon
67 unsigned long totmem
= 0, topmem
= 0;
68 register int numbanks
;
70 numbanks
= __trap0(SYS_meminfo
, (unsigned long)&totmem
, (unsigned long)&topmem
, 0);