1 /* eva_app.c -- Glue code for linking apps to run under GDB debugger control.
3 * Copyright (c) 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
17 typedef void (*write_proc_t
)(char *buf
, int nbytes
);
18 typedef int (*read_proc_t
)(char *buf
, int nbytes
);
20 /* There is no "syscall", so we just call directly into the stub code
21 at fixed addresses. */
22 #define STUB_WRITE(p,n) ((write_proc_t)0x8084)((p),(n))
23 #define STUB_READ(p,n) ((read_proc_t)0x8088)((p),(n))
26 * print -- do a raw print of a string
31 STUB_WRITE(ptr
, strlen(ptr
));
35 * write -- write bytes to the serial port. Ignore fd, since
36 * stdout and stderr are the same. Since we have no filesystem,
37 * open will only return an error.
40 _write (int fd
, char *buf
, int nbytes
)
42 STUB_WRITE(buf
, nbytes
);
47 _read (int fd
, char *buf
, int nbytes
)
49 return STUB_READ(buf
, nbytes
);
53 #define HEAP_LIMIT ((char *)0xffff)
58 static char *heap_ptr
= _end
;
61 if (inc
> (HEAP_LIMIT
- heap_ptr
))
76 asm volatile (".hword 0x0006"); /* breakpoint (special illegal insn) */