OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [xstormy16/] [eva_app.c] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* eva_app.c -- Glue code for linking apps to run under GDB debugger control.
2
 *
3
 * Copyright (c) 2001 Red Hat, Inc.
4
 *
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
13
 * they apply.
14
 */
15
#include "glue.h"
16
 
17
typedef void (*write_proc_t)(char *buf, int nbytes);
18
typedef int  (*read_proc_t)(char *buf, int nbytes);
19
 
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))
24
 
25
/*
26
 * print -- do a raw print of a string
27
 */
28
void
29
print(char *ptr)
30
{
31
  STUB_WRITE(ptr, strlen(ptr));
32
}
33
 
34
/*
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.
38
 */
39
int
40
_write (int fd, char *buf, int nbytes)
41
{
42
  STUB_WRITE(buf, nbytes);
43
  return (nbytes);
44
}
45
 
46
int
47
_read (int fd, char *buf, int nbytes)
48
{
49
  return STUB_READ(buf, nbytes);
50
}
51
 
52
extern char _end[];
53
#define HEAP_LIMIT ((char *)0xffff)
54
 
55
void *
56
_sbrk(int inc)
57
{
58
  static char *heap_ptr = _end;
59
  void *base;
60
 
61
  if (inc > (HEAP_LIMIT - heap_ptr))
62
    return (void *)-1;
63
 
64
  base = heap_ptr;
65
  heap_ptr += inc;
66
 
67
  return base;
68
}
69
 
70
void
71
_exit(int n)
72
{
73
  while (1)
74
   {
75
     asm volatile ("nop");
76
     asm volatile (".hword 0x0006");  /* breakpoint (special illegal insn) */
77
   }
78
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.