1 /* cygmon.c -- Glue code for linking apps to run on top of Cygmon.
3 * Copyright (c) 1998, 1999, 2000 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
23 return sysCall(SYS_write
, file
, (unsigned long)buf
, nbytes
);
31 return sysCall(SYS_read
, file
, (unsigned long)buf
, nbytes
);
35 outbyte (unsigned char c
)
37 return sysCall(SYS_write
, 0, (unsigned long)&c
, 1);
44 sysCall(SYS_read
, 0, (unsigned long)&c
, 1);
49 /* Structure filled in by get_mem_info. Only the size field is
50 actually used (by sbrk), so the others aren't even filled in. */
58 // Perform a system call.
59 // Unused parameters should be set to 0.
60 int sysCall(unsigned long func
, unsigned long p1
, unsigned long p2
, unsigned long p3
)
70 move %0, $2" : "=r"(ret
) : "r"(func
), "r"(p1
), "r"(p2
), "r"(p3
));
74 // These need to be kept in sync with the definitions in Cygmon.
75 #define SYS_meminfo 1001
81 unsigned long totmem
= 0, topmem
= 0;
84 numbanks
= sysCall(SYS_meminfo
, (unsigned long)&totmem
, (unsigned long)&topmem
, 0);